MCP-Gateway MCP Gateway, a new tool and capability gateway, allows AI clients to access unlimited backend tools without loading every tool definition into the context window, reducing token overhead by up to 89%. The system replaces hundreds of tool definitions with a compact 14-17 tool Meta-MCP surface, discovering the correct backend tool on demand, and supports REST APIs via YAML files or OpenAPI specs instead of requiring dedicated MCP servers. The gateway eliminates the tradeoff between tool quantity and context limits, with benchmarks showing a cost reduction from $0.22 to $0.024 per request at scale. Give your AI access to every tool it needs -- without burning your context window or building MCP servers. Five MCP hot-reload tools compared https://ruachtov.ai/blog/five-tools-mcp-restart.html -- Ruach Tov Collective's BPD-based comparison of mcp-gateway against four restart-focused alternatives. Includes a feature matrix and architectural analysis. mcp-gateway deep dive https://ruachtov.ai/blog/mcp-gateway-deep-dive.html -- Detailed walkthrough of the capability system, SHA-256 integrity pinning, and the v2.5-to-v2.9 development arc. MCP Gateway sits between your AI client and your tools. Instead of loading hundreds of tool definitions into every request, the AI gets a compact Meta-MCP surface -- 14 tools minimum, 16 in the README benchmark scenario, 17 when webhook status is surfaced -- and discovers the right backend tool on demand. Public quantitative claims in this README are sourced from docs/BENCHMARKS.md /MikkoParkkola/mcp-gateway/blob/main/docs/BENCHMARKS.md and the machine-readable benchmarks/public claims.json /MikkoParkkola/mcp-gateway/blob/main/benchmarks/public claims.json , with CI checks to catch drift. MCP Gateway is a tool and capability gateway . It routes MCP tool/resource/prompt traffic to backend MCP servers and capability-backed REST APIs, and it can proxy MCP server-to-client requests like sampling/createMessage , elicitation/create , and roots/list back to the connected client over the existing gateway session. MCP Gateway is not a general OpenAI/Anthropic chat completions or embeddings gateway. When a backend asks for sampling/createMessage , the connected client still performs the model call. The OpenAI-compatible prompt-cache helpers in the gateway exist only so gateway invoke can preserve prompt cache key behavior for backends or capabilities that happen to call LLM APIs internally. 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 | 16 Meta-MCP tools in the README benchmark ~1600 tokens | Token overhead | ~15,000 tokens 100 tools | ~1600 tokens -- 89% savings | Cost at scale | ~$0.22/request Opus input | ~$0.024/request -- $201 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 | The base discovery quartet gateway list servers , gateway list tools , gateway search tools , gateway invoke stays constant. The README benchmark scenario also surfaces stats, cost report, playbooks, profile controls, disabled-capability visibility, and reload for a 15-tool surface. Surfacing webhook status adds the 16th tool. | 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: a small fixed 13-16 tool surface instead of every backend tool. | 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 the compact Meta-MCP surface. | On 2026-05-19 Anthropic shipped Claude Managed Agents https://claude.com/blog/claude-managed-agents-updates with self-hosted sandboxes public beta and MCP tunnels https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/overview research preview . MCP tunnels let a Claude agent reach a single MCP server inside a private network through one outbound connection from a lightweight gateway -- no inbound firewall rules, no public endpoint, encrypted end-to-end. mcp-gateway and Anthropic's MCP tunnel sit at different layers and compose . The tunnel is reachability plumbing for one private MCP server. mcp-gateway is the aggregation, routing, capability-namespacing and observability layer across many MCP and REST backends. When both are deployed, mcp-gateway becomes the private MCP server that Anthropic's tunnel exposes -- one tunnel, one outbound connection, every backend behind it. | Concern | Anthropic MCP tunnel | mcp-gateway | Boundary | |---|---|---|---| Backend topology | Single MCP server per tunnel, exposed through one outbound connection | src/gateway/ , capabilities/ .yaml Tool routing gateway search tools / gateway invoke discovery src/gateway/ ; SHA-256 pinning per capability src/capability/hash.rs Observability trace id and cost-accounting across every backend invocation src/cost accounting/ , src/gateway/ Complementary, not a replacement. A team that wants Claude Managed Agents to reach a private-network deployment of mcp-gateway uses the tunnel for reachability and mcp-gateway for fan-out, capability hygiene, OWASP Agentic AI controls docs/OWASP AGENTIC AI COMPLIANCE.md /MikkoParkkola/mcp-gateway/blob/main/docs/OWASP AGENTIC AI COMPLIANCE.md , and unified cost / trace telemetry. The two solve adjacent problems. Connecting N MCP servers to an agent means accepting N attack surfaces. Tool poisoning, rug pulls, and exfiltration via hidden instructions in tool descriptions are demonstrated attacks, not hypotheticals. Invariant Labs' writeup MCP Security Notification: Tool Poisoning Attacks https://invariantlabs.ai/blog/mcp-security-notification-tool-poisoning-attacks and Simon Willison's summary MCP has prompt injection security problems https://simonwillison.net/2025/Apr/9/mcp-prompt-injection/ lay out the threat model. mcp-gateway puts every backend tool description behind one audit surface and defends it structurally: Tool-poisoning validator AX-010 . Every backend tool description is scanned before it reaches the agent's context window. HIGH patterns fail-closed: