Skip to content

[Bug] POST /revoke with a FastMCP access token is a silent no-op (ownership gate never matches) #5800

Closed

Description

@BlueX888

Summary

With OAuthProxy, a client that obtained a FastMCP access token via the token endpoint cannot revoke it: POST /revoke returns 200 but is a silent no-op — the revocation request is never forwarded to the upstream IdP, and the token remains valid until its exp.

The cause is a client-id mismatch in load_access_token (fastmcp_slim/fastmcp/server/auth/oauth_proxy/proxy.py:2350). The returned AccessToken carries the upstream TokenVerifier's client_id — the upstream IdP's app id, derived from upstream claims (providers/jwt.py:568-573) — while the SDK RevocationHandler ownership gate (mcp/server/auth/handlers/revoke.py) compares it against the MCP client's DCR client_id embedded in the verified FastMCP JWT. Those two values can never be equal, so the gate rejects every FastMCP-token revocation as "not this client's token" and drops it silently. The ID-JAG and refresh-token branches already stamp the DCR client_id onto their returned tokens; only the access-token branch does not.

Concretely: a stolen or leaked FastMCP access token cannot be revoked by its owner even with correct DCR credentials, and RFC 7009's "the authorization server responds with HTTP 200 ... even if the token is already invalid" shape is preserved only by accident — nothing is ever actually revoked.

Repro

Run against an OAuthProxy backed by a test upstream IdP (in-process, using the repo's own OAuthProxy test fixtures):

  1. DCR-register a client, complete the auth code flow, obtain access + refresh tokens.
  2. POST /revoke with the FastMCP access token and the client's credentials.
  3. Observe: response 200, no request reaches the upstream /revoke endpoint (the upstream mock never matches), and introspecting the token afterwards still says active.

Unit-level view of the mismatch (both values taken from the same proxy instance):

# fastmcp_token = access token minted by the proxy for a DCR client
access = await proxy.load_access_token(fastmcp_token)
print(access.client_id)
# -> 'https://upstream-idp.example/app'   (upstream-derived app id)

payload = proxy.jwt_issuer.verify_token(fastmcp_token)  # the verified FastMCP JWT (sync; raises on invalid tokens)
print(payload["client_id"])
# -> 'dcr-client'                          (what the SDK revocation gate compares against
#                                           and what the client actually presents)

Assertion captured from the regression run on current main (commit 7f3c53e):

AssertionError: assert 'https://upst...p.example/app' == 'dcr-client'

  - dcr-client
  + https://upstream-idp.example/app

(and from the e2e run: AssertionError: The following responses are mocked but not requested: - Match POST request on https://idp.example.com/revoke — the upstream revocation endpoint was never called.)

Stamping the DCR client_id from the verified FastMCP JWT onto the returned AccessToken at the shared return point (a non-mutating model_copy(update=...), mirroring the ID-JAG/refresh branches) lets the ownership gate match, and the upstream access token is then actually POSTed to the upstream revocation endpoint ({"token": ["upstream-access-token"]}), with the FastMCP token invalidated afterwards. OIDCProxy inherits the same code path.

Activity

  1. added
    authRelated to authentication (Bearer, JWT, OAuth, WorkOS) for client or server.
    bugSomething isn't working. Reports of errors, unexpected behavior, or broken functionality.
    on Oct 17, 2026
  2. added a commit that references this issue on Nov 10, 2026
    cdec3a9
  3. added a commit that references this issue on Nov 10, 2026
    95c9608
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    authRelated to authentication (Bearer, JWT, OAuth, WorkOS) for client or server.bugSomething isn't working. Reports of errors, unexpected behavior, or broken functionality.high-priority

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions