Prepare the server locally
Run this once before adding it to Claude Code.
git clone https://github.com/MikkoParkkola/mcp-gateway
cd mcp-gatewayThen follow the repository README for any remaining dependency or build steps.
Register it in Claude Code
claude mcp add mcp-gateway-37e8 -- mcp-gateway --config /path/to/gateway.yamlReplace any placeholder paths in the command with the real path on your machine.
Make your agent remember this setup
mcp-gateway-37e8's config, env vars, and the gotchas you hit — recalled in every future Claude Code, Cursor, and Codex session.
npx conare@latestFree · one command · indexes the sessions already on disk. Set up in the browser instead →
What it does
- Aggregates multiple MCP servers into a single port
- Reduces context token usage by up to 97% via Meta-MCP discovery
- Supports stdio, HTTP, and SSE transport protocols
- Enables dynamic tool discovery and on-demand invocation
- Provides circuit breakers and retry logic for backend reliability
Tools 1
meta_toolsA set of 4 meta-tools that allow the AI to discover and invoke tools on demand from connected backends.Try it
Original README from MikkoParkkola/mcp-gateway
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-gateway
Cargo:
cargo install mcp-gateway
Binary 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-gateway
Docker:
docker run -v $(pwd)/gateway.yaml:/config.yaml \
ghcr.io/mikkoparkkola/mcp-gateway:latest \
--config /config.yaml
Configure
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: