Three credentials appear the moment a coding agent is wired to GitHub, a Postgres read replica, and Jira over the Model Context Protocol (MCP), each scoped for convenience and saved in a JSON config on a laptop. The replica logs every query under one shared database user, so nobody can say later which agent ran a query or who asked. Every team adopting agents repeats the pattern.
An MCP gateway is the usual first answer. It is a proxy that sits between AI agents and the MCP servers they call, so identity checks and logging happen once instead of inside every agent.
For MCP traffic judged one tool at a time, a gateway is a sound control. Its limits come from that same design. It never sees an agent’s direct API calls or the prompt behind a request, and by attaching every server’s credential, it concentrates credentials instead of removing them. Rolling out MCP leaves you two decisions: whether your footprint justifies a gateway yet, and what must sit behind and around it from day one.
What Is an MCP Gateway?
An MCP gateway is a proxy that receives agents’ MCP requests and sends its own to the real servers, checking identity and policy in between. A host application such as a code editor normally runs one MCP client per server. The gateway collapses those links into one endpoint and takes over four jobs each host would otherwise repeat: routing, identity and policy enforcement, the tool catalog, and the audit trail.
An LLM gateway governs model traffic between applications and model providers. An MCP gateway governs the tool calls that follow once the model decides to act. Akeyless’s ecosystem overview shows where MCP gateways fit beside discovery and runtime controls.
How Does an MCP Gateway Work?
Each request passes through five steps, numbered in the diagram.

