This MCP server declares a resource_server_url but does not set validate_token_resource=True on AuthSettings.
Why AI tools produce this: AI coding tools generate this anti-pattern by default, it appears in a large share of AI-written auth code.
Why this matters
Per the MCP authorization spec an OAuth 2.1 resource server MUST reject a token that was not issued for it (RFC 8707 audience binding). Left unset, validate_token_resource behaves as False, so a token minted for a DIFFERENT resource is accepted here: a confused deputy (CWE-863), the exact class behind the MCP token reuse advisories.
Set it explicitly, and keep resource_server_url the exact URL clients connect to: AuthSettings( issuer_url=ISSUER, resource_server_url=THIS_MCP_URL, validate_token_resource=True, ) If your authorization server uses its own audience identifiers (an Auth0 API identifier, an Entra application ID), check aud in your TokenVerifier instead and return None for a token that is not for this server.
Suppressing this rule
If a finding is a genuine false positive, scope the suppression to the exact line and leave a reason, never disable the rule project-wide. Disable directives are line-scoped by design.
# oauthlint-disable-next-line auth.py.mcp.token-audience-unchecked -- <reason>