feat: expose oauth discovery metadata source#1041
Merged
Merged
Conversation
DaleSeo
marked this pull request as ready for review
July 24, 2026 03:31
jamadeo
previously approved these changes
Jul 24, 2026
alexhancock
reviewed
Jul 24, 2026
| /// Nothing was discovered; the endpoints were synthesized from the base | ||
| /// URL (`/authorize`, `/token`, `/register`) for compatibility with the | ||
| /// 2025-03-26 MCP spec's default-endpoint fallback. The server gave no | ||
| /// evidence that it supports OAuth. |
Contributor
There was a problem hiding this comment.
I would include something here if we're going to have a descriptive comment that metadata discovery is now mandatory in newer versions of the spec, and there is no endpoint-synthesis fallback any more.
DaleSeo
force-pushed
the
fix/oauth-discovery-metadata-source
branch
3 times, most recently
from
July 24, 2026 15:49
4dc5ebc to
42b7fc8
Compare
DaleSeo
force-pushed
the
fix/oauth-discovery-metadata-source
branch
from
July 24, 2026 15:53
42b7fc8 to
3283594
Compare
alexhancock
approved these changes
Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #1037
Motivation and Context
The previous
AuthorizationManager::discover_metadata()method fell back to the legacy default endpoints,/authorize,/token, and/register, based on the base URL when discovery returned nothing. This fallback is required for theauth/2025-03-26-oauth-endpoint-fallbackconformance scenario. However, it made a successful fallback look the same as metadata that the server actually published. As a result, callers could not tell whether OAuth metadata was discovered or synthesized for compatibility. That behavior was originally introduced in #507 and changed by #960.This replaces that method with
AuthorizationManager::resolve_metadata(), which returnsAuthorizationMetadataResolutioncontaining both theAuthorizationMetadataand itsAuthorizationMetadataSource. “Resolve” reflects that the method may either discover server-published metadata or synthesize legacy endpoints. The source distinguishes protected resource metadata, authorization server metadata, and the legacy endpoint fallback;is_discovered()reports whether the server published metadata.Because v3 is still in beta, this makes provenance part of the primary metadata-resolution contract now instead of adding a parallel method that would need to be retained long-term. Internal SDK and conformance call sites explicitly extract
.metadata; the discovery order, legacy endpoint synthesis, and conformance behavior remain unchanged.How Has This Been Tested?
Unit tests cover all three sources
Breaking Changes
AuthorizationManager::discover_metadata()has been renamed toresolve_metadata()and now returnsResult<AuthorizationMetadataResolution, AuthError>instead ofResult<AuthorizationMetadata, AuthError>.Callers must use the new method and extract the
metadatafield when they needAuthorizationMetadatadirectly:Callers can inspect
resolution.sourceor callresolution.source.is_discovered()before consuming the metadata.Types of changes
Checklist