Multi MCP

Multi MCP

A flexible proxy server that aggregates multiple backend MCP servers into a single interface using STDIO or SSE transports. It supports dynamic server management via an HTTP API and utilizes namespacing to prevent tool conflicts across connected services.

Category
访问服务器

README

Multi MCP

A flexible and dynamic Multi-MCP Proxy Server that acts as a single MCP server while connecting to and routing between multiple backend MCP servers over STDIO or SSE.

<p align="center"> <img src="assets/multi-mcp-diagram.png" alt="Multi-MCP Server Architecture" width="300"/> </p>

🚀 Features

  • ✅ Supports both STDIO and SSE transports
  • ✅ Can connect to MCP servers running in either STDIO or SSE mode
  • ✅ Proxies requests to multiple MCP servers
  • ✅ Automatically initializes capabilities (tools, prompts, resources) from connected servers
  • ✅ Dynamically add/remove MCP servers at runtime (via HTTP API)
  • ✅ Supports tools with the same name on different servers (using namespacing)
  • ✅ Deployable on Kubernetes, exposing a single port to access all connected MCP servers through the proxy

📦 Installation

To get started with this project locally:

# Clone the repository
git clone https://github.com/kfirtoledo/multi-mcp.git
cd multi-mcp

# Install using uv (recommended)
uv venv
uv pip install -r requirements.txt

🖥️ Running Locally

You can run the proxy locally in either STDIO or SSE mode depending on your needs:

1. STDIO Mode

For CLI-style operation (pipe-based communication). Used for chaining locally executed tools or agents.

uv run main.py --transport stdio

2. SSE Mode

Runs an HTTP SSE server that exposes a /sse endpoint. Useful for remote access, browser agents, and network-based tools.

uv run main.py --transport sse

Note: You can also configure the host and port using --host / --port arguments.

3. Production Mode (with External MCP Servers)

For production deployments with external MCP servers (GitHub, Brave Search, Context7), use the included startup script:

# Set required environment variables
export GITHUB_PERSONAL_ACCESS_TOKEN="your-token-here"
export BRAVE_API_KEY="your-api-key-here"
export MULTI_MCP_API_KEY="your-secret-key"  # Optional, for authentication

# Run the startup script
./start-server.sh

The production configuration is stored in msc/mcp.json (git-ignored for security). This configuration includes:

  • GitHub MCP Server: Repository management, issues, pull requests
  • Brave Search MCP Server: Web search capabilities
  • Context7 MCP Server: Library documentation and code examples

All servers use environment variable interpolation for secrets (e.g., ${GITHUB_PERSONAL_ACCESS_TOKEN}).

⚙️ Configuration

The proxy is initialized using a JSON config (default: ./mcp.json):

{
  "mcpServers": {
    "weather": {
      "command": "python",
      "args": ["./tools/get_weather.py"]
    },
    "calculator": {
      "command": "python",
      "args": ["./tools/calculator.py"]
    }
  }
}

This config defines the initial list of MCP-compatible servers to spawn and connect at startup.

Note: Tool names are namespaced internally as server_name::tool_name to avoid conflicts and allow multiple servers to expose tools with the same base name. For example, if an MCP server named calculator provides an add tool, it will be referenced as calculator::add.

You can also connect to a remote MCP server using SSE:

{
  "mcpServers": {
    "weather": {
      "url": "http://127.0.0.1:9080/sse"
    }
  }
}

More examples can be found in the examples/config/ directory.

🔄 Dynamic Server Management (SSE only)

When running in SSE mode, you can add/remove/list MCP servers at runtime via HTTP endpoints:

Method Endpoint Description
GET /mcp_servers List active MCP servers
POST /mcp_servers Add a new MCP server
DELETE /mcp_servers/{name} Remove an MCP server by name
GET /mcp_tools Lists all available tools and their serves sources

Example to add a new server:

curl -X POST http://localhost:8080/mcp_servers \
  -H "Content-Type: application/json" \
  --data @add_server.json

add_server.json:

{
  "mcpServers": {
    "unit_converter": {
      "command": "python",
      "args": ["./tools/unit_converter.py"]
    }
  }
}

🐳 Docker

You can containerize and run the SSE server in K8s:

# Build the image
make docker-build

# Run locally with port exposure
make docker-run

Kubernetes

You can deploy the proxy in a Kubernetes cluster using the provided manifests.

Run with Kind

To run the proxy locally using Kind:

kind create cluster --name multi-mcp-test
kind load docker-image multi-mcp --name multi-mcp-test
kubectl apply -f k8s/multi-mcp.yaml

Exposing the Proxy

The K8s manifest exposes the SSE server via a NodePort (30080 by default): You can then connect to the SSE endpoint from outside the cluster:

http://<kind-node-ip>:30080/sse

Connecting to MCP Clients

Once the proxy is running, you can connect to it using any MCP-compatible client — such as a LangGraph agent or custom MCP client.

For example, using the langchain_mcp_adapters client, you can integrate directly with LangGraph to access tools from one or more backend MCP servers.

See examples/connect_langgraph_client.py for a working integration example.

Make sure your environment is set up with:

  • An MCP-compatible client (e.g. LangGraph)

  • .env file containing:

MODEL_NAME=<your-model-name>
BASE_URL=<https://your-openai-base-url>
OPENAI_API_KEY=<your-api-key>

Inspiration

This project is inspired by and builds on ideas from two excellent open-source MCP projects:

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选