# How does an instance detect audience-binding failure when an MCP resource server accepts a token minted for a sibling resource **Date of Record:** 2026 December 1 **Scope:** Applies to MCP servers acting as OAuth 2.1 resource servers that validate bearer tokens issued by a shared authorization server (AS), especially when multiple MCP resource servers (e.g., `filesystem`, `git`, `browser`) are registered against one AS and clients use dynamic client registration (DCR). Does not apply to single-resource deployments with a dedicated AS per server, nor to mTLS-bound tokens where audience is cryptographically pinned at the transport layer. ## Core Distinction The distinction that matters here is between **token validity** and **token applicability**. OAuth 2.1 resource servers are required (RFC 8707 / RFC 9068) to verify that the token's `aud` claim names *this* resource server, not merely that the signature verifies and `exp` is in the future. In MCP deployments, the failure is not that a token is forged or expired—it is that a structurally valid token, minted by the trusted AS, for a *sibling* MCP server under the same AS, is presented to the wrong resource server. The token "works" in every check except the one that was omitted: audience binding. The non-obvious part is *why* this happens specifically under DCR. When a client self-registers, it typically requests multiple scopes and the AS issues a token whose `aud` is set from the `resource` parameter (RFC 8707). If the client omits `resource` on the authorization request—common when the MCP client library defaults to a single AS base URL—the AS may fall back to issuing a token with `aud` equal to the client ID or the AS issuer, or with no `aud` at all. A resource server that only checks signature + `exp` + `scope` will accept it. The boundary failure is the silent acceptance of an under-specified audience. ## What Was Observed A three-server MCP deployment (`fs`, `git`, `browser`) shared one AS. A client performed DCR once, received a `client_id`, and requested a token with `scope=read:files write:git`. The authorization request carried `resource=https://fs.mcp.local` (correct) but the token response's `aud` was `["https://fs.mcp.local"]` only. The client then reused that same access token when calling `git.mcp.local`, because the MCP client transport cached one bearer token per AS, not per resource server. The `git` server: 1. Fetched JWKS from the shared AS — signature valid. 2. Checked `exp` — valid for 47 more minutes. 3. Checked `scope` — `write:git` present. 4. Checked `aud` — **not checked**, because the server's config had `audience_check: false` (a default inherited from a template that assumed a dedicated AS). Result: a token scoped for `fs` authorized a `write:git` operation. The trace showed no error. The only signal was a downstream audit log where the same `jti` appeared against two different `resource` endpoints within 12 seconds. The inverse case also appeared: a token with `aud=["https://git.mcp.local"]` was presented to `fs`, which *did* enforce `aud`, and rejected it with `invalid_token` — but the client library interpreted the 401 as "refresh needed," re-ran DCR (creating a *second* client registration), and looped. DCR amplification: each rejected audience mismatch spawned a new `client_id`, exhausting the AS's registration rate limit within 90 seconds. ## Condition of Validity The invariant that must hold for a multi-resource MCP deployment to be safe: > For every access token `T` presented to resource server `R`, `T.aud` MUST contain `R`'s canonical resource identifier, and `R` MUST reject `T` otherwise with `401 invalid_token` and a `WWW-Authenticate` header naming the correct `resource`. This is valid only when: (a) the AS honors RFC 8707 `resource` on both authorization and token requests; (b) every resource server has a stable, canonical `resource` URI registered with the AS; (c) the client sends `resource` per-request rather than caching one token per AS. If any of (a)–(c) is false, the invariant is unenforceable and the deployment must fall back to per-server AS instances (one AS per MCP server), which restores binding by construction. ## Decision Boundary The boundary is between **shared-AS multi-resource** and **per-resource AS**. Choose shared-AS only if you can enforce all three conditions above and you can prove it with a negative test: mint a token for `fs`, present it to `git`, assert `401`. If you cannot run that test in CI, you are in the per-resource-AS regime whether you know it or not. A second boundary: **DCR reuse vs. re-registration on 401**. A client that re-registers on every `invalid_token` will amplify any audience bug into a registration storm. The correct client behavior on `401 invalid_token` with an `aud` mismatch is to *re-authorize with the correct `resource`*, not to re-register. Re-registration is only correct on `invalid_client`. ## Operational Effect The practical effect is a **silent privilege widening**: a token minted for a read-only resource server authorizes writes on a sibling because the sibling never checked `aud`. This is not a signature failure, not an expiry failure, and not a scope failure—it passes every check the server was configured to run. Detection requires an out-of-band signal: the same `jti` appearing against two `resource` values in the AS's token-introspection or audit log, or a resource server that logs the presented `aud` alongside the request and flags `aud != self`. The mitigation is threefold: (1) set `audience_check: true` and pin each server's canonical `resource` URI in config; (2) have the client send `resource` on every authorization request and cache tokens keyed by `(client_id, resource)`, not by AS; (3) instrument the resource server to emit `aud` on every request and alert when `aud` does not contain the server's own URI. The last is the only one that catches the failure when config drifts. ```python import time from dataclasses import dataclass from typing import Optional class AudienceBindingError(RuntimeError): """Raised when a token's aud claim does not name this resource server.""" pass class DCRReRegistrationStorm(RuntimeError): """Raised when a client re-registers on an audience mismatch instead of re-authorizing.""" pass @dataclass class Token: jti: str aud: list[str] exp: int scope: list[str] client_id: str def validate_token_for_resource( token: Token, resource_uri: str, audience_check_enabled: bool, registration_count_window: int, window_seconds: int = 90, ) -> None: now = int(time.time()) if token.exp <= now: raise AudienceBindingError(f"token {token.jti} expired at {token.exp}") if not audience_check_enabled: # The dangerous default: signature+exp+scope pass, aud is ignored. # We refuse to silently accept; surface the misconfiguration instead. raise AudienceBindingError( f"audience_check disabled for {resource_uri}; cannot validate aud of {token.jti}. " "Refusing to authorize under shared-AS deployment." ) if resource_uri not in token.aud: raise AudienceBindingError( f"token {token.jti} aud={token.aud} does not contain {resource_uri}" ) # Guard against DCR amplification: a client re-registering on 401 is a storm. if registration_count_window > 2: raise DCRReRegistrationStorm( f"client {token.client_id} registered {registration_count_window} times " f"in {window_seconds}s; likely re-registering on audience mismatch. " "Client must re-authorize with correct `resource`, not re-register." ) def handle_request(token: Token, resource_uri: str, audience_check_enabled: bool, registration_count_window: int = 0) -> None: try: validate_token_for_resource( token, resource_uri, audience_check_enabled, registration_count_window ) except AudienceBindingError as e: # Emit 401 invalid_token with WWW-Authenticate naming the correct resource. raise AudienceBindingError( f"401 invalid_token; WWW-Authenticate: Bearer resource={resource_uri}; detail={e}" ) from e if __name__ == "__main__": # Negative test that must exist in CI for any shared-AS deployment: fs_token = Token(jti="abc", aud=["https://fs.mcp.local"], exp=int(time.time()) + 600, scope=["write:git"], client_id="client-1") try: handle_request(fs_token, "https://git.mcp.local", audience_check_enabled=True) except AudienceBindingError as e: print("PASS: cross-resource token rejected ->", e) ```