v0.14 is out: a mobile auth pack for Swift/iOS and Android, catching insecure token storage, cleartext traffic, and OAuth in embedded WebViews. Read more →
HIGH AI PREVALENCE: HIGH auth.py.mcp.token-passthrough

An MCP server forwards the INCOMING caller token to an upstream API (token pass-through).

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

The token was issued for THIS server as its audience (RFC 8707); replaying it against another resource server is a confused-deputy vulnerability (CWE-863). The MCP authorization spec is explicit: a resource server MUST NOT accept or transit a token that was not issued for it.

Never send get_access_token().token / access_token.token / the raw Authorization header upstream. Do a token exchange (RFC 8693) or use a credential minted for the upstream audience, and send THAT token: upstream = await exchange_token(access_token.token, audience=UPSTREAM) await client.get(UPSTREAM, headers={"Authorization": f"Bearer {upstream}"})

VULNERABLE
vulnerable.py
async def call_upstream(access_token, client):
    # ruleid: auth.py.mcp.token-passthrough
    return await client.get(
        "https://api.github.com/user",
        headers={"Authorization": f"Bearer {access_token.token}"},
    )
SAFE
safe.py
async def call_upstream(access_token, client):
    # ok: auth.py.mcp.token-passthrough
    upstream = await exchange_token(access_token.token, audience="https://api.upstream.com")
    return await client.get(
        "https://api.upstream.com/x",
        headers={"Authorization": f"Bearer {upstream}"},
    )

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-passthrough -- <reason>

References

https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization ↗https://datatracker.ietf.org/doc/html/rfc8693 ↗https://datatracker.ietf.org/doc/html/rfc8707 ↗