{"slug": "what-is-an-mcp-gateway-and-when-do-you-need-one", "title": "What is an MCP gateway, and when do you need one?", "summary": "An MCP gateway is a proxy that speaks the Model Context Protocol on both sides, letting agents such as Claude Code and Cursor reach many MCP servers through one endpoint that aggregates tools, authenticates people via the company identity provider, authorizes each tool call, handles credentials and writes a single audit log. The article argues teams need one once agents connect to multiple servers, because each connection otherwise carries broad, long-lived tokens and server logs record the token rather than the person who typed the prompt. It recommends the gateway exchange the user's token for a server-specific one using OAuth 2.0 Token Exchange (RFC 8693), supported natively in Keycloak 26, rather than forwarding the agent's token, which the MCP authorization specification's security guidance names as token passthrough, an anti-pattern.", "body_md": "# What is an MCP gateway, and when do you need one?\n\nThe 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.\n\n## The problem an MCP gateway solves\n\nThe 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.\n\nThat 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.\n\nAn MCP gateway replaces the grid with a single point of entry.\n\n## What an MCP gateway does\n\nAn 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:\n\n1. **Aggregate tools.** The agent sees the tools of every connected server through one\nendpoint, usually with a prefix (`kube_list_pods` ,`tickets_close_ticket` ) so names do not\nclash.\n2. **Authenticate people.** The person behind the agent signs in once, with the company’s\nidentity provider, instead of each server inventing its own login.\n3. **Authorize each call.** The gateway decides whether this person may call this tool, before\nthe call reaches the server. A tool that nobody registered should not be callable at all.\n4. **Handle credentials.** The agent never holds the servers’ tokens. The gateway gets a token\nfor the target server when it forwards a call.\n5. **Audit.** One log records who called which tool, with which arguments, and what the\ndecision was. Denied calls go into the same log.\n6. **Isolate the network.** The MCP servers only accept traffic from the gateway, so a\nmisconfigured laptop cannot reach them directly.\n\nPoints 3 and 4 are where gateways differ most, and where they matter most for security.\n\n## MCP gateway, API gateway, LLM gateway\n\nThe three names get mixed up, and “AI gateway” is used for more than one of them.\n\n|  | API gateway | LLM gateway (often called AI gateway) | MCP gateway | \n|---|---|---|---|\n| Sits between | clients and HTTP APIs | applications and model providers | agents and MCP servers | \n| Main job | routing, rate limits, API keys | model routing, fallback, token cost, prompt logging | tool access: who may call which tool, on whose behalf | \n| Unit of control | endpoint | model and prompt | tool call | \n| Understands MCP | no, or as plain HTTP | no | yes | \n\nAn 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.\n\n## The token question\n\nThe MCP authorization specification is built on OAuth 2.1, and its security guidance names\n**token passthrough** as an anti-pattern: a server should not accept a token issued for\nsomeone else and forward it downstream. The same rule applies to a gateway. If it forwards the\ntoken the agent sent, every MCP server behind it receives a credential that would also work on\nevery other server.\n\nThe 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.\n\n## When you need one\n\nYou probably need an MCP gateway when:\n\n- more than a handful of people use agents against shared systems (clusters, ticketing, internal APIs);\n- you have to answer “who did this?” for an agent’s action, for an auditor or after an incident;\n- tokens for MCP servers live in config files on laptops, and revoking someone’s access means rotating a shared secret;\n- the MCP servers can change things, not only read them.\n\nYou 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.\n\n## What to check before choosing one\n\n- **Where it runs.** Self-hosted in your cluster, or a SaaS that sees every tool call and its\narguments.\n- **Identity.** Can it use your identity provider (Keycloak, Entra ID, any OIDC provider), and\nare roles taken from there?\n- **Default deny.** Is a new tool on an upstream server exposed automatically, or only once\nsomeone registers it?\n- **Tokens downstream.** Does each upstream get its own token, or does the gateway pass one\ntoken through?\n- **Audit format.** Can the log go to your SIEM, and does it include denied calls?\n- **Client support.** Does sign-in work in the agents your team uses? Recent MCP clients\nsupport URL elicitation, which lets the gateway open the login page during a tool call.\n\n## An example: IzyTrust\n\n[IzyTrust](https://izylifesolutions.com/products/izytrust/) is the MCP gateway we build at Izylife Solutions. It runs on\nKubernetes, uses Keycloak for sign-in and follows the design above:\n\n- the agent connects without logging in; the person signs in with Keycloak the first time a prompt needs a tool;\n- every tool comes from a registry with the scope it requires, and anything not in the registry is denied;\n- each call is forwarded with a token exchanged for that upstream only;\n- person, server, tool, arguments, scope and outcome go to a JSON audit log.\n\nConnecting a new MCP server is one entry in the registry:\n\n```\nupstreams:\n  - name: kube\n    url: http://kube-mcp.tools.svc:8000/mcp\n    audience: kube-mcp\n    tools:\n      list_pods: read\n      get_deployment: read\n      scale_deployment: write\n```\n\nWith this entry, a person with the `read` scope can list pods and read deployments, and only a\nperson with `write` can scale. Tools that the Kube MCP server exposes but the entry does not\nlist stay invisible to agents.\n\nIzyTrust 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.\n\nThe Helm values and a demo that runs on k3d are in the\n[izytrust-examples repository](https://github.com/gcassata74/izytrust-examples). To try it, or\nto discuss your agents and MCP servers, [contact us](https://izylifesolutions.com/?service=izytrust-demo#contacts).", "url": "https://wpnews.pro/news/what-is-an-mcp-gateway-and-when-do-you-need-one", "canonical_source": "https://izylifesolutions.com/articles/what-is-an-mcp-gateway-and-when-you-need-one/", "published_at": "2026-11-26 10:49:46+00:00", "updated_at": "2026-11-26 11:12:42.339623+00:00", "lang": "en", "topics": ["ai-agents", "agent-protocols", "ai-tools", "ai-safety"], "entities": ["Model Context Protocol", "Claude Code", "Cursor", "Keycloak 26", "OAuth 2.1", "OAuth 2.0 Token Exchange", "RFC 8693"], "also_reported_by": [], "takeaway": "Route agent tool calls through an MCP gateway that exchanges the user's token for a server-specific one via OAuth 2.0 Token Exchange (RFC 8693, native in Keycloak 26) instead of forwarding the agent's token, so a compromised server cannot replay its credential against other servers.", "recommendation": {"advice": "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.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/what-is-an-mcp-gateway-and-when-do-you-need-one", "markdown": "https://wpnews.pro/news/what-is-an-mcp-gateway-and-when-do-you-need-one.md", "text": "https://wpnews.pro/news/what-is-an-mcp-gateway-and-when-do-you-need-one.txt", "jsonld": "https://wpnews.pro/news/what-is-an-mcp-gateway-and-when-do-you-need-one.jsonld"}}