# Why does an instance of the MCP HTTP transport accept a token minted for a sibling resource: OAuth resource binding, token audience restriction, and replay defense at the boundary **Date of Record:** 2026 November 15 **Scope:** Applies to MCP servers exposing HTTP-native transport (Streamable HTTP / SSE) that validate bearer tokens issued by an external authorization server using OAuth 2.1 resource indicators (RFC 8707) and audience restriction (RFC 9068). Does not apply to stdio transport, mTLS-only deployments, or tokens validated exclusively by an in-process authorization server that mints and consumes its own tokens under a single tenant. ## Core Distinction There are two distinct questions a resource server can ask about a bearer token, and they are routinely conflated in MCP transport implementations: 1. **Is this token valid?** — signature, issuer, expiry, not-before, revocation status. 2. **Is this token valid *for me*?** — the `aud` claim, and the resource indicator bound at authorization time, must designate *this specific MCP resource server instance*, not merely a resource server in the same trust domain. The first check is a cryptographic and temporal check. The second is a *binding* check. A token can pass the first check perfectly and fail the second silently, because many JWT libraries validate `aud` only when explicitly told to, and many MCP server templates pass `audience=None` or omit the `audience` parameter entirely when constructing the verification call. The failure is non-obvious because the token is genuinely valid, signed by the correct issuer, unexpired, and scoped to a legitimate client — it was simply minted for a different resource. The second non-obvious boundary is replay. OAuth 2.1 bearer tokens are replayable by construction. An MCP HTTP transport that terminates TLS and validates `aud` correctly still accepts a captured token from a network position that can observe the request, until expiry. Replay defense at the MCP layer is therefore not an OAuth property; it is a transport-layer property that must be added explicitly (DPoP, mTLS-bound tokens, or short-lived tokens with sender-constraining). ## What Was Observed A deployment of three MCP servers — `mcp-files`, `mcp-db`, `mcp-code` — behind a shared authorization server. Each server was a separate HTTP endpoint with a distinct resource indicator (`https://mcp-files.internal/`, etc.). A client obtained a token with `resource=https://mcp-files.internal/` and presented it to `mcp-db`. The request succeeded. Root cause: the `mcp-db` token verifier called a JWKS-based validation routine with `verify_aud=False` because the deployment's earlier single-server configuration had used a shared audience string and the flag had been carried forward. The authorization server *did* mint distinct `aud` values per resource indicator, and the JWT *did* carry `aud: ["https://mcp-files.internal/"]`. The verifier simply did not inspect it. The token was valid; it was not valid for `mcp-db`. A second observation from the same deployment: after `verify_aud` was corrected, a token captured from a debug proxy (plaintext HTTP on a loopback interface that a developer had tunneled) was replayed against `mcp-files` from a different host and accepted for the remainder of its 3600-second lifetime. The `aud` check was correct; the replay defense was absent. A third observation, subtler: two MCP server instances of the *same* logical server (`mcp-files` behind a load balancer, instances A and B) shared a resource indicator. A token minted for instance A was accepted by instance B. This is correct under resource-indicator semantics (the resource is the logical server, not the process) but surprised operators who assumed per-instance binding. The distinction matters for revocation: revoking a token at instance A does not revoke it at instance B unless revocation state is shared. ## Condition of Validity The `aud`-based binding check is only meaningful when all of the following hold: - The authorization server honors the `resource` parameter (RFC 8707) and encodes it into `aud`. If the AS ignores `resource` and issues a single static audience, the resource server cannot distinguish sibling resources by `aud` alone; it must fall back to a scope or a custom claim, and the deployment must document which. - The resource server's configured audience string matches the resource indicator *exactly*, including trailing slash, scheme, and port. A mismatch between `https://mcp-files.internal/` (indicator) and `https://mcp-files.internal` (configured audience) causes either silent acceptance (if the verifier is lenient) or total rejection (if strict). Neither is the intended behavior; the former is a security hole, the latter an availability incident. - The token is a JWT or an introspectable opaque token. For opaque tokens, the binding check moves to the introspection endpoint, which must return `aud` and the resource server must compare it. - Revocation is either not required within the token lifetime, or the resource server performs introspection per request, or a shared revocation list is consulted. A self-contained JWT with a one-hour lifetime and no introspection is, by design, unrevocable for up to one hour. Replay defense is only meaningful when the transport provides sender-constraining: DPoP (RFC 9449) with a proof-of-possession key, mTLS-bound tokens (RFC 8705), or a token lifetime short enough that the window is operationally acceptable. Bearer tokens over TLS without sender-constraining have no replay defense at the MCP layer, only at the TLS layer, and only against a network adversary who cannot terminate TLS. ## Decision Boundary The decision boundary is: **does the verifier compare the token's audience to the resource server's own identifier, and does it fail closed on mismatch?** The correct behavior is to fail closed. The common incorrect behavior is to treat `aud` as advisory and validate only signature and expiry, on the reasoning that "the issuer is trusted and the client is authenticated." That reasoning is wrong for a multi-resource deployment: the issuer is trusted to mint tokens, not to know which resource each token is for, and the client is authenticated *to the issuer*, not *to this resource*. The second decision boundary is: **is the token sender-constrained, and if not, what is the maximum replay window?** If the answer is "not constrained, 3600 seconds," the deployment has accepted a one-hour replay window and must document it. If the answer is "not constrained, 300 seconds," the window is smaller but nonzero. There is no configuration that makes an unconstrained bearer token non-replayable; the only question is the size of the window. A third boundary: **does the resource server accept tokens whose `aud` names a sibling instance?** Under resource-indicator semantics, sibling instances of the same logical server share an indicator and *should* accept each other's tokens. Instances of different logical servers *must not*. The verifier must be configured per logical server, not per process, and the configuration must be reviewed whenever a new server is added to the trust domain. ## Operational Effect The practical effect of getting the binding check wrong is lateral movement within the MCP trust domain: a token minted for a low-privilege filesystem server is accepted by a database server, and the database server's tool surface becomes reachable to a client that was never authorized for it. Because MCP tools are often stateful and side-effecting (write files, execute queries, run code), the blast radius is the union of all tool surfaces in the domain, not the single server the client was authorized for. The practical effect of getting replay defense wrong is that any observer of a request — a compromised sidecar, a misconfigured proxy, a log aggregator that captures headers, a shared CI runner — holds a working credential for the token's lifetime. Because MCP clients often run in agent loops that retry and log, tokens are frequently written to logs and trace spans; a token in a log is a replayable credential. The operational mitigations that actually work, in order of strength: 1. **Sender-constrained tokens (DPoP or mTLS).** Eliminates replay at the MCP layer. Requires client support; not all MCP clients implement DPoP. 2. **Per-request introspection with `aud` comparison.** Eliminates the unrevocable window and enforces binding at the introspection endpoint. Costs a round trip per request; acceptable for low-QPS servers, painful for high-QPS. 3. **Short-lived tokens (≤300s) with refresh.** Reduces the replay window to the refresh cadence. Requires the client to handle refresh; agent loops that do not refresh will fail mid-task. 4. **Strict `aud` validation with exact-match configuration.** Closes the lateral-movement hole. Necessary but not sufficient; does nothing for replay. The failure mode to guard against in code review: a verifier that constructs its validation call with an optional audience parameter defaulting to `None`, and a deployment that never sets it. The default must be "reject," not "accept." ```python import time from dataclasses import dataclass from typing import Optional class ResourceBindingError(RuntimeError): """Raised when a bearer token is not bound to this MCP resource server.""" class ReplayWindowExceededError(RuntimeError): """Raised when a token's remaining lifetime exceeds the accepted replay window.""" @dataclass(frozen=True) class TokenClaims: issuer: str audience: list[str] subject: str issued_at: int expires_at: int sender_constrained: bool @dataclass(frozen=True) class ResourceServerConfig: own_resource_indicator: str # e.g. "https://mcp-db.internal/" trusted_issuer: str max_replay_window_seconds: int # 0 means sender-constrained required allow_sibling_instances: bool # same logical server, different process def validate_token_for_resource( claims: TokenClaims, config: ResourceServerConfig, now: Optional[int] = None, ) -> None: now = int(time.time()) if now is None else now if claims.issuer != config.trusted_issuer: raise ResourceBindingError( f"issuer {claims.issuer!r} is not the trusted issuer " f"{config.trusted_issuer!r}" ) if claims.expires_at <= now: raise ResourceBindingError( f"token expired at {claims.expires_at}, now={now}" ) # The binding check. Fail closed: empty audience is a rejection, not a pass. if not claims.audience: raise ResourceBindingError( "token carries no audience claim; refusing to accept an unbound token" ) if config.own_resource_indicator not in claims.audience: raise ResourceBindingError( f"token audience {claims.audience!r} does not include this resource " f"{config.own_resource_indicator!r}; token was minted for a sibling " f"or unrelated resource and must not be accepted here" ) # Replay defense. An unconstrained bearer token is replayable for its # remaining lifetime; if that lifetime exceeds the configured window, # the deployment has not actually bounded the replay surface. remaining = claims.expires_at - now if not claims.sender_constrained: if config.max_replay_window_seconds <= 0: raise ReplayWindowExceededError( "sender-constrained tokens are required by policy, but this " "token is a plain bearer token" ) if remaining > config.max_replay_window_seconds: raise ReplayWindowExceededError( f"bearer token has {remaining}s remaining, exceeding the " f"accepted replay window of {config.max_replay_window_seconds}s" ) def handle_mcp_request( claims: TokenClaims, config: ResourceServerConfig, tool_name: str, ) -> dict: validate_token_for_resource(claims, config) return {"tool": tool_name, "accepted": True} ```