mcp-gway
MCP Gateway
Ein eigenständiges CLI-Gateway, das mehrere MCP-Server (Model Context Protocol) hinter einem einzigen HTTP/SSE-Endpunkt mit Code Mode bündelt – wodurch der LLM-Eingabe-Tokenverbrauch bei Verwendung mehrerer MCP-Server um bis zu 92 % reduziert wird.
Features
Multi-Server Aggregation — Verbinden Sie sich mit mehreren MCP-Servern (HTTP, SSE, Stdio, Streamable HTTP) und stellen Sie sie über einen einzigen Endpunkt bereit
Code Mode — 4 Meta-Tools, die es LLMs ermöglichen, Tools dynamisch zu entdecken und zu verwenden, ohne alle Schemas im Voraus zu laden
OAuth 2.0 Support — Integrierter OAuth-Ablauf mit dynamischer Client-Registrierung (RFC 7591) und Token-Speicherung
Hermetic Sandbox — Starlark-basierte Sandbox für sichere Code-Ausführung
MCP Protocol Compliant — Funktioniert mit Claude Desktop, Cursor und jedem MCP-kompatiblen Client
Related MCP server: ToolMux
Installation
pip install mcp-gwayOder mit mise:
mise install
uv syncSchnellstart
# Add an MCP server
mcp-gway add youtube --type http --url http://localhost:3001/mcp
# Add a stdio server
mcp-gway add filesystem --type stdio --command npx --args '["-y", "@anthropic/mcp-filesystem"]'
# Add a server requiring OAuth
mcp-gway add supabase --type streamable-http --url https://mcp.supabase.com/mcp
# List all servers
mcp-gway list
# Start the gateway
mcp-gway serve --port 8080Verbinden von Claude Desktop
Fügen Sie zu Ihrer Claude-Desktop-Konfiguration hinzu (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"gateway": {
"url": "http://localhost:8080/mcp"
}
}
}Befehle
Befehl | Beschreibung |
| Einen MCP-Server hinzufügen und |
| Einen MCP-Server entfernen |
| Tools für einen Server aktualisieren |
| Alle verbundenen Server auflisten |
| Tool-Signaturen für einen Server anzeigen |
| Verbindung aktualisieren und Tools neu entdecken |
| Gateway-Server starten |
Code Mode
Wenn verbunden, stellt das Gateway 4 Meta-Tools bereit:
Tool | Beschreibung |
| Alle verfügbaren |
| Funktionssignaturen aus einem Stub lesen |
| Detaillierte Dokumentation für ein Tool abrufen |
| Code in einem Sandbox-Starlark-Interpreter ausführen |
OAuth-Authentifizierung
Für Server, die OAuth erfordern (z. B. Supabase):
# Trigger OAuth flow
mcp-gway refresh supabase --auth
# Or store token manually
mkdir -p ~/.config/mcp-gway/tokens
echo '{"access_token": "YOUR_TOKEN"}' > ~/.config/mcp-gway/tokens/supabase.jsonEntwicklung
# Install dependencies
mise install
uv sync
# Run tests
uv run pytest -v
# Lint and format
uv run ruff check src/ tests/
uv run ruff format src/ tests/Architektur
┌─────────────────────────────────────────────────────────┐
│ MCP Gateway │
├─────────────────────────────────────────────────────────┤
│ CLI (click) │ HTTP/SSE Server (Starlette) │
│ - add │ - POST /mcp (JSON-RPC) │
│ - remove │ - GET /mcp (SSE stream) │
│ - list │ - POST /mcp/messages │
│ - refresh │ │
├─────────────────────────────────────────────────────────┤
│ Code Mode (4 meta-tools) │ Starlark Sandbox │
│ - listToolFiles │ - Hermetic execution │
│ - readToolFile │ - Server injection │
│ - getToolDocs │ │
│ - executeToolCode │ │
├─────────────────────────────────────────────────────────┤
│ Registry (.pyi files) │ OAuth2 (RFC 7591) │
│ - servers/*.pyi │ - Dynamic registration│
│ - Tool signatures │ - Token storage │
└─────────────────────────────────────────────────────────┘
│ │ │
┌────┴────┐ ┌────┴────┐ ┌────┴────┐
│ Server1 │ │ Server2 │ │ Server3 │
│ (HTTP) │ │ (SSE) │ │ (Stdio) │
└─────────┘ └─────────┘ └─────────┘Lizenz
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
Self-hosted federated MCP gateway: one OAuth 2.1 MCP server in front of N apps, user-level scopes.
Governed MCP gateway: one endpoint for your tools, with credential custody and audit log.
Hosted MCP server with managed OAuth for 15+ toolkits: Google Workspace, Fitbit, Oura, Kalshi, etc.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAggregates multiple MCP servers into a single endpoint, enabling LLM clients to access tools, resources, and prompts from various backends through one connection.9 npmMIT
- AlicenseBqualityCmaintenanceAggregates multiple MCP servers via a single interface with token optimization and multiple operating modes (Gateway, Meta, Proxy, Search, Code).78MIT
- AlicenseNot gradedqualityAmaintenanceCentralizes management and routing of multiple MCP servers, exposing them to AI clients via HTTP/SSE endpoints with configurable visibility, sharing, and smart routing.1,706 npmApache 2.0
- AlicenseNot gradedqualityBmaintenanceCentralized management and routing of multiple MCP servers via unified Streamable HTTP/SSE endpoints, with granular group visibility, smart routing, and authentication.1,706 npmApache 2.0