You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
OpenIdProviderDiscoveryMetadataSchema strips revocation_endpoint, so clients can't revoke against OIDC-only authorization servers #3213
When authorization server metadata comes from OpenID Connect discovery, parsing it with OpenIdProviderDiscoveryMetadataSchema silently drops revocation_endpoint, along with any other RFC 8414 field that isn't declared. A client that later looks for revocation_endpoint concludes the server doesn't support revocation, even though the discovery document lists it.
Where
src/shared/auth.ts in @modelcontextprotocol/sdk 1.32.2 (with zod 4.6.7):
OpenIdProviderMetadataSchema is a z.looseObject, but spreading .shape into a plain z.object drops the loose behaviour. In zod v4, unknown keys are stripped.
The only OAuth metadata field picked in is code_challenge_methods_supported.
So the parsed result never contains revocation_endpoint.
Impact
Some authorization servers publish metadata only through OpenID discovery and return an error for the RFC 8414 paths. Amazon Cognito is one. Against those servers, clients built on the SDK never revoke on logout.
We see this in Claude Code 2.1.328: claude mcp logout <server> deletes the local credentials but logs Server does not support token revocation, and no revoke request reaches the server. The discovery document does list revocation_endpoint.
By contrast, anthropics/claude-code#105134 reports that logout does send revoke requests for servers that serve RFC 8414 metadata. That fits this being specific to the OpenID discovery path.
(Run against 1.32.2: the first line prints undefined, the second prints the URL.)
Suggested fix
Either:
keep unknown keys, by building the schema with z.looseObject({...}) or .loose(); or
spread the optional RFC 8414 fields that OpenID discovery documents commonly carry, such as revocation_endpoint, introspection_endpoint and revocation_endpoint_auth_methods_supported.
Related:#2733 and #2734 (the same schema, about over-strict validation rather than dropped fields), and the closed #739 (a client revocation helper).
Thanks for the write-up — the repro and the "loose behaviour disappears when you spread .shape into z.object" diagnosis were both right and made this quick to fix.
I've opened #3214 against v1.x: the schema is a z.looseObject again, and the three RFC 7009 revocation fields are picked from OAuthMetadataSchema so they arrive typed (and keep the javascript:/data:/vbscript: URL guard). Undeclared fields now pass through instead of being stripped, so the parsed metadata no longer contradicts the discovery document.
One note for your client: discoverAuthorizationServerMetadata() returns the parsed metadata as AuthorizationServerMetadata, so after this lands revocation_endpoint will be there for OIDC-only servers — worth re-checking your revocation path against it once a release ships.
Great to see #3214 addressing the schema stripping for v1.x! For teams building production MCP clients and gateways that manage token lifecycles against OIDC-only servers (e.g. Amazon Cognito, Okta, Keycloak), preserving revocation_endpoint is the essential prerequisite.
When executing the actual revocation request against the newly preserved endpoint, we encountered three IdP interoperability details worth keeping in mind:
Different IdPs support different authentication schemes for the revocation endpoint (revocation_endpoint_auth_methods_supported):
Cognito & public clients: Often expect client_id in the form body (client_secret_post style without secret) or reject Basic auth headers if no secret exists.
Confidential clients / Okta / Keycloak: Expect HTTP Basic auth (Authorization: Basic base64(client_id:client_secret)).
Checking metadata.revocation_endpoint_auth_methods_supported before selecting the header vs body strategy avoids unexpected 401 Unauthorized responses during logout.
3. RFC 7009 §2.2 Status Code Handling
Under RFC 7009 §2.2:
The authorization server responds with HTTP status code 200 if the token has been revoked successfully or if the client submitted an invalid token.
Some IdPs return HTTP 200 with an empty body, while others return HTTP 204 No Content. Clients should treat any 200 or 204 as successful termination, and avoid attempting to parse JSON bodies on empty success responses.
Disclosure: I maintain MCP Production Kit, an open-source hardening suite for MCP servers. We implemented and verified this OIDC discovery preservation and RFC 7009 token revocation lifecycle in our test suite (Module 29).
Activity
fix(auth): keep OAuth revocation fields in OIDC discovery metadata
fix(auth): keep OAuth revocation fields in OIDC discovery metadata
marcus-beauregard commentedon Nov 19, 2026
Thanks for the write-up — the repro and the "loose behaviour disappears when you spread
.shapeintoz.object" diagnosis were both right and made this quick to fix.I've opened #3214 against
v1.x: the schema is az.looseObjectagain, and the three RFC 7009 revocation fields are picked fromOAuthMetadataSchemaso they arrive typed (and keep thejavascript:/data:/vbscript:URL guard). Undeclared fields now pass through instead of being stripped, so the parsed metadata no longer contradicts the discovery document.One note for your client:
discoverAuthorizationServerMetadata()returns the parsed metadata asAuthorizationServerMetadata, so after this landsrevocation_endpointwill be there for OIDC-only servers — worth re-checking your revocation path against it once a release ships.A7mdMe commentedon Nov 21, 2026
Client-Side RFC 7009 Revocation Handling & IdP Interop Considerations
Great to see #3214 addressing the schema stripping for
v1.x! For teams building production MCP clients and gateways that manage token lifecycles against OIDC-only servers (e.g. Amazon Cognito, Okta, Keycloak), preservingrevocation_endpointis the essential prerequisite.When executing the actual revocation request against the newly preserved endpoint, we encountered three IdP interoperability details worth keeping in mind:
1. Form-Urlencoded Encoding & Parameter Passing
RFC 7009 §2.1 mandates
application/x-www-form-urlencoded:2. Client Authentication Methods
Different IdPs support different authentication schemes for the revocation endpoint (
revocation_endpoint_auth_methods_supported):client_idin the form body (client_secret_poststyle without secret) or reject Basic auth headers if no secret exists.Authorization: Basic base64(client_id:client_secret)).Checking
metadata.revocation_endpoint_auth_methods_supportedbefore selecting the header vs body strategy avoids unexpected401 Unauthorizedresponses during logout.3. RFC 7009 §2.2 Status Code Handling
Under RFC 7009 §2.2:
Some IdPs return HTTP 200 with an empty body, while others return HTTP 204 No Content. Clients should treat any 200 or 204 as successful termination, and avoid attempting to parse JSON bodies on empty success responses.
Disclosure: I maintain MCP Production Kit, an open-source hardening suite for MCP servers. We implemented and verified this OIDC discovery preservation and RFC 7009 token revocation lifecycle in our test suite (Module 29).