Skip to content

feat: expose oauth discovery metadata source#1041

Open
DaleSeo wants to merge 1 commit into
mainfrom
fix/oauth-discovery-metadata-source
Open

feat: expose oauth discovery metadata source#1041
DaleSeo wants to merge 1 commit into
mainfrom
fix/oauth-discovery-metadata-source

Conversation

@DaleSeo

@DaleSeo DaleSeo commented Jul 24, 2026

Copy link
Copy Markdown
Member

Closes #1037

Motivation and Context

AuthorizationManager::discover_metadata() falls back to the legacy default endpoints, /authorize, /token, and /register, based on the base URL when discovery returns nothing. This fallback is required for the auth/2025-03-26-oauth-endpoint-fallback conformance scenario. However, it makes a successful fallback look the same as metadata that the server actually published. As a result, callers that use discovery to determine whether a server supports OAuth can no longer receive a NoAuthorizationSupport-style signal. That behavior was originally introduced in #507 and changed by #960.

This implements Option A from the issue: a new discover_metadata_with_source() method returns the metadata together with an AuthorizationMetadataSource, plus an is_discovered() helper. discover_metadata() now delegates to it and its docs point callers that need capability detection to the new method. Existing behavior and the conformance scenario are untouched.

How Has This Been Tested?

Unit tests cover all three sources

Breaking Changes

None

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

@github-actions github-actions Bot added T-core Core library changes T-transport Transport layer changes labels Jul 24, 2026
@DaleSeo DaleSeo self-assigned this Jul 24, 2026
@DaleSeo
DaleSeo marked this pull request as ready for review July 24, 2026 03:31
@DaleSeo
DaleSeo requested a review from a team as a code owner July 24, 2026 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-core Core library changes T-transport Transport layer changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OAuth discovery should distinguish discovered authorization metadata from synthesized legacy endpoints

1 participant