Diagram of an MCP gateway: AI agents on the left connect to the gateway in the center, which runs five numbered steps while forwarding each call to MCP servers on the right.
- The agent opens a single connection endpoint, and the gateway merges the catalogs of every server behind it.
- The gateway authenticates the agent and maps it to the team that owns it.
- It filters the tool catalog: a tools/list request returns only what that identity may use, and the model never learns the rest exist.
- On each tools/call, it checks policy (some gateways add argument rules or human approval), then attaches the credential the target expects.
- It writes the audit record: agent, tool, arguments, and result.
A gateway can tag each call with the agent’s identity and, when the client passes it through, the user the agent acts for.
MCP Gateway vs. API Gateway vs. MCP Server
An MCP server is where tools live. The two gateways differ in how much of MCP they can read.
| Dimension | MCP server | API gateway | MCP gateway |
|---|---|---|---|
| Sees the tool name | For its own tools | From headers on 2026-07-28 servers | From the message on any revision |
| Transports | stdio or Streamable HTTP | HTTP only | Both, if it runs the stdio servers |
| Per-identity tool lists | Only if built to filter | No | Yes |
| Attribution | Its own users | Per request | The agent, plus the user if passed through |
Two transports carry MCP: stdio, where the client launches the server as a local subprocess, and Streamable HTTP, the March 2025 replacement for an older HTTP transport. The 2026-07-28 revision of the Streamable HTTP specification dropped protocol-level sessions. Older servers still use them. A gateway in front of a mixed fleet has to handle both.
That revision also narrowed the MCP gateway vs. API gateway gap. Under the July 2026 revision, each tool call carries Mcp-Method and Mcp-Name headers, so a conventional API gateway can now route or rate-limit by tool name. It still cannot front stdio servers. Nor can it filter a tools/list response per identity or tie a run of calls to the agent and person behind them. For per-tool rate limits alone, the API gateway you already run may be enough.
The Security Risks an MCP Gateway Contains
A gateway contains four risks that grow with each server.
Over-Permissioned Tool Access
GitHub’s official MCP server lists delete_repository among its default repository tools, usable by any agent whose token carries the delete_repo scope. Its –read-only and –toolsets flags, which GitHub documents for the server, trim that list for every client at once. A gateway allowlist works per identity. A triage agent and a release agent can share one server while only the release agent sees write tools.
Credentials Handed to the Agent
Locally, the token behind those tools sits within the agent’s reach. MCP’s authorization specification tells stdio servers to retrieve credentials from the environment, which in practice puts static API keys in the host’s config file. GitGuardian’s State of Secrets Sprawl 2026 report counted “24,008 unique secrets exposed in MCP configuration files.” A gateway holds those credentials instead and attaches them at call time, outside the model’s context.
Tool Poisoning and Untrusted Servers
That config file was the prize in Invariant Labs’ April 2025 research, where hidden instructions in a tool description made Cursor send ~/.cursor/mcp.json and the user’s SSH private key to the attacker. Invariant also described the rug pull, a server changing a tool’s description after the client approved it. Gateways respond by allowlisting servers and pinning approved descriptions by hash, then alerting when either changes.
MCPoison (CVE-2025-54136), which Check Point Research documented in August 2025, is a related client-side variant, where an approved config was later swapped for a malicious command. Hash pinning at a gateway never sees that swap, because the command runs on the developer’s machine.
No Attribution
Without a gateway, every query reaches the database under one shared account, and a dropped table traces back to a service user and stops there. A gateway’s record adds the agent, and the user when the client forwards one, though the database still logs only the gateway’s account.
What an MCP Gateway Does Not Solve
A gateway centralizes enforcement, but the credentials behind it still exist. They move from agent configs into the gateway’s configuration or a secrets manager it reads. That beats scattering them across agents, though it also means one compromised gateway opens every system behind it. And an outage at an enterprise MCP gateway cuts off every agent’s tools at once.
A gateway governs only MCP traffic, while agents also reach systems through native tool calling and direct API or SDK calls that bypass it. SC Media reported in April 2026 that a coding agent at PocketOS deleted the production database and its backups in under 10 seconds. It had used a broadly scoped API token to send one curl command to its infrastructure provider, a path no MCP gateway sits on.
Even on the MCP path, a tool allowlist or argument rule cannot tell whether a particular database command fits the request that triggered it, and the gateway has no view of the originating prompt. The PocketOS agent was working on a staging problem when its token allowed a production deletion.
The complement is brokered access. Instead of storing a target credential, the gateway hands the connection to a broker that uses the credential on the agent’s behalf and never passes it along. Akeyless SecretlessAI works this way: the Akeyless Gateway brokers each connection to the target, creates access on demand where the target supports it, and keeps the credential out of the agent’s reach, including for legacy systems that still depend on passwords or keys. Two Akeyless posts, a walkthrough on brokering credentials at runtime and the OpenAI Codex MCP server integration example, show servers without stored keys.
For autonomous or higher-risk agents, Akeyless Agentic Runtime Authority adds intent-aware enforcement, evaluating each action against the originating request and blocking destructive or out-of-scope commands before they reach the target. It also covers SSH, databases, Kubernetes, and cloud APIs, and records each action with its originating prompt and the person behind it.
When Do You Need an MCP Gateway?
You need one once any of these holds:
- Several teams share MCP servers, or there are more servers than one person can review.
- An agent can read or change production data.
- A compliance obligation requires each access to a regulated system to name who made it.
- Agents load MCP servers that your team did not write.
| When to Wait If none of these applies, wait. One team with two internal servers on laptops gains little beyond another service to patch. |
Deploy the Gateway, Then Cover What It Cannot
Start by searching repositories and laptops for MCP config files such as .cursor/mcp.json and counting the credentials inside. If the checklist points to a gateway, deploy it with per-identity allowlists and hash pinning from day one, before agents rely on a broad catalog. Move the credentials it would hold to brokered access, and put runtime authority in front of every agent that can change production, at the cost of one more hop. Treat any path that skips MCP as ungoverned until a control covers it. Built in that order, the gateway tells you which agent called which tool, and the layers behind it decide what that agent may do.
FAQs About MCP Gateways
What is an MCP gateway in simple terms?
An MCP gateway is a checkpoint between AI agents and the tools they reach through the Model Context Protocol. Each agent connects to the gateway rather than to every server. The gateway shows it only approved tools and records every call.
What is the difference between an MCP gateway and an MCP server?
An MCP server exposes one system’s capabilities as tools, such as GitHub’s issue and pull request tools. An MCP gateway usually adds no tools of its own. It fronts many servers and decides, agent by agent, which tools may be called.
Can I use an API gateway instead of an MCP gateway?
Only in part. A standard API gateway can terminate TLS and rate-limit a remote MCP endpoint, and, on servers running the July 2026 revision, route by tool name. Per-agent tool lists and local stdio servers still need an MCP gateway, which can sit behind the API gateway.
Does an MCP gateway stop prompt injection?
No. Injected instructions arrive in content an agent reads through legitimate tools, such as a web page, and the gateway never sees the model’s reasoning. It can still keep a hijacked agent inside its allowlist, and some gateways can require approval for high-risk calls, as privileged access controls do for people.
What happens to my agents if the MCP gateway goes down?
Every MCP tool call stops until the gateway recovers, which is the right default: a gateway that failed open would switch off every allowlist. Run an enterprise MCP gateway as several instances behind a load balancer and keep its configuration in version control. Document a break-glass procedure for outages.