有让所有 MCP Server 使用相同 URL 前缀的需求,找了一个工具 mcp-gateway,做了些许改进:
- 添加容器化支持,Docker Image 也上传到了 Docker Hub。
- 添加环境变量传递的支持,对于很多 MCP Server 非常有必要。
- 添加 UV 的支持,从而支持 Python 实现的 MCP Server。
新代码上传到了 mcp-gateway-docker。
一个示例配置文件:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| hostname: "0.0.0.0" port: 3000
debug: level: "debug"
servers: tavily: type: stdio command: npx args: - -y - "tavily-mcp@0.2.0" env: - TAVILY_API_KEY="tvly-xxx"
firecrawl: type: stdio command: npx args: - -y - "firecrawl-mcp" env: - FIRECRAWL_API_URL="https://xxx"
gemini-git-ask: type: stdio command: npx args: - -y - "git-ask-mcp-server" env: - SERVICE_URL="http://192.168.100.101:18080"
mcp-server-arxiv: type: stdio command: uv args: - tool - run - arxiv-mcp-server env: - STORAGE_PATH="/app/mcp-data/mcp-server-arxiv"
|
我就能以例如 http://192.168.100.101:23000/gemini-git-ask 的链接,SSE 的方式访问我的 MCP Server 了。