What is an MCP gateway, and when do you need one?
What is an MCP gateway? One MCP server in front of your tool servers that decides which agent may call which tool, signs in for the agent and records every call.
What is an MCP gateway? One MCP server in front of your tool servers that decides which agent may call which tool, signs in for the agent and records every call.
What is an MCP gateway? It's an MCP server that your agents connect to in place of the servers their tools live on. The agent sees one address and one tool list, and the gateway forwards each call to the right server after checking that this agent is allowed to make it. The spec lets a server make that check for itself but doesn't require it. With one agent and one server you can do without it. Once several agents share servers, or a vendor's key would otherwise sit in every agent's environment, the gateway is where those keys live and where you decide which agent gets which tool.
In the 2026-07-28 revision of the MCP spec, the authorization section is optional, covers the HTTP transports and builds on OAuth 2.1. It settles whether a client may make requests to a server on someone's behalf. Which tools that client gets on the server is the server's business. The tools page lets a server's tools/list answer vary by the authorization on the request, "returning only the tools the caller's granted scopes permit". It doesn't require it. A server that skips it hands every tool to anyone with a valid key.
The same page calls tool annotations such as readOnlyHint and destructiveHint untrusted unless they come from a server you trust. It also only asks for tool names to be unique within one server, so a client that collects tools from several servers will sooner or later meet two tools called search. Its advice for that is to prefix each name with a server identifier.
Credentials get one firm rule, in the spec's security best practices. An MCP server must not accept a token from the client and pass it through to the API behind it, which the spec calls token passthrough and forbids outright. So a gateway has to hold its own credential for each server and never forward the agent's.
People use the two words for overlapping things, so the names alone won't tell you much. Docker's MCP Gateway documentation describes it as "a centralized proxy between clients and servers". The MCP spec's security page uses "MCP proxy server" for an MCP server that connects clients to a third-party API and acts as one OAuth client to it. And the open source mcp-proxy is a tool that "lets you switch between server transports", so a client that speaks stdio can reach a remote server over Streamable HTTP or SSE, and a local stdio server can be served over SSE.
Vendors don't agree on what is an MCP gateway and what is a proxy, so we go by whether two agents on one server can get different tools. Only a product that knows which agent is calling can say yes. A proxy forwards traffic and may change its transport on the way, the same for every caller. A gateway identifies the agent from its token, so it can filter the tool list per agent, attach the right server's credential to each call and write down which agent called what.
The call below goes through Amiril's gateway, which we build, from a payments agent that a customer has just asked for a refund.
The agent's MCP client points at the gateway, with the address and a token from the agent's Connect tab in Amiril:
{
"mcpServers": {
"amiril": {
"url": "<gateway URL>",
"headers": {
"Authorization": "Bearer <token>"
}
}
}
}When it connects it asks for its tools. The list it gets back has only the tools someone granted this agent, under names like payments__get_payment, which is the tool server's slug, two underscores and the tool's own name. That's the prefix the spec recommends, joined with __ rather than a dot because model APIs don't accept a dot in a tool name. Nobody granted this agent payments__refund_payment, so the model never sees it and can't choose it.
A client can still send any tool name it likes. If this one sends payments__refund_payment anyway, the gateway finds no grant for it and answers:
This agent doesn't have access to payments__refund_payment. An admin can grant it in Amiril.
The call never reaches the payments server. The access log records the denial against this agent and tool, with the reason Not granted.
A call to payments__get_payment goes through. The gateway takes the prefix off, picks the payments server and adds that server's credential on the way. Someone entered that credential once, when they registered the server, and if it's an OAuth login Amiril renews it before it expires. You can replace a saved credential but never read it back: neither the app nor the API shows it, and it's stored encrypted with AES-256-GCM. The agent's own environment holds only the gateway token, which belongs to this one agent in one environment. The result comes back to the agent, and the call appears on the agent's Calls tab with the gateway's decision and how the server answered.
When you register a tool server, Amiril reads its tool list and files each tool as Read, Write or Destructive from the server's hints. A tool that sends no hints counts as Write. Since the spec calls those hints untrusted, you check the levels and correct them before the tools are added. Every tool starts denied, and so does any tool the server adds later.
You grant per agent, one tool at a time or a whole server at Read, Read and write, or Full. A grant or a revoke reaches the gateway within a few seconds.
Grants pile up, because people ask for a tool when they need it and nobody asks to have one taken away. A tool granted more than 30 days ago that the agent hasn't called in the last 30 days comes up as an access suggestion, and you answer it with Revoke or Dismiss. The investigator, the AI agent that writes up each issue, can raise one too, when it judges from an issue's runs that the agent shouldn't be able to call a tool at all. Both kinds wait on the agent's Access tab and on the Suggestions page.
With one agent talking to one server you run, what is an MCP gateway in a bigger setup can be a filter in that server's own tools/list handler. Add a support agent that looks up payments beside a back-office agent that issues refunds, both on the same payments server, and only the second should see payments__refund_payment. A vendor's server adds a second reason: its key usually carries broad scopes, and without a gateway a copy of it sits in each agent's environment.
Security reviews ask which agents can delete something. When every tool call goes through the gateway, its grants answer that, and Amiril's Agents page has a Needs review column that counts, for each agent, the destructive tools it can call and the grants it hasn't used in 30 days.
Plenty of agents have no MCP server at all yet, just tool functions in their own code and an API key in their environment. Those tools can move onto a tool server, and an API with no server can be wrapped as one. The example server in that guide is 63 lines of TypeScript.
Every Amiril plan has the gateway, including the free one. MCP access control goes further into grants, with how unused ones get found and revoked. We put ten gateways side by side, this one among them, in the MCP gateway comparison, and the GitHub MCP exploit, where every call the agent made was allowed, is taken apart in MCP security. Setting up an agent takes four steps in the gateway overview, from registering it to its first call through the gateway.