Est.
MCP GatewayLong read

MCP Proxy Architecture That Unifies Routing, Policy Enforcement, and LLM Tool Observability in One Plane

How an MCP gateway makes every permitted tool call traceable.

· 9 min read
Cover illustration for “MCP Proxy Architecture That Unifies Routing, Policy Enforcement, and LLM Tool Observability in One Plane”
MCP Gateway · November 22, 2026 · 9 min read · 2,042 words

An MCP gateway is a proxy that connects AI agents to multiple MCP servers through one logical endpoint, combining tool discovery, routing, authorization, and tool-call observability. It acts as a server to agents and as a client to downstream tools. A production-grade architecture makes routing, policy enforcement, and tracing share the same traversal context, so a permitted route is also an accountable action.

Why direct agent-to-tool connections cannot scale in the enterprise

Direct connections put authentication and authorization inside every tool integration. Each team implements its own rules, and every agent-to-tool pair needs a managed credential relationship. As the fleet grows, those relationships multiply. There is no central place to enforce usage quotas, rate limits, or data-privacy rules, so a runaway agent can exhaust backend connections or external API quotas without meeting a common checkpoint.

A Gateway Architecture for Enterprise MCP Authentication: Unifying Heterogeneous Auth, Identity Delegation, and the User / Non-User Persona Problem reports that large organizations went from zero to dozens of internally built MCP servers within a year. Some teams used no authentication, others API keys, and others full OAuth. The resulting fleet lacked a consistent way to authorize callers or offboard a departing employee. Integration moved faster than accountability could follow.

Debugging an agent interaction requires stitching together logs from individual agents and tools, while compliance questions become forensic work. Fixing one tool’s authentication still leaves the fleet without shared quotas or a single audit record. Security, governance, and observability are therefore not three independent defects. They are three faces of the same missing architectural checkpoint.

What is an MCP gateway, and what must its proxy plane do?

An MCP proxy server occupies both sides of the protocol. It presents one unified tool catalog to clients while maintaining connections to downstream MCP servers. Every discovery request and tool call crosses its control point, regardless of the destination. Aggregation puts many servers behind a single gateway URL, translation bridges transport differences, and control applies authentication, authorization, rate limits, audit logging, and approval workflows.

One logical endpoint need not mean one undifferentiated address. Each registered server can have its own governed proxy URL on the gateway while remaining behind the same controls. That arrangement replaces pairwise credential management with a linear set of relationships. Agents must use the gateway as their common boundary rather than treat it as another integration they can bypass.

Internally, the proxy has four responsibilities. A northbound interface serves clients, a routing and policy layer decides where calls go and whether they are allowed, a southbound layer maintains backend connections, and an observability layer records discovery and execution. The broader reference architecture places this proxy between edge identity, backend translation, and an observability pipeline. These are separate responsibilities within one governed path.

That distinction also applies to live traffic and configuration. The data plane handles discovery, calls, authentication, routing, rate limiting, caching, and instrumentation. The control plane governs configuration and policy. Components can share a governance plane while running in separate processes.

How routing works inside the proxy: tool discovery, semantic filtering, and transport translation

Routing begins with ownership. The gateway maps tool namespaces to backend server URLs and uses health checking to track destinations. Microsoft MCP Gateway uses a Tool Gateway Router to direct execution requests to registered servers based on tool definitions. This gives an aggregated catalog a concrete execution path.

Discovery then narrows that catalog by identity. The gateway returns only tools the requesting agent is permitted to see, keeping unauthorized tools out of normal discovery and irrelevant schemas out of the model’s context. Discovery reduces the surface the agent must navigate before a call reaches the enforcement point.

Semantic filtering addresses a different problem within the permitted catalog. An agent presented with hundreds of tools spends tokens processing their schemas and can choose the wrong tool. More tools do not automatically produce better judgment. Ranking relevance for each request reduces context window pollution, token cost, and selection errors, making discovery a production cost control.

A gRPC backend can be exposed as MCP over Streamable HTTP, while a STDIO-only client can reach a remote SSE or Streamable HTTP server through the proxy. In-process gateways avoid another network hop, sidecars provide isolation with comparable performance, centralized gateways simplify governance but can become bottlenecks, and federated deployments trade operational simplicity for aggregate throughput.

