Token导航 LogoToken导航TokenDH.com
Multi Tenant GitHub MCP logo
开发工具stdio官方级别未说明来源级核验

Multi Tenant GitHub MCP

MCP Server

multi-tenant-github-mcp是一个基于FastMCP的模型上下文协议服务器,支持动态工具加载和配置管理,适用于开发工具集成和自动化测试场景。

工具数

1

提示词数

0

GitHub Stars

0

资源数

0
开发工具Python自动化测试

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

christian-posta

提供方

christian-posta

最后核验

2026/5/17 20:21

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

uv run python src/main.py

详细介绍

多租户github mcp

多租户github mcp是一个使用FastMCP构建的模型上下文协议(mcp)服务器,具有动态工具加载功能。

特性

  • 动态工具加载:工具会自动从以下位置发现和加载 src/tools/
  • 每个文件一个工具:每个工具都是一个具有与文件名匹配的函数的单个文件
  • FastMCP集成:利用FastMCP实现强大的MCP协议处理
  • 配置管理:通过工具进行特定配置 kmcp.yaml
  • 快速失败:如果任何工具加载失败,服务器将不会启动
  • 自动生成的测试:工具验证的自动测试生成

项目结构

src/
├── tools/              # Tool implementations (one file per tool)
│   ├── echo.py         # Example echo tool
│   └── __init__.py     # Auto-generated tool registry
├── core/               # Dynamic loading framework
│   ├── server.py       # Dynamic MCP server
│   └── utils.py        # Shared utilities
└── main.py             # Entry point
kmcp.yaml               # Configuration file
tests/                  # Generated tests

快速开始

选项1:本地开发(使用Python/uv)

  1. 再进行:
   uv sync
  1. 运行服务器:
   # Stdio mode (default MCP transport)
   uv run python src/main.py

   # HTTP mode with WebSocket MCP endpoint
   uv run python src/main.py --http

   # HTTP mode with custom host/port
   uv run python src/main.py --http --host 0.0.0.0 --port 8080
  1. 使用uv脚本:
   # Development mode (HTTP on port 3000)
   uv run dev

   # HTTP mode
   uv run dev-http

   # Stdio mode
   uv run start
  1. 添加新工具:
   # Create a new tool (no tool types needed!)
   kmcp add-tool weather

   # The tool file will be created at src/tools/weather.py
   # Edit it to implement your tool logic

选项2:仅Docker开发(不需要本地Python/uv)

  1. 构建Docker镜像:
   kmcp build --verbose
  1. 在容器中运行:
   docker run -i multi-tenant-github-mcp:latest
  1. 部署到Kubernetes:
   kmcp deploy mcp --apply
  1. 添加新工具:
   # Create a new tool
   kmcp add-tool weather

   # Edit the tool file, then rebuild
   kmcp build

HTTP传输模式

出于开发和集成目的,服务器支持在HTTP模式下运行。

以HTTP模式启动

# Command line flag
python src/main.py --http

# Environment variable
MCP_TRANSPORT_MODE=http python src/main.py

# Custom host and port
python src/main.py --http --host localhost --port 8080

创建工具

基本工具结构

每个工具都是一个Python文件 src/tools/ 包含一个装饰有 @mcp.tool():

# src/tools/weather.py
from core.server import mcp
from core.utils import get_tool_config, get_env_var

@mcp.tool()
def weather(location: str) -> str:
    """Get weather information for a location."""
    
    # Get tool configuration
    config = get_tool_config("weather")
    api_key = get_env_var(config.get("api_key_env", "WEATHER_API_KEY"))
    base_url = config.get("base_url", "https://api.openweathermap.org/data/2.5")
    
    # TODO: Implement weather API call
    return f"Weather for {location}: Sunny, 72°F"

工具示例

生成的工具模板包括常见模式的注释示例:

# HTTP API calls
# async with httpx.AsyncClient() as client:
#     response = await client.get(f"{base_url}/weather?q={location}&appid={api_key}")
#     return response.json()

# Database operations  
# async with asyncpg.connect(connection_string) as conn:
#     result = await conn.fetchrow("SELECT * FROM weather WHERE location = $1", location)
#     return dict(result)

# File processing
# with open(file_path, 'r') as f:
#     content = f.read()
#     return {"content": content, "size": len(content)}

配置

在中配置工具 kmcp.yaml:

tools:
  weather:
    api_key_env: "WEATHER_API_KEY"
    base_url: "https://api.openweathermap.org/data/2.5"
    timeout: 30
  
  database:
    connection_string_env: "DATABASE_URL"
    max_connections: 10

测试

运行生成的测试以验证您的工具是否正确加载:

uv run pytest tests/

发展

添加依赖关系

更新 pyproject.toml 并运行:

uv sync

代码质量

uv run black .
uv run ruff check .
uv run mypy .

部署

码头工人

# Build image (handles lockfile automatically)
kmcp build

# Run container
docker run -i multi-tenant-github-mcp:latest

Kubernetes

# Deploy to Kubernetes
kmcp deploy mcp --apply

# Check deployment status
kubectl get mcpserver multi-tenant-github-mcp

目录标签

目录标签

开发工具Python自动化测试动态工具加载本地部署FastMCP集成

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

1

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP