Skip to main content
Glama

mcp-agent-mesh

面向 MCP 的网格网关 — 让一个 MCP 客户端能够访问 N 个 MCP 服务器,具备前缀路由、健康检查、熔断器故障转移,以及同时基于 stdio 和 Streamable HTTP 的统一端点。

它能做什么

mcp-agent-mesh 将多个上游 MCP 服务器聚合在单个逻辑 MCP 服务器之后。每个上游工具都以 server_name.tool_name 前缀暴露,因此连接到网格的客户端会看到一个单一tools/list,其中包含来自所有健康上游的工具。

当工具调用失败且该服务器的熔断器打开时,网格会在向客户端返回错误之前,自动故障转移到配置的副本服务器。

Related MCP server: mcp-0ne

功能

功能

描述

聚合

tools/list 将所有上游服务器的工具合并为一个扁平列表

前缀路由

调用 math.add,网格会路由到 math 服务器

熔断器

每服务器熔断器,支持可配置的阈值与超时

健康轮询

后台 ping 循环可提前发现上游故障

故障转移

可配置的故障转移组让别名接管故障服务器

双传输

同时作为 stdio MCP 服务器 Streamable HTTP 服务器运行

超时与重试

每次上游调用都包装在 asyncio.wait_for

架构

                     ┌─────────────────────┐
  MCP client ───────►│   MeshGateway       │
                     │   (stdio / HTTP)    │
                     └────────┬───────────┘
                              │ tools/list
                              │ tools/call
                    ┌─────────┼─────────────┐
                    ▼         ▼             ▼
               ┌────────┐ ┌─────────┐ ┌─────────┐
               │ Server │ │ Server  │ │ Server  │
               │  "A"   │ │  "B"   │ │  "C"   │   (upstream MCP servers)
               └────────┘ └─────────┘ └─────────┘

模块

模块

职责

config.py

YAML 配置解析 — ServerConfigMeshConfig

health.py

每服务器的 CircuitBreaker + ServerHealthMonitor(后台 ping)

router.py

前缀路由(server.tool)、故障转移组解析、工具注册表

gateway.py

MeshGateway — 连接上游、聚合工具列表、路由调用、通过 stdio + HTTP 提供 MCP 服务

安装

pip install -e ".[dev]"

使用

CLI(stdio 模式)

mcp-agent-mesh --config examples/mesh.yaml --transport stdio

HTTP 模式

mcp-agent-mesh --config examples/mesh.yaml --transport http --host 0.0.0.0 --port 8000

作为客户端配置(Claude Code / Codex / OpenCode)

{
  "mcpServers": {
    "mesh": {
      "command": "mcp-agent-mesh",
      "args": ["--config", "/path/to/mesh.yaml", "--transport", "stdio"]
    }
  }
}
{
  "mcpServers": {
    "mesh": {
      "url": "http://127.0.0.1:8000/mcp"
    }
  }
}

配置

完整示例请参见 examples/mesh.yaml。关键字段:

servers:
  - name: math            # tool-name prefix
    transport: stdio       # "stdio" or "http"
    command: python        # stdio: how to spawn
    args: ["-m", "..."]
    url: http://...        # http: endpoint URL
    timeout: 30.0
    circuit_breaker_threshold: 3
    circuit_breaker_timeout: 300.0

failover_groups:
  math: [math_backup]      # failover aliases for the "math" server

测试

pytest tests/ -v

测试套件使用内存中的模拟 MCP 服务器(无需真实子进程),涵盖配置解析、熔断器逻辑、前缀路由、工具聚合、故障转移以及网关的端到端行为。

许可证

MIT

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    A standalone MCP gateway that multiplexes multiple backend MCP servers behind a single endpoint, supporting both HTTP and stdio transports. It allows users to dynamically manage backends at runtime and organizes tools using a configurable namespace prefix.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    MCP Gateway that aggregates multiple upstream MCP servers into a single endpoint with persistent connections, tool registry, and authentication.
    45
    2
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    A universal MCP gateway that aggregates multiple MCP servers into a single endpoint, providing features like hot-reload, auto-healing, and a hook system for request/response mutation.
    1
    MIT

View all related MCP servers

Related MCP Connectors

  • MCP server for interacting with the Supabase platform

  • An MCP server for Arcjet - the runtime security platform that ships with your AI code.

  • MCP server for Appcircle mobile CI/CD platform.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/itsPremkumar/mcp-agent-mesh'

If you have feedback or need assistance with the MCP directory API, please join our Discord server