Provides optional Prometheus metrics support for monitoring the gateway's performance, health status, and backend operations.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Gatewaylist all the connected servers and their tools"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Gateway
Give your AI access to every tool it needs -- without burning your context window or building MCP servers.

MCP Gateway sits between your AI client and your tools. Instead of loading hundreds of tool definitions into every request, the AI gets 4 meta-tools and discovers the right one on demand -- like searching an app store instead of installing every app.
Why
The context window is the bottleneck. Every MCP tool you connect costs ~150 tokens of context overhead. Connect 20 servers with 100+ tools and you've burned 15,000 tokens before the conversation starts -- on tool definitions the AI probably won't use this turn.
Worse: context limits force you to choose which tools to connect. You leave tools out because they don't fit -- and your AI makes worse decisions because it can't reach the right data.
MCP Gateway removes that tradeoff entirely.
Without Gateway | With Gateway | |
Tools in context | Every definition, every request | 4 meta-tools (~400 tokens) |
Token overhead | ~15,000 tokens (100 tools) | ~400 tokens -- 97% savings |
Cost at scale | ~$0.22/request (Opus input) | ~$0.006/request -- $219 saved per 1K |
Practical tool limit | 20-50 tools (context pressure) | Unlimited -- discovered on demand |
Connect a new REST API | Build an MCP server (days) | Drop a YAML file or import an OpenAPI spec (minutes) |
Changing MCP config | Restart AI session, lose context | Restart gateway (~8ms), session stays alive |
When one tool breaks | Cascading failures | Circuit breakers isolate it |
Why not...
Alternative | What it does | Why MCP Gateway is different |
Direct MCP connections | Each server connected individually | Every tool definition loaded every request. 100 tools = 15K tokens burned. Gateway: 4 tools, always. |
Claude's ToolSearch | Built-in deferred tool loading | Only works with tools already configured. Gateway adds unlimited backends + REST APIs without MCP servers. |
Archestra | Cloud-hosted MCP registry | Requires cloud account, sends data to third party. Gateway is local-only, zero external dependencies. |
Kong / Portkey | General API gateways | Not MCP-aware. No meta-tool discovery, no tool search, no capability YAML system. |
Building fewer MCP servers | Reduce tool count manually | You lose capabilities. Gateway lets you keep everything and pay the token cost of 4. |
Quick Start
Install
Homebrew (macOS/Linux):
brew tap MikkoParkkola/tap && brew install mcp-gatewayCargo:
cargo install mcp-gatewayBinary download:
# macOS ARM64 (M1/M2/M3/M4)
curl -L https://github.com/MikkoParkkola/mcp-gateway/releases/latest/download/mcp-gateway-darwin-arm64 -o mcp-gateway
# macOS Intel
curl -L https://github.com/MikkoParkkola/mcp-gateway/releases/latest/download/mcp-gateway-darwin-x86_64 -o mcp-gateway
# Linux x86_64
curl -L https://github.com/MikkoParkkola/mcp-gateway/releases/latest/download/mcp-gateway-linux-x86_64 -o mcp-gateway
chmod +x mcp-gatewayDocker:
docker run -v $(pwd)/gateway.yaml:/config.yaml \
ghcr.io/mikkoparkkola/mcp-gateway:latest \
--config /config.yamlConfigure
Create gateway.yaml:
server:
port: 39400
meta_mcp:
enabled: true
failsafe:
circuit_breaker:
enabled: true
failure_threshold: 5
retry:
enabled: true
max_attempts: 3
backends:
tavily:
command: "npx -y @anthropic/mcp-server-tavily"
description: "Web search"
env:
TAVILY_API_KEY: "${TAVILY_API_KEY}"
context7:
http_url: "http://localhost:8080/mcp"
description: "Documentation lookup"Run
mcp-gateway --config gateway.yamlConnect your AI client
Point your MCP client (Claude Code, Cursor, Windsurf, etc.) at the gateway:
{
"mcpServers": {
"gateway": {
"type": "http",
"url": "http://localhost:39400/mcp"
}
}
}That's it. Your AI now has access to all backends through 4 meta-tools. It searches for tools with gateway_search_tools and invokes them with gateway_invoke.
Key Benefits
1. Unlimited Tools, Minimal Tokens
The gateway exposes 4 meta-tools. Your AI searches for what it needs, then invokes it. Tool definitions load on demand, not upfront. Connect 500 tools and pay the token cost of 4.
Token math (Claude Opus @ $15/M input tokens):
Without: 100 tools x 150 tokens x 1,000 requests = 15M tokens = $225
With: 4 meta-tools x 100 tokens x 1,000 requests = 0.4M tokens = $6
2. Any REST API to MCP Tool -- No Code
Turn any REST API into a tool by dropping a YAML file (~30 seconds) or importing an OpenAPI spec:
mcp-gateway cap import stripe-openapi.yaml --output capabilities/ --prefix stripeThe gateway ships with 70+ starter capabilities -- weather, Wikipedia, GitHub, stock quotes, package tracking, and more. Hot-reloaded in ~500ms, no restart needed.
3. Change Your MCP Stack Without Losing Your AI Session
Your AI connects once to localhost:39400. Behind it, REST API capabilities hot-reload automatically. MCP backends require a gateway restart -- but it starts in ~8ms. Your AI session stays connected.
4. Production Resilience
Circuit breakers, retry with backoff, rate limiting, health checks, graceful shutdown, and concurrency limits. One flaky server won't take down your toolchain.
Architecture
┌───────────────────────────────────────────────────────────────┐
│ MCP Gateway (:39400) │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Meta-MCP: 4 Meta-Tools + Surfaced Tools │ │
│ │ • gateway_list_servers • gateway_search_tools │ │
│ │ • gateway_list_tools • gateway_invoke │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Failsafes: Circuit Breaker │ Retry │ Rate Limit │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │ │
│ ┌──────────────────┼──────────────────┐ │
│ ▼ ▼ ▼ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Tavily │ │ Context7 │ │ Pieces │ │
│ │ (stdio) │ │ (http) │ │ (sse) │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
└───────────────────────────────────────────────────────────────┘Features
Web Dashboard
Embedded web UI at /ui -- live status, searchable tools, server health, config viewer. Operator dashboard at /dashboard. Cost tracking at /ui#costs. All served from the same binary and port, no frontend build step.
Security & Governance
Feature | Description | Docs |
Authentication | Bearer tokens, API keys, per-client rate limits | |
Per-Client Tool Scopes | Allowlist/denylist tools per API key with glob patterns | |
Security Firewall | Credential redaction, prompt injection detection, shell/SQL/path traversal scanning | |
Cost Governance | Per-tool, per-key, daily budgets with alert thresholds (log/notify/block) | |
Session Sandboxing | Per-session call limits, duration caps, backend restrictions | |
mTLS | Certificate-based auth for tool execution |
Integration & Discovery
Feature | Description |
Capability System | REST API to MCP tool via YAML. Hot-reloaded. 70+ built-in. OpenAPI import supported. |
Transform Chains | Namespace, filter, rename, and response transforms. Example. |
Webhooks | GitHub/Linear/Stripe push events as MCP notifications. Docs. |
Auto-Discovery | Discover MCP servers from existing client configs and running processes. |
Surfaced Tools | Pin high-value tools directly in |
Semantic Search | TF-IDF ranked search across all tool names and descriptions. |
Tool Profiles | Usage analytics per tool: latency, errors, trends. Persisted to disk. |
Config Export | Export sanitized config as YAML/JSON. |
Protocol & Transport
MCP Version: 2025-11-25 (latest spec)
Transports: stdio, Streamable HTTP, SSE, WebSocket
Hot Reload: Config and capability files watched and reloaded live
Config Discovery: Auto-finds
gateway.yamlin cwd,~/.config/mcp-gateway/,/etc/mcp-gateway/"Did You Mean?": Levenshtein-based typo correction on tool names
Tool Annotations: MCP 2025-11-25
readOnlyHint,destructiveHint,openWorldHintDynamic Descriptions: Live tool/server counts in meta-tool descriptions
Tunnel Mode: Expose via Tailscale or pipenet without opening ports
Shell Completions:
mcp-gateway completions bash|zsh|fishSpec Preview (opt-in): Filtered
tools/list(SEP-1821),tools/resolve(SEP-1862), dynamic promotion
Supported Backends
Any MCP-compliant server works. All three transport types supported:
Transport | Examples |
stdio |
|
HTTP | Any Streamable HTTP server |
SSE | Pieces, LangChain, etc. |
API
Endpoint | Method | Description |
| GET | Health check with backend status |
| POST | Meta-MCP mode (dynamic discovery) |
| POST | Direct backend access |
| GET | Web dashboard |
| GET | Operator dashboard |
| GET | Prometheus metrics (with |
Performance
Metric | Value | Notes |
Startup time | ~8ms | Measured with |
Binary size | ~12 MB | Release build with LTO, stripped |
Gateway overhead | <2ms per request | Local routing + JSON-RPC parsing |
Memory | Low | Async I/O via tokio; no per-request allocations for routing |
Documentation
Document | Contents |
Zero to running in 2 minutes | |
All config options | |
Docker, systemd, TLS/mTLS, scaling | |
Generate capabilities from OpenAPI specs | |
Event integration setup | |
Share and install capabilities | |
Performance measurements | |
Release history |
Troubleshooting
Backend won't connect? Test the command directly (npx -y @anthropic/mcp-server-tavily), then check gateway logs with --log-level debug.
Circuit breaker open? Check curl localhost:39400/health | jq '.backends'. Adjust thresholds in failsafe.circuit_breaker.
Tools not appearing? Verify the backend is running (gateway_list_servers). Tool lists are cached for 5 minutes.
Contributing
Fork and branch (
git checkout -b feature/your-feature)Test (
cargo test) and lint (cargo fmt && cargo clippy -- -D warnings)PR against
mainwith a clear description and CHANGELOG entry
See CONTRIBUTING.md for full details. Look for good first issue or help wanted to get started.
License
MIT License -- see LICENSE for details.
Credits
Created by Mikko Parkkola. Implements Model Context Protocol version 2025-11-25.