MCP Gateway MCP Server

Give your AI access to every tool it needs without burning your context window.

README.md

MCP Gateway

Give your AI access to every tool it needs -- without burning your context window or building MCP servers.

demo

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:

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

List all available tools across my connected MCP backends.
Search for the latest documentation using the tavily backend connected through the gateway.
Execute the tool from the filesystem backend to read the contents of my project configuration.
Find and run the appropriate tool to fetch current weather data from my configured REST API.

Frequently Asked Questions

What are the key features of MCP Gateway?

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.

What can I use MCP Gateway for?

Connecting dozens of MCP tools without exceeding AI context window limits. Integrating REST APIs as MCP tools by dropping a YAML file or OpenAPI spec. Managing multiple MCP server backends without needing to restart the AI session. Isolating failing tools using built-in circuit breakers to prevent cascading failures.

How do I install MCP Gateway?

Install MCP Gateway by running: brew tap MikkoParkkola/tap && brew install mcp-gateway

What MCP clients work with MCP Gateway?

MCP Gateway works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep MCP Gateway docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Open Conare