add client_id_metadata_document_supported flag #1993
+30
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The MCP SDK's OAuth implementation currently only supports Dynamic Client Registration (DCR) for obtaining client credentials. While the
OAuthMetadataschema includes theclient_id_metadata_document_supportedfield (per RFC 7591 Section 3.3), this field is never populated inbuild_metadata(), preventing clients from using URL-based client IDs as an alternative to DCR.This limitation means:
client_idvaluesclient_idvia dynamic registrationclient_iditself is an HTTPS URL pointing to client metadataChanges
This PR adds
client_id_metadata_document_supportedas an optional field inClientRegistrationOptions:When enabled, the OAuth authorization server metadata will advertise support for URL-based client IDs, allowing clients to skip dynamic registration by providing an HTTPS URL as their
client_id.Benefits
client_idvalues across restartsFalse, preserving existing DCR-only behaviorExample Usage
Clients can then query
/.well-known/oauth-authorization-serverand see:{ "issuer": "https://example.com", "client_id_metadata_document_supported": true, ... }