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.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.