Transport auth and tool authorization are easy to confuse. The Model Context Protocol authorization specification covers how an HTTP MCP client obtains and presents an OAuth 2.1 access token to an MCP server acting as a resource server. That is necessary. It is not enough: a valid token still must not mean every tool runs. On Kubernetes, identity, network path, secret handling and a fail-closed capability gate decide whether a concrete tool call executes.
OAuth to the server, then a fail-closed capability gate before the tool runs.
What the MCP authorization spec covers
Per the MCP authorization specification (HTTP transports), when authorization is supported:
Authorization servers implement OAuth 2.1 for confidential and public clients.
An MCP server acts as an OAuth 2.1 resource server and must expose OAuth 2.0 Protected Resource Metadata (RFC 9728), including authorization_servers.
Clients discover the authorization server from that metadata (and from WWW-Authenticate on 401), then obtain tokens for that resource.
Servers must not accept tokens that were not issued for them. Token passthrough to downstream APIs breaks audience binding, rate limits and audit boundaries.
STDIO transports are out of that OAuth flow: credentials come from the environment instead. On Kubernetes that usually means a Secret mounted into the agent or MCP pod — still not a substitute for per-call tool authorization.
Fail-closed tool authorization
OAuth answers "is this client allowed to call this MCP server?". Tool authorization answers "is this exact tool name and argument set allowed for this agent, under this policy version?".
The rule I design for is blunt: if the capability check cannot affirmatively ALLOW (or REQUIRE_APPROVAL), the call does not execute. That includes missing policy, digest mismatch on the tool catalog, undeclared tools, enforcement timeouts and adapter errors. The Agent Security Contract implements that pattern as a pre-execution gate with ALLOW / BLOCK / REQUIRE_APPROVAL and an integrity-checked evidence envelope. Its measured results apply only on its own scenario corpus — not as a general safety claim.
Map the gate to Kubernetes so it cannot be skipped:
Put the decision in the execution path (sidecar, gateway ext_authz, or an admission-style hook before the tool runner), not in prompt instructions.
Prefer fail-closed client behaviour when the gate is unreachable (failure_mode_allow: false in the ASC external-auth example).
Bind approvals to exact arguments and consume them atomically; a flipped parameter needs a new approval.
Kubernetes primitives that carry authorization
ServiceAccounts and workload identity
Give each agent and each MCP server its own ServiceAccount. Do not share default. Disable automountServiceAccountToken unless the pod must call the Kubernetes API. The MCP server's OAuth client credentials and any downstream API tokens belong in Secrets referenced by that ServiceAccount's pods — not in the agent container's environment "for convenience".
Default-deny egress (and, where useful, ingress) for agent and MCP pods. Allow DNS and the named destinations the tools need. Core NetworkPolicy matches pods, namespaces and CIDRs, not hostnames — for FQDN allowlists use an egress proxy or a CNI/mesh that supports them. East-west traffic between agent, gate and MCP server should use workload identity and mutual TLS; the zero-trust service mesh case covers that pattern.
Secrets handling
Mount OAuth client secrets and API tokens as projected volumes or env-from Secret, with the secret scoped to the MCP server's namespace.
Prefer short-lived tokens over long-lived personal access tokens, matching the MCP spec's least-privilege guidance on scopes.
Keep tool-runner pods from mounting cluster-admin kubeconfigs or cloud metadata paths; NetworkPolicy should already block link-local metadata ranges.
Admission and policy-as-code
Use admission (Pod Security, ValidatingAdmissionPolicy, or a policy engine) so agent/MCP Deployments cannot opt out of the gate sidecar, the non-root security context, or the required ServiceAccount. Policy-as-code guardrails is the companion case for CI and admission contracts. Admission does not evaluate MCP tool arguments; it keeps the runtime shape that makes the capability gate unavoidable.
A minimal authorization loop
Client obtains an audience-bound OAuth access token for the MCP server (Protected Resource Metadata + authorization server).
Request hits the MCP server (or a fronting gateway) with that token; invalid or wrong-audience tokens are rejected.
Before any tool side effect, a capability gate evaluates agent identity, pinned catalog digest, tool name, arguments, rate limits and approvals.
Missing capability → BLOCK. Allowed call runs under the MCP server's ServiceAccount and NetworkPolicy. Every decision should leave an audit record — see AI agent audit trail.
Agent and MCP stacks expand the attack surface beyond prompt text: tool misuse, poisoned tool descriptions, argument injection, and unapproved high-impact actions run without a pre-execution gate