MCP Multi-Server Gateway

MCP Multi-Server Gateway

Aggregate, route, and orchestrate multiple MCP backend servers behind a single MCP endpoint.

Category
Visit Server

README

🌐 MCP Multi-Server Gateway

Aggregate, route, and orchestrate multiple MCP backend servers behind a single MCP endpoint. Connect one gateway to Claude Desktop/Cursor and access all your MCP servers β€” weather, database, file system, and more.

License: MIT Python 3.10+


✨ Why a Gateway?

Instead of configuring each MCP server individually in your client:

// ❌ Without Gateway: 3 entries in claude_desktop_config.json
{
  "weather": { "command": "...", "args": ["weather_server.py"] },
  "sqlite": { "command": "...", "args": ["sqlite_server.py", "--db-path", "..."] },
  "filesystem": { "command": "...", "args": ["filesystem_server.py", "--sandbox", "..."] }
}

// βœ… With Gateway: 1 entry β€” register/unregister servers at runtime
{
  "gateway": { "command": "python", "args": ["gateway.py"] }
}

✨ Features

  • πŸ”§ 5 Tools: register_server, remove_server, list_servers, call_backend, route_pipeline
  • ⏱️ Async Routing: Concurrent tool execution across backends via asyncio
  • πŸ“‹ Pipeline Support: Pre-configured multi-step workflows (weather-analysis, database-report)
  • πŸ“ Auto-Registration: Load backend config from JSON file on startup
  • πŸ”Œ Runtime Dynamic: Register/unregister servers without restarting
  • ⏲️ Timeout Handling: 10-second per-backend timeout prevents hangs
  • πŸ–₯️ Dual Transport: stdio and Streamable HTTP

πŸš€ Quick Start

# 1. Setup
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

# 2. Start the gateway
python gateway.py

# 3. Register backend servers (from MCP client)
register_server(name="weather", command="python", args="weather_server.py", description="Weather alerts")
register_server(name="sqlite", command="python", args="sqlite_server.py --db-path /tmp/sample.db", description="Database queries")

With auto-registration:

python gateway.py --auto-register gateway-config.json

πŸ› οΈ Tools Reference

register_server(name, command, args, description) -> str

Register a new backend MCP server at runtime.

remove_server(name) -> str

Remove a registered server.

list_servers() -> str

List all registered backends with status and tool counts.

call_backend(server, tool, params) -> str

Execute a tool on a specific backend. params is a JSON string.

route_pipeline(scenario) -> str

Execute a pre-configured multi-step pipeline:

  • "weather-analysis" β€” alerts + forecast
  • "database-report" β€” schema inspection + query
  • "custom" β€” compose your own workflow

πŸ”Œ Connecting to Clients

Claude Desktop

{
  "mcpServers": {
    "gateway": {
      "command": "python",
      "args": ["/ABSOLUTE/PATH/mcp-multi-server-gateway/gateway.py"]
    }
  }
}

Streamable HTTP Mode

python gateway.py --transport streamable-http --port 8003

πŸ“ Project Structure

mcp-multi-server-gateway/
β”œβ”€β”€ gateway.py              # Main gateway server (FastMCP + asyncio)
β”œβ”€β”€ gateway-config.json     # Example auto-registration config
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ setup.sh
β”œβ”€β”€ README.md
└── .gitignore

πŸ—οΈ Architecture

         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚       MCP Client (Claude, etc)       β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                        β”‚  single MCP connection
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚     MCP Multi-Server Gateway         β”‚
         β”‚     (gateway.py on :8003)            β”‚
         β”‚                                      β”‚
         β”‚  register / call_backend / pipeline  β”‚
         β””β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚          β”‚          β”‚
     β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β” β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β” β”Œβ”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
     β”‚ Weather  β”‚ β”‚  SQLite  β”‚ β”‚ FileSystemβ”‚
     β”‚ Server   β”‚ β”‚  Server  β”‚ β”‚  Server   β”‚
     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ’‘ Use Cases

Scenario Tools Involved Example
DevOps Debugging sqlite.query + filesystem.read_file "Check DB schema, then read config file"
Data Analysis sqlite.list_tables + sqlite.query "What tables exist? Give me top 10 customers"
Multi-weather check weather.get_alerts Γ— 2 "Alerts for CA and TX simultaneously"
Automated report All servers in sequence "Get weather data β†’ query DB β†’ write report"

πŸ“œ License

MIT

Recommended Servers

playwright-mcp

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Exa Search

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.

Official
Featured