mcp-gateway
A local MCP gateway that aggregates multiple downstream MCP servers behind a single connection, with hot-reload via HTTP admin API or file-watcher and support for large payloads.
README
MCP Gateway
A local MCP gateway that aggregates multiple downstream MCP servers behind a single connection.
- One config file (
mcp-servers.json) controls every downstream server. - Hot-reload via HTTP admin API or file-watcher — no need to restart Claude.
- Runs on localhost with a rare port (default
51337) for admin. - Supports large request/response payloads (
100mbJSON limit, stdio streams unbounded).
How it works
Claude (host)
│ stdio
▼
┌──────────────┐ ┌─────────────┐
│ MCP Gateway │◄────────►│ filesystem │
│ (this app) │ stdio └─────────────┘
│ │ ┌─────────────┐
│ • 1 config │◄────────►│ brave │
│ • hot reload│ HTTP └─────────────┘
│ • aggregate │ ┌─────────────┐
└──────────────┘◄────────►│ sqlite │
localhost:51337 └─────────────┘
(admin API)
You add Claude once as an MCP server in Claude Desktop / Claude Code.
After that, every other MCP server lives in mcp-servers.json.
Edit the JSON, hit reload, and the new tools appear — Claude keeps running.
Quick start
1. Install dependencies
cd mcp-gateway
npm install
npm run build
2. Register the gateway with Claude
Claude Desktop
Edit %APPDATA%\Claude\claude_desktop_config.json (Windows) or the macOS/Linux equivalent:
{
"mcpServers": {
"gateway": {
"command": "node",
"args": ["D:/coding/temp/mcp-gateway/dist/index.js"]
}
}
}
Claude Code CLI
claude mcp add gateway -s user -- node D:/coding/temp/mcp-gateway/dist/index.js
3. Add downstream servers
Edit mcp-servers.json:
{
"servers": {
"fs": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
},
"fetch": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-fetch"]
},
"remote-api": {
"url": "http://localhost:3001/sse"
}
}
}
4. Reload
The gateway auto-reloads when the file changes (500 ms debounce).
Or hit the admin API manually:
curl -X POST http://localhost:51337/reload
5. Check status
curl http://localhost:51337/status
Config file format (mcp-servers.json)
{
"servers": {
"my-server-name": {
"command": "npx",
"args": ["-y", "some-mcp-package"],
"env": { "API_KEY": "secret" }
},
"another-server": {
"url": "http://localhost:8080/sse",
"headers": { "Authorization": "Bearer token" }
}
}
}
| Field | Required | Description |
|---|---|---|
command |
* | Executable to spawn (stdio transport) |
args |
Arguments array | |
env |
Extra env vars (merges with process.env) |
|
url |
* | HTTP/SSE endpoint (alternative to command) |
headers |
Extra HTTP headers |
Either command or url is required.
Tool / resource / prompt namespacing
To avoid collisions, every downstream item is prefixed:
| Downstream | Gateway exposes |
|---|---|
fs:list_files |
fs__list_files |
fetch:fetch |
fetch__fetch |
file:///tmp |
fs://file:///tmp |
Claude sees the prefixed names and routes are handled automatically.
Admin API
| Method | Path | Body | Description |
|---|---|---|---|
GET |
/status |
— | List connected servers |
POST |
/reload |
{ "configPath": "…" } |
Reload from disk file |
POST |
/reload-from-body |
Full config JSON | Reload from inline JSON |
Default port: 51337.
Override with env var: ADMIN_PORT=61442 node dist/index.js
Environment variables
| Variable | Default | Description |
|---|---|---|
CONFIG_PATH |
./mcp-servers.json |
Path to config file |
ADMIN_PORT |
51337 |
Admin HTTP port |
Large payloads
- Admin API accepts up to
100 mbJSON bodies (express.json({ limit: "100mb" })). - Stdio streams have no artificial buffer cap — messages are framed with
Content-Lengthand parsed as complete JSON-RPC objects. - If a downstream server crashes on a huge payload, the error is caught and returned to Claude as an MCP error.
For Claude (the assistant)
You can add or remove MCP servers for the user by:
- Editing
mcp-servers.jsonwith the Write/Edit tool. - Triggering reload with the Bash tool:
curl -X POST http://localhost:51337/reload - Or simply wait 500 ms — the file watcher auto-reloads.
You never need to ask the user to restart Claude.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。