# What is an MCP gateway, and when do you need one?

> Source: <https://izylifesolutions.com/articles/what-is-an-mcp-gateway-and-when-you-need-one/>
> Published: 2026-11-26 10:49:46+00:00

**Recommendation:** Put an MCP gateway in front of multiple MCP servers and have it exchange each user's token for one scoped to the target server's audience, so a compromised server cannot replay its token elsewhere.
More in the playbook "Securing agents and AI tools": <https://wpnews.pro/playbooks/agent-security>

# What is an MCP gateway, and when do you need one?

The first MCP server is easy: install it, paste a token, done. By the fifth, every agent holds five long-lived tokens, nobody knows which person asked for which call, and revoking access means editing config files on laptops.

## The problem an MCP gateway solves

The Model Context Protocol (MCP) lets an AI agent, such as Claude Code or Cursor, call tools exposed by MCP servers: list pods, open a ticket, query a database. Each server is a small program with its own way of authenticating, and usually with its own credentials.

That works for one developer and one server. In a team it turns into a grid: every agent connects to every server, and each connection carries a token. Those tokens tend to be broad (the server needs to do everything any user might ask) and long-lived (nobody wants to paste a new one every hour). When something goes wrong, the server’s log shows the token, not the person who typed the prompt.

An MCP gateway replaces the grid with a single point of entry.

## What an MCP gateway does

An MCP gateway is a proxy that speaks MCP on both sides. Agents connect to the gateway as if it were one MCP server; the gateway connects to the real servers behind it. In between, it can do the things each server would otherwise have to do on its own:

1. **Aggregate tools.** The agent sees the tools of every connected server through one
endpoint, usually with a prefix (`kube_list_pods` ,`tickets_close_ticket` ) so names do not
clash.
2. **Authenticate people.** The person behind the agent signs in once, with the company’s
identity provider, instead of each server inventing its own login.
3. **Authorize each call.** The gateway decides whether this person may call this tool, before
the call reaches the server. A tool that nobody registered should not be callable at all.
4. **Handle credentials.** The agent never holds the servers’ tokens. The gateway gets a token
for the target server when it forwards a call.
5. **Audit.** One log records who called which tool, with which arguments, and what the
decision was. Denied calls go into the same log.
6. **Isolate the network.** The MCP servers only accept traffic from the gateway, so a
misconfigured laptop cannot reach them directly.

Points 3 and 4 are where gateways differ most, and where they matter most for security.

## MCP gateway, API gateway, LLM gateway

The three names get mixed up, and “AI gateway” is used for more than one of them.

|  | API gateway | LLM gateway (often called AI gateway) | MCP gateway | 
|---|---|---|---|
| Sits between | clients and HTTP APIs | applications and model providers | agents and MCP servers | 
| Main job | routing, rate limits, API keys | model routing, fallback, token cost, prompt logging | tool access: who may call which tool, on whose behalf | 
| Unit of control | endpoint | model and prompt | tool call | 
| Understands MCP | no, or as plain HTTP | no | yes | 

An LLM gateway controls what goes to the model. An MCP gateway controls what the agent does after the model has decided. A team that runs agents against real systems usually needs the second; it can run next to the first.

## The token question

The MCP authorization specification is built on OAuth 2.1, and its security guidance names
**token passthrough** as an anti-pattern: a server should not accept a token issued for
someone else and forward it downstream. The same rule applies to a gateway. If it forwards the
token the agent sent, every MCP server behind it receives a credential that would also work on
every other server.

The cleaner design is for the gateway to exchange the person’s token for a new one, issued for the target server only. OAuth 2.0 Token Exchange (RFC 8693) does exactly that, and Keycloak 26 supports it natively, enabled per client. Each server then checks that the token’s audience is itself. A compromised server cannot replay its token elsewhere.

## When you need one

You probably need an MCP gateway when:

- more than a handful of people use agents against shared systems (clusters, ticketing, internal APIs);
- you have to answer “who did this?” for an agent’s action, for an auditor or after an incident;
- tokens for MCP servers live in config files on laptops, and revoking someone’s access means rotating a shared secret;
- the MCP servers can change things, not only read them.

You probably do not need one yet when a single developer runs local MCP servers against their own sandbox, or when every server is read-only and public.

## What to check before choosing one

- **Where it runs.** Self-hosted in your cluster, or a SaaS that sees every tool call and its
arguments.
- **Identity.** Can it use your identity provider (Keycloak, Entra ID, any OIDC provider), and
are roles taken from there?
- **Default deny.** Is a new tool on an upstream server exposed automatically, or only once
someone registers it?
- **Tokens downstream.** Does each upstream get its own token, or does the gateway pass one
token through?
- **Audit format.** Can the log go to your SIEM, and does it include denied calls?
- **Client support.** Does sign-in work in the agents your team uses? Recent MCP clients
support URL elicitation, which lets the gateway open the login page during a tool call.

## An example: IzyTrust

[IzyTrust](https://izylifesolutions.com/products/izytrust/) is the MCP gateway we build at Izylife Solutions. It runs on
Kubernetes, uses Keycloak for sign-in and follows the design above:

- the agent connects without logging in; the person signs in with Keycloak the first time a prompt needs a tool;
- every tool comes from a registry with the scope it requires, and anything not in the registry is denied;
- each call is forwarded with a token exchanged for that upstream only;
- person, server, tool, arguments, scope and outcome go to a JSON audit log.

Connecting a new MCP server is one entry in the registry:

```
upstreams:
  - name: kube
    url: http://kube-mcp.tools.svc:8000/mcp
    audience: kube-mcp
    tools:
      list_pods: read
      get_deployment: read
      scale_deployment: write
```

With this entry, a person with the `read` scope can list pods and read deployments, and only a
person with `write` can scale. Tools that the Kube MCP server exposes but the entry does not
list stay invisible to agents.

IzyTrust is in early access. Policies on resources and context (OPA or Cedar) and human approval for destructive operations are on the roadmap, not in the current release.

The Helm values and a demo that runs on k3d are in the
[izytrust-examples repository](https://github.com/gcassata74/izytrust-examples). To try it, or
to discuss your agents and MCP servers, [contact us](https://izylifesolutions.com/?service=izytrust-demo#contacts).