How policy enforcement works at the proxy: identity, authorization grants, and per-action rules

A destination is not an authorization decision. Before forwarding a call, the proxy must establish which agent is calling, whom it represents, what it wants to do, and whether current policy permits that action. Authentication alone answers too little. The base protocol does not supply this complete enterprise policy model.

The gateway architecture paper describes authentication along two axes. One distinguishes interactive users from automated non-users, while the other includes no authentication, static or dynamic API keys, PKCE, client credentials, and platform app-context. A gateway fronting a mixed enterprise fleet must accommodate that diversity. Otherwise, the exceptions use direct connections that bypass its controls.

Those exceptions are especially dangerous when they use long-lived API keys with broad access. Prompt injection can turn an agent’s authority toward an attacker’s purpose, with admin-level credentials exposed if the agent possesses them. Under the replacement model, agents get short-lived runtime tokens in place of raw backend credentials. For user-delegated work, an on-behalf-of flow through RFC 8693 token exchange lets an agent authenticate itself and request permission to act for a specific user. The tool call then has a human identity anchor.

Authorization must still be specific to the action. Attribute-based access control supports different permissions for the same agent across tools, and Kong AI Gateway implements MCP Tool ACLs for such distinctions. An agent can have read access to one database and no access to another without separate credentials for each backend. The policy engine should remain a distinct service from the live data path, while its decisions govern that path. This also makes the gateway a revocation point where a rogue agent can be blocked without rotating credentials or disrupting other agents.

How observability works at the proxy: tracing every tool call, attributing cost, and producing audit evidence

One agent log describes an intention, tool logs describe execution, and the investigator must reconstruct the relationship. Compliance receives the same puzzle with a deadline. The proxy resolves this because routing context, identity context, and execution outcome meet there.

A gateway-layer trace can record the tool name, originating server, agent and user identity, latency, token impact, execution status, and model-side cost. These fields make the action attributable. Their correlation is the advantage of recording at the traversal point.

Cost attribution requires more than an execution status. One agent run may invoke filesystem operations, web searches, database queries, and paid external APIs with different pricing models. Accounting that assigns all spend to the model loses the distinctions needed for tool-cost governance and chargeback. Structured invocation records also support anomaly detection, making an agent stuck in a loop visible before it exhausts connections or quotas.

The observability pipeline belongs in the enterprise’s existing stack. OpenTelemetry integration, structured logs, and metrics export provide the connection, but the gateway must establish attribution before sending the record downstream. Every allow or deny decision needs a named-person attribution in the customer’s observability stack. The resulting trail is a compliance artifact.

What governance gaps open when routing, policy, and observability are separated across layers

Routing may complete before policy is consulted, or policy may approve a call that routing sends to the wrong backend. Responsibility appears distributed, but enforcement is not guaranteed. The missing element is a shared transaction tying the destination to the authorization decision.

Credential exfiltration makes the consequence concrete. A compromised agent can read an attacker-controlled document, receive a prompt-injection payload, and call a tool with attacker-chosen arguments. If routing proceeds before policy evaluates the tool name and arguments together, the call may reach the backend before the relevant check. If observability is also separate, the event can appear in three disconnected logs that nobody correlates. Each component has done some work without establishing whether the whole action was allowed.

Downstream-only telemetry creates another gap even when execution is blocked correctly. It sees forwarded requests, with possible gaps in coverage of denials, rate-limit events, or rerouting decisions. Shadow MCP servers make this worse because policy that sees only declared traffic has no control over undeclared destinations. A checkpoint cannot account for a road it never sees.

The solution is shared enforcement context. Coupling policy updates to proxy deployment creates its own failure mode, forcing a choice between stale rules and disruptive changes. A separate policy service can share the governance plane and still be deployed on its own. Routing must wait for the applicable decision, and observability must record that decision, including when no downstream execution occurs.

The four-layer reference architecture that collapses all three functions into one plane

Diagram: The Four-Layer MCP Gateway Reference Architecture. Visualizes: Show a stacked four-layer architecture diagram illustrating how an MCP gateway collapses routing, policy, and observability into one governed path.

