使用说明
MCP SSE启动器
基于Python的模型上下文协议(MCP)服务器管理系统,自动将基于stdio的服务器与Supergateway封装在一起,将其作为SSE端点公开,并提供基于web的检查器进行测试。
主要特点
- 自动更新 -使MCP服务器自动保持最新状态
- 本底监测 -自动重启崩溃的服务器
- Web检查器 -通过浏览器调试和测试MCP服务器
- SSE转换 -封装stdio服务器以实现HTTP/SSE访问
- AI助手集成 -适用于Cursor、Claude Desktop等。
快速开始
# 1. Install dependencies
pip install -r requirements.txt
# 2. Set up environment (copy .env.example to .env and add API keys)
cp .env.example .env
# 3. Start all MCP servers (with auto-restart)
make run-servers
# 4. Start web inspector for debugging
make run-inspector
# 5. View inspector at the URL shown in the output
常见用例
调试特定的MCP服务器
# Start inspector (will show URL with auth token)
make run-inspector
# Visit the URL shown in output to test MCP servers
添加新的MCP服务器
# Add GitHub MCP server
python mcp_servers.py add \
--name github \
--cmd npx \
--args "-y @modelcontextprotocol/server-github" \
--env GITHUB_TOKEN=your_token_here \
--port 8094
与光标AI一起使用
增添 ~/.cursor/mcp.json:
{
"mcpServers": {
"filesystem": { "url": "http://localhost:8090/sse" },
"github": { "url": "http://localhost:8094/sse" },
"brave-search": { "url": "http://localhost:8096/sse" }
}
}
重新启动有问题的服务器
# Kill conflicts and restart specific server
make restart-server SERVER=github
不自动重启运行(用于开发)
make run-servers KEEP_ALIVE=0
自动发生的事情
- 更新:启动前检查/更新npm包和git repos
- 端口冲突:检测到冲突进程,并可将其终止
- 过程监控:崩溃的服务器最多重新启动3次
- 日志记录:每台服务器登录到
/tmp/<server_name>.log - 清理:所有进程在退出时都会正确终止
可用的MCP服务器
默认配置包括流行的服务器,如:
- 文件系统 (8090)-本地文件访问
- GitHub (8094)-GitHub存储库交互
- 勇敢的搜寻 (8096)-网络搜索
- 获取 (8093)-HTTP请求
- 油管 (8092)-YouTube搜索/信息
- 记忆 (8100)-持久内存
- 操纵者 (8101)-网络自动化
故障排除
# Check what's using server ports
make check-server-ports
# Kill conflicting processes on server ports
make kill-server-conflicts
# Stop servers (inspector stops with Ctrl+C)
make stop-servers
# View server logs
tail -f /tmp/filesystem.log
配置
服务器在中定义 mcp_config.json.环境变量的使用 ${VAR} 语法和从加载 .env.
服务器配置示例:
{
"name": "github",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {"GITHUB_TOKEN": "${GITHUB_TOKEN}"},
"port": 8094,
"server_type": "stdio"
}
