Skip to content

Conversation

@tanish111
Copy link
Contributor

@tanish111 tanish111 commented Dec 21, 2025

Motivation and Context

Previously, discovery only tried OAuth 2.0 Authorization Server Metadata endpoints.
Now follows the spec-mandated priority order (​Version 2025-11-25 Section 4.3 Authorization Server Metadata Discovery):

  • For URLs with path components: OAuth with path insertion → OpenID Connect with path insertion → OpenID Connect with path appending
  • For URLs without path components: OAuth → OpenID Connect
    This ensures interoperability with both OAuth 2.0 and OpenID Connect Discovery 1.0 specifications.

How Has This Been Tested?

Added unit tests for discovery URL generation covering root URLs, single/multiple path segments, and trailing slashes. All existing tests pass;

Breaking Changes

No

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

Additional context

#597
Typescript Implementation

Previously only tried OAuth 2.0 endpoints. Now tries OAuth first, then
OpenID Connect Discovery 1.0 in the spec-mandated priority order.

Signed-off-by: tanish111 <[email protected]>
@github-actions github-actions bot added T-core Core library changes T-transport Transport layer changes labels Dec 21, 2025
Reformat assert_eq! statements to satisfy rustfmt checks in CI.

Signed-off-by: tanish111 <[email protected]>
@tanish111
Copy link
Contributor Author

@alexhancock @jokemanfire I identified a minor violation in the metadata discovery priority order and implemented a fix.
Requesting you to review it.

@tanish111
Copy link
Contributor Author

This will also be required to add full support for OpenID Connect and to implement SEP-990.

@tanish111
Copy link
Contributor Author

@alexhancock @jokemanfire I identified a minor violation in the metadata discovery priority order and implemented a fix. Requesting you to review it.

Follow up.

@alexhancock alexhancock merged commit 61f7b7b into modelcontextprotocol:main Jan 9, 2026
11 checks passed
@alexhancock
Copy link
Collaborator

@tanish111 Thanks. Sorry for the delay in review

@tanish111
Copy link
Contributor Author

@alexhancock thanks for looking at it.
Also I want to explore the codebase and find such issues so would not be committing for next 2 weeks atleast.

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.

2 participants