The first layer is identity at the edge. An existing enterprise identity provider, such as Okta, Entra ID, or another SAML/OIDC provider, issues short-lived tokens before agents reach the gateway. The gateway validates them on arrival. Agents do not bring raw backend credentials into this path.

The second layer is the unified gateway plane. It authenticates the agent, consults the policy engine, filters discovery, enforces rate limits, routes to the registered server, and emits the observability record. Those operations share one traversal context. The separately deployed policy engine participates in that context without requiring policy changes to restart the proxy.

The third layer handles translation and registration. Legacy APIs, databases, gRPC services, and SaaS applications become MCP servers with declared schemas and governed proxy URLs. The fourth layer receives structured OpenTelemetry logs, latency metrics, token accounting, and invocation-pattern signals for anomaly detection. Its record comes from the gateway rather than a reconstruction of independent agent and tool logs.

Microsoft’s gateway is a C# reverse proxy with Azure Entra ID authentication, RBAC, and deployment native to a container orchestration platform. Its StatefulSets support deployment identity, while per-request routing is stateless. Kong extends its API gateway with MCP proxy plugins, OAuth 2.1, an MCP Registry, rate limiting, mTLS, and ABAC. IBM ContextForge is open-source and ready for deployment on a container orchestration platform, with federation that lets instances discover each other and merge registries across regions, plus OpenTelemetry and Phoenix observability.

Deployment choice follows the operating requirement. A centralized gateway suits most enterprises prioritizing common governance, while federation fits large multi-region platforms requiring regional resilience. Sidecars suit container orchestration environments needing isolation and low latency. Embedded gateways fit systems where another network hop is unacceptable.

Operationalizing the architecture: shadow server discovery, policy agility, and keeping agents on the governed path

Shadow servers are a common escape from the governed path. They bind to localhost, use random high ports, sit behind proxies, or live inside developer tools. An experiment becomes a production dependency without acquiring formal approval. The architecture may be sound while privileged integrations remain outside it.

Cloudflare’s April 2026 enterprise reference architecture addresses unauthorized remote MCP access through application-layer detection. Cloudflare Gateway uses hostname patterns, URI patterns, and JSON-RPC body inspection to discover and block such servers on the enterprise network. Discovery is therefore more than an inventory exercise. It is part of enforcing which paths agents may use.

Policy agility must also survive deployment. Changes need to reach the enforcement point without a proxy redeploy, or teams may keep stale rules to avoid downtime. Offboarding exposes the practical difference because a consistent authorization layer can remove access across the fleet, eliminating the need for changes to every tool. Per-action policy and short-lived, task-scoped credentials also constrain privilege creep after an agent’s original task ends.

The registry is the other continuing obligation. The MCP ecosystem had over 10,000 published servers as of April 2026, most community-developed and distributed through npm, PyPI, and remote HTTP endpoints. Those package registries are also targets for supply chain attacks. Keeping the gateway registry up to date and checking servers before they are allowed in makes registration a way to enforce governance beyond the clerical work it involves. Platform and security teams should maintain that registry and enforce the governed path so that adding a tool does not quietly add a route around its controls.

Sources

  1. [2608.10760v1] A Gateway Architecture for Enterprise MCP Authentication: Unifying Heterogeneous Auth, Identity Delegation, and the User / Non-User Persona Problem
  2. [Feature Request]: Semantic tool auto-filtering @ MCP Client / Proxy · modelcontextprotocol/modelcontextprotocol · Discussion #845 · GitHub
  3. SEMANTIC TOOL DISCOVERY FOR LARGE LANGUAGE
  4. Prompts Don’t Protect: Architectural Enforcement via MCP Proxy for LLM Tool Access Control
  5. Hybrid Semantic Tool Discovery for Enterprise MCP Gateway: Architecture and Implementation
  6. Enterprise-Managed Authorization: Zero-touch OAuth for MCP
  7. GitHub - microsoft/mcp-gateway: MCP Gateway is a reverse proxy and management layer for MCP servers, enabling scalable, session-aware stateful routing and lifecycle management of MCP servers in Kubernetes environments. · GitHub
  8. MCP Gateway
Filed underMCP Gateway

More in MCP Gateway