AI Infrastructureazure

MCPRoute on Application Gateway for Containers: One Governed Front Door for MCP Servers

P&C

Prompt & Circuit Editorial

November 6, 2026 · 12 Min Read

MCPRoute on Application Gateway for Containers: One Governed Front Door for MCP Servers

Why it matters

Agents are only as useful as the systems they can reach, and the Model Context Protocol (MCP) is a common way to expose those systems as tools, resources and prompts [1]. The operational problem appears when the number of MCP servers grows. Microsoft's documentation notes that each client might need to know every server address, and each server might need its own internet exposure, TLS configuration, authentication enforcement, health monitoring and scaling strategy [1]. Application Gateway for Containers now offers an MCP-aware answer to that sprawl. The capability is in preview, so treat everything below as subject to change [1].

What the gateway does and does not do

Application Gateway for Containers can act as an MCP gateway between clients and MCP servers running in Kubernetes. It does not create MCP capabilities or replace the MCP servers; it provides the client-facing entry point and governs how clients reach them [1]. Application teams still build the servers, while platform teams own access and connectivity [1].

The mechanism is a custom resource named MCPRoute. It extends the Kubernetes Gateway API and attaches to a standard Gateway, but its MCP-aware routing and aggregation come from Application Gateway for Containers rather than the upstream Gateway API [1]. The documentation explains why a plain HTTPRoute is not enough: it can forward MCP messages but treats each request independently, whereas the gateway understands enough of the MCP request flow to aggregate discovery, direct an invocation to the server that owns a capability, and keep best-effort affinity for stateful sessions [1].

MCPRoute uses the alb.networking.azure.io/v1alpha1 API, and the documentation warns that preview APIs can change before general availability [1]. Microsoft's guidance is to use MCPRoute when the endpoint is an MCP server and to keep HTTPRoute for conventional web APIs and GRPCRoute for gRPC services [1].

Routing models

An MCP deployment has three main resources: a Gateway that provides the address and listener, an MCPRoute that defines the public MCP path, and one or more Kubernetes Services as backends [1]. The listener must use HTTP or HTTPS and explicitly allow the MCPRoute kind [1]. If you omit the path it defaults to /mcp, and a backend can expose MCP on a different path [1].

Two routing shapes are available:

  • Single server. With one backend reference, the gateway proxies MCP requests directly to that Service. This fits cases where one team owns the whole capability set, the server already aggregates its own downstream systems, or you want a distinct hostname or path per server [1].
  • Aggregation. With several backend references, the route becomes one logical MCP endpoint. For discovery requests such as tools/list, the gateway sends the request to each backend and merges the responses [1]. Capability names are namespaced; a get_order tool from a Service named contoso-tools is exposed as contoso-tools__get_order, and the gateway strips the prefix when it routes the invocation [1].

Aggregation has design consequences. Service names become part of the client-visible capability namespace, so the documentation advises choosing stable, descriptive names [1]. A route can reference up to 64 backends, and backends should implement compatible MCP protocol behavior [1]. The combined endpoint can be only as useful as the servers supplying its capabilities, so each backend should be monitored independently [1].

Security and policy

MCP endpoints can expose tools that read data or perform actions, and the documentation says to protect them as application APIs rather than anonymous infrastructure endpoints [1]. The controls it describes:

  • Transport. Use an HTTPS listener so messages and bearer tokens are encrypted between client and gateway. BackendTLSPolicy covers the gateway-to-Service hop and can validate a private certificate authority and the expected subject alternative name [1].
  • JWT validation. An AuthPolicy can be attached to an MCPRoute, its parent Gateway or the managed ApplicationLoadBalancer. The gateway can validate signature, issuer, lifetime and audience before forwarding traffic [1].
  • Authorization stays in the server. Publishing scopes through OAuth Protected Resource Metadata does not enforce authorization; the MCP server remains responsible for checking roles, scopes, permissions and resource ownership [1].
  • WAF. WAF evaluates the request and JWT validation authenticates the caller; the two are complementary [1]. A WAF policy that targets one route does not automatically protect another route on the same listener [1].

The guidance on where to attach JWT validation is a useful decision rule: apply it at the Gateway when every child route shares the same trust boundary, and directly on an MCPRoute when issuers, audiences or OAuth metadata differ by endpoint [1].

Limits and failure modes

  • No ListenerSet attachment. An MCPRoute must attach directly to a Gateway. Attaching to a Gateway API ListenerSet is not currently supported, so delegating listener ownership to teams is unavailable for MCP endpoints. The documented workaround is to define the MCP listener on the shared Gateway and use allowedRoutes.namespaces to control which namespaces can attach [1].
  • Cross-namespace backends need a grant. Without a ReferenceGrant in the Service namespace, the route reports ResolvedRefs=False [1].
  • Route status comes first. A healthy pod does not make an MCP endpoint reachable when the route is not accepted or its references are unresolved, so the documentation tells operators to check the Accepted and ResolvedRefs conditions after every change [1].
  • Health checks. Where the inferred health check is unsuitable, a HealthCheckPolicy can set an explicit HTTP health endpoint [1].
  • Per-backend timeouts. Each backend reference has a timeout field, and the documentation advises setting it with slow or variable downstream systems in mind [1].

Session affinity: read two pages

Some MCP servers keep in-memory state after the initialize request. Setting sessionAffinity: true on the backend reference pins the session to the pod that initialized it [1]. This is best effort: if the pod is removed or unavailable, requests return to normal load balancing instead of failing, so servers should tolerate session loss or keep important state outside the pod [1]. The documentation also says not to enable affinity unless the backend requires it, because stateless servers scale and recover more predictably [1].

Two other pages describe affinity for the wider product. The general session affinity page describes cookie-based affinity, with managed cookies named AGCAffinity that last 86,400 seconds, or application cookies with a name and duration you define [3]. The load balancing page states that session affinity requires the Ring Hash strategy and is rejected with any other strategy or when slow start is enabled [4]. The MCP page does not say whether those constraints apply to the MCP sessionAffinity field, and we have not found a statement either way in the pages we reviewed. Validate the behavior in a test cluster before you design around it.

Decision table

SituationSuggested approachWhy
One team, one MCP serverSingle-backend MCPRoute on its own path or hostnameDirect proxying, simplest to operate [1]
Several teams, one client catalogMulti-backend MCPRouteMerged discovery, namespaced capabilities [1]
Conventional REST or gRPC APIsHTTPRoute or GRPCRouteMCPRoute is meant for MCP endpoints [1]
Stateful serverEnable affinity on that backend onlyBest effort; plan for session loss [1]
Different issuers per endpointAuthPolicy on each MCPRouteGateway-level policy suits one trust boundary [1]

Architect's checklist

  • Confirm your risk tolerance for a preview feature on the v1alpha1 API before putting it on a production path [1].
  • Use HTTPS listeners and a dedicated MCP hostname when clients or security policies differ from your web applications [1].
  • Decide Service names before exposing them through aggregation, because clients will see them [1].
  • Choose where JWT validation lives: Gateway for a shared trust boundary, MCPRoute where audiences differ [1].
  • Keep authorization checks inside each MCP server; the gateway authenticates but does not enforce scopes [1].
  • Scope WAF policies per route when inspection needs differ on one listener [1].
  • Enable session affinity only where state requires it, and test how it interacts with the load balancing strategy [1][4].
  • Plan namespace access up front, since ListenerSet delegation is not available and cross-namespace backends need a ReferenceGrant [1].
  • Monitor each backend and review route status after every change [1].

Sources

Numbers in square brackets refer to these sources, checked on 2026-11-06.

  1. Model Context Protocol (MCP) capabilities in Application Gateway for Containers | Microsoft Learn
  2. Session affinity overview for Azure Application Gateway for Containers | Microsoft Learn
  3. Load balancing strategies in Application Gateway for Containers | Microsoft Learn
Tags:azuremcpapplication-gateway-for-containerskubernetesagents
Share Article

Responses (0)

Sign in to join the conversation and share your thoughts.

P&C

Prompt & Circuit Editorial

Contributing Editor

Articles on AI infrastructure for cloud architects, written from official vendor sources and checked claim by claim before publishing.