What is an MCP gateway?
An MCP gateway is a server that sits between your agents and many MCP servers. Agents connect to one address and one sign-in; the gateway forwards each call to the right server behind it, adds its own credentials, and can log, filter or rate-limit on the way. The MCP spec covers this role under the name MCP proxy server.
Part of Glossary: the terms behind MCP, coding agents and shared pages, defined plainly.
Your agent's MCP client connects to the gateway's one URL and signs in once. It sees a merged tool list, usually with each server's name as a prefix.
Tool names are only unique within one server. The spec says anything that aggregates servers should disambiguate, for example by prefixing.
When the model calls a tool, the gateway reads the name, picks the server behind it, and forwards the JSON-RPC request.
Over Streamable HTTP the method and tool name are mirrored into Mcp-Method and Mcp-Name headers so a gateway can route without parsing the body.
The gateway holds the credential for each upstream server itself. The spec forbids forwarding a token that was issued to a different service.
Replies and streamed notifications come back along the same path. A gateway in front of an SSE stream must pass events through without buffering them.
Because every call passes one point, that point can log calls, allow-list tools, rate-limit, and cut a whole team's access at once.
Gateway versus proxy versus direct connection
Connecting directly is the default: each agent holds its own entry for each MCP server, with its own sign-in. That is fine for one person and three servers. It stops being fine when thirty people each configure twelve servers, every laptop holds twelve tokens, and nobody can say which tools the team's agents can reach.
A proxy fixes a narrower problem. It stands in front of one server to change something about it: give a stdio-only server an HTTP address, add OAuth to a server that has none, or move a server off a laptop and onto a shared machine. One hop, one upstream.
A gateway fronts many servers and presents them as one. To your agent it is a single MCP server with a long tool list. To each server behind it, it is a single client. In the middle it owns the policy: which servers are on, which tools each person may call, what gets logged, how fast anyone may call.
Example: one address for a team
A platform team runs a gateway at one HTTPS address and points it at a ticket tracker's MCP server, a documentation server and a read-only database server. Each teammate adds that one address to Claude Code, Cursor or Codex and signs in with the company identity provider. Their agents see tools named something like tickets_search and docs_read; the prefix tells the gateway where to send each call.
When the database server rotates its credential, the gateway is updated once. When someone leaves, their access to all three servers ends in one place. When an agent calls a tool that is on the deny list, the gateway answers with an error and the server never hears about it.
When to use a gateway
Use one when the number of people times the number of servers is the thing hurting you, or when you need a record of every tool call for an audit. Skip it when you are one person with a handful of servers; the extra hop adds latency, another thing to run, and a single place whose outage takes every tool down.
There is also a model cost. A gateway that merges ten servers hands the model hundreds of tool definitions, and every one of them takes room in the context window on every turn. A good gateway lets you turn servers and tools off per team rather than exposing everything to everyone.
Common mistakes
- Passing the caller's token upstream. The spec is blunt: an MCP server must not accept tokens that were not issued for it, and must not forward them. The gateway signs in to each upstream service itself.
- Skipping per-client consent. When a gateway signs in to a third-party API as one fixed client on behalf of many people, it has to show its own approval screen first. Without it, the confused deputy attack lets a stolen consent cookie approve a stranger's client.
- Buffering the stream. Reverse proxies often hold a response until it ends. For an SSE reply that means progress notifications arrive all at once, late. The spec asks servers to send
X-Accel-Buffering: no; your gateway must honour it. - Routing on a header the server does not check. The mirrored
Mcp-Nameheader exists for routing, but the body stays the source of truth. A server behind the gateway must reject a request whose header and body disagree, or the gateway allow-lists one tool while the server runs another.
FAQ
- Is an MCP gateway the same as an MCP proxy?
- People use the words loosely. A proxy usually means one hop in front of one server, often to add sign-in or to turn a local stdio server into an HTTP one. A gateway usually fronts many servers and adds policy: routing, logging, allow-lists. The spec's security guidance uses MCP proxy server for a server that fronts a third-party API as one OAuth client for everyone, and spells out that server's duties.
- Does an MCP gateway need its own MCP server behind it?
- No. The gateway is itself an MCP server to your agent and an MCP client to each server it fronts. Some gateways also wrap plain REST APIs as tools, but then they are the server, not a gateway.
- Can an MCP gateway just pass my token through to the upstream server?
- It must not. The spec says an MCP server may only accept tokens issued for itself and must not forward them. The gateway signs in to each upstream service in its own right and keeps those credentials on its side.
Stop sending HTMLover Slack.
Create an account in a minute, connect your coding agent, and make your first board.