MCP服务器模板

一个生产级MCP服务器模板,用于安全地向AI代理暴露工具,提供工具注册、权限控制、错误处理、日志和Docker部署能力,适用于构建AI代理工具服务。

  • by spalakollu
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 spalakollu/mcp-server-template-python

使用说明

MCP Server Template - Python

Overview

Production-ready MCP server template for safely exposing tools to AI agents.
Includes tool registration, permissions, logging, error handling, and example workflows.

What This Repo Is NOT

  • Not a framework for creating domain logic
  • Not a ready-to-run trading or financial system

Features

  • Tool categories: Read / Write / Destructive
  • Scoped permissions & authentication stub
  • Standardized error handling
  • Logging and observability hooks
  • Dockerized for easy deployment
  • Example workflows using a mock domain

Getting Started

  1. Clone the repo
  2. Install dependencies
    pip install -r requirements.txt  # Python
    # npm install                    # TypeScript
    
  3. Run the server
    python -m server.main
    
  4. (Optional) Run example workflows from examples/
  5. (Optional) Run with Docker
    docker build -t mcp-server-template .
    docker run mcp-server-template
    

Structure

  • server/ – Server code and entrypoint
    • tools/ – MCP tools (read, write, destructive)
    • permissions/ – Permission definitions
    • errors/ – Error types and handlers
  • examples/ – Usage examples and mock-domain workflows
  • tests/ – Test suite