/ 目录 / 演练场 / MetaMCP
● 社区 metatool-ai ⚡ 即开即用

MetaMCP

作者 metatool-ai · metatool-ai/metamcp

停止在每个客户端配置中同时处理 15 个 MCP 条目 — MetaMCP 是一种自托管网关,可将服务器聚合到一个命名空间端点后面。

MetaMCP 是一个 Docker 化的 MCP 聚合器、编排器和网关。 您在其管理 UI 中注册 N 个上游 MCP 服务器; 它将它们公开为您的客户端(Claude Desktop、Cursor 等)连接到的单个 SSE/Streamable-HTTP 端点。 工具名称具有命名空间,因此您可以安全地运行指向不同根的两个文件系统 MCP。 OAuth 2.1、每个端点 API 密钥、每个用户速率限制以及用于调试的内置检查器都包含在内。 非常适合团队和安装了 5 个以上 MCP 的任何人。

为什么要用

核心特性

实时演示

实际使用效果

metamcp.replay ▶ 就绪
0/0

安装

选择你的客户端

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "metamcp": {
      "command": "uvx",
      "args": [
        "mcp-proxy",
        "http://localhost:12008/metamcp/default/sse"
      ],
      "env": {
        "API_ACCESS_TOKEN": "mm_..."
      }
    }
  }
}

打开 Claude Desktop → Settings → Developer → Edit Config。保存后重启应用。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "metamcp": {
      "command": "uvx",
      "args": [
        "mcp-proxy",
        "http://localhost:12008/metamcp/default/sse"
      ],
      "env": {
        "API_ACCESS_TOKEN": "mm_..."
      }
    }
  }
}

Cursor 使用与 Claude Desktop 相同的 mcpServers 格式。项目级配置优先于全局。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "metamcp": {
      "command": "uvx",
      "args": [
        "mcp-proxy",
        "http://localhost:12008/metamcp/default/sse"
      ],
      "env": {
        "API_ACCESS_TOKEN": "mm_..."
      }
    }
  }
}

点击 Cline 侧栏中的 MCP Servers 图标,然后选 "Edit Configuration"。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "metamcp": {
      "command": "uvx",
      "args": [
        "mcp-proxy",
        "http://localhost:12008/metamcp/default/sse"
      ],
      "env": {
        "API_ACCESS_TOKEN": "mm_..."
      }
    }
  }
}

格式与 Claude Desktop 相同。重启 Windsurf 生效。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "metamcp",
      "command": "uvx",
      "args": [
        "mcp-proxy",
        "http://localhost:12008/metamcp/default/sse"
      ]
    }
  ]
}

Continue 使用服务器对象数组,而非映射。

~/.config/zed/settings.json
{
  "context_servers": {
    "metamcp": {
      "command": {
        "path": "uvx",
        "args": [
          "mcp-proxy",
          "http://localhost:12008/metamcp/default/sse"
        ]
      }
    }
  }
}

加入 context_servers。Zed 保存后热重载。

claude mcp add metamcp -- uvx mcp-proxy http://localhost:12008/metamcp/default/sse

一行命令搞定。用 claude mcp list 验证,claude mcp remove 卸载。

使用场景

实战用法: MetaMCP

为团队提供一个 MCP URL,而不是每台笔记本电脑 15 个配置

👤 平台团队在整个组织范围内推出 Claude Desktop / Cursor ⏱ ~45 min intermediate

何时使用: 您的团队希望文件系统、github、postgres、sentry、slack、notion 全部可用,但您不希望每个工程师都在泄漏的 JSON 文件中维护 6 个令牌。

前置条件
  • 运行 Docker 的服务器 — 任何带有 Docker Compose 的 Linux 盒子/虚拟机; ~1 CPU / 1GB RAM 就足够了
  • 上游凭据存储在服务器端 — 将 GITHUB_TOKEN、DB_URL 等放入 MetaMCP 的 .env 中 — 它们永远不会到达笔记本电脑
步骤
  1. 启动 MetaMCP
    git clone github.com/metatool-ai/metamcp && cp example.env .env && docker compose up -d✓ 已复制
    → 可通过 http://host:12008 访问管理 UI; 默认登录有效
  2. 注册上游服务器
    在 MetaMCP 管理 UI 中,添加文件系统、github、postgres、notion 作为命名空间“fs”、“gh”、“db”、“notion”。✓ 已复制
    → 每个都出现在端点的工具列表中,并带有前缀
  3. 给团队一份配置
    将 Claude Desktop 配置片段(指向 /metamcp/team-default/sse 的一个 mcp-proxy 条目)发布到内部文档。✓ 已复制
    → 每个工程师都是粘贴即走

结果: 90 秒内新员工入职; 令牌轮换在服务器端发生一次。

注意事项
  • Claude Desktop 本身无法执行 SSE — 在客户端使用 mcp-proxy (uvx mcp-proxy <sse-url>) — MetaMCP 文档包含此代码片段
  • 命名空间冲突或丑陋 — 在 MetaMCP 的覆盖 UI 中重命名工具; 例如 'fs.read_text_file' → 'repo.read'
搭配使用: filesystem · github · postgres

审核您的代理实际调用哪些 MCP 工具 - 并限制嘈杂的工具

👤 安全/平台工程师 ⏱ ~20 min intermediate

何时使用: 您需要知道调用哪些工具、调用频率以及调用哪个用户。 每台服务器的速率限制还不够——您需要聚合可见性。

步骤
  1. 开启请求日志
    在 MetaMCP 设置中,启用每个请求日志记录和端点级别速率限制(例如每个用户 10 个请求/秒)。✓ 已复制
    → 日志显示在管理 UI 中
  2. 重放可疑痕迹
    提取用户“marketing-bot”最后一小时的工具调用。 有什么 github 编写工具吗?✓ 已复制
    → 表格审核; 写调用突出显示
  3. 滥用油门工具
    将“marketing-bot”端点的“notion.create_page”设置为 1 req/min。 立即申请。✓ 已复制
    → 配置中可见速率限制; 立即生效

结果: 无需编写自定义中间件即可进行治理。

Route dev/staging/prod MCP traffic through one gateway

👤 Teams with environment-specific credentials ⏱ ~30 min advanced

何时使用: You want the same Claude Desktop config to hit staging-postgres at work and prod-postgres only with an explicit flag — no editing JSON.

步骤
  1. Create endpoints
    Create 3 MetaMCP endpoints: /dev, /staging, /prod. Wire each to the right upstream credentials.✓ 已复制
    → Three endpoint URLs
  2. Per-endpoint auth
    Give prod its own API key and enable OIDC SSO for that endpoint only.✓ 已复制
    → dev/staging open with shared key, prod behind SSO
  3. Test via inspector
    Use MetaMCP's inspector UI: call a read-only query through /prod as yourself; confirm auth works.✓ 已复制
    → Successful tool call in the inspector

结果: Accident-proof environment switching.

搭配使用: postgres

组合

与其他 MCP 搭配,撬动十倍杠杆

metamcp + filesystem + github + postgres

Hide the per-tool sprawl behind one gateway URL

Configure MetaMCP with fs, gh, db namespaces; point Claude Desktop at the gateway; stop pasting tokens into JSON.✓ 已复制
metamcp + claude-desktop

Claude Desktop speaks stdio, MetaMCP speaks SSE — use mcp-proxy as the bridge

In claude_desktop_config.json, wrap MetaMCP's SSE URL with uvx mcp-proxy.✓ 已复制
metamcp + sentry

Send MetaMCP request logs/errors into Sentry for alerting

Wire MetaMCP's OpenTelemetry/logs into Sentry; alert on 5xx rate > 1%.✓ 已复制

工具

此 MCP 暴露的能力

工具输入参数何时调用成本
(dynamic) Depends on which MCP servers you've registered — tools are forwarded with a namespace prefix Any time — it's a transparent proxy with auth + rate-limit added free (local gateway + upstream's own cost)

成本与限制

运行它的成本

API 配额
None — self-hosted
每次调用 Token 数
Same as upstream tools; MetaMCP adds ~1–3ms of proxy latency
费用
Free (MIT); you pay for the VM
提示
One small VPS ($5/mo) runs MetaMCP + a couple upstream servers; no need for Kubernetes until traffic > 100 req/s

安全

权限、密钥、影响范围

凭据存储: MetaMCP .env holds all upstream credentials; clients never see them
数据出站: Only to the upstream MCPs you've registered. Nothing phones home.
切勿授予: Expose the admin UI to the public internet without SSO or auth proxy

故障排查

常见错误与修复

Claude Desktop shows 'server failed to start'

Claude Desktop uses stdio, not SSE. Configure with uvx mcp-proxy http://host:12008/metamcp/<endpoint>/sse, not a direct URL.

验证: Try the same URL in MetaMCP's inspector first — if it works there, the issue is stdio-to-SSE bridging
Tools missing or not namespaced

Check the endpoint config — namespaces are per-endpoint, not global. Re-sync tool discovery after adding an upstream.

验证: In admin UI, click 'Re-sync tools' on the endpoint
401 at the gateway

API_ACCESS_TOKEN env must match the endpoint's API key; OAuth endpoints need a completed consent flow first.

验证: curl -H 'Authorization: Bearer $TOKEN' http://host:12008/metamcp/<ep>/mcp
Upstream MCP server keeps restarting

Check the upstream container's logs via docker logs; MetaMCP will mark it unhealthy and surface errors to clients.

验证: docker compose logs <upstream>

替代方案

MetaMCP 对比其他方案

替代方案何时用它替代权衡
IBM mcp-context-forgeEnterprise deployment with stronger IAM/governance needsHeavier stack; more config surface
mcp-use/mcp-useYou want a framework to build AI agents + servers, not just a proxyMore code; more surface; more power
Direct per-client configsYou run ≤3 MCPs and don't share configs with anyoneNo governance, no auth, tokens on every laptop

更多

资源

📖 阅读 GitHub 上的官方 README

🐙 查看未解决的 issue

🔍 浏览全部 400+ MCP 服务器和 Skills