Skip to content

fix(auth): discover path-appended OAuth metadata#887

Open
jstar0 wants to merge 1 commit into
modelcontextprotocol:mainfrom
jstar0:fix/oauth-metadata-path-append
Open

fix(auth): discover path-appended OAuth metadata#887
jstar0 wants to merge 1 commit into
modelcontextprotocol:mainfrom
jstar0:fix/oauth-metadata-path-append

Conversation

@jstar0
Copy link
Copy Markdown

@jstar0 jstar0 commented Jun 4, 2026

Fixes #878.

Summary

  • add the OAuth path-appended discovery URL for issuers with path components
  • keep OAuth authorization-server metadata discovery ahead of OpenID Connect fallback candidates
  • add regression coverage for both the candidate ordering and a real client credentials discovery flow

Changes

For a resource URL such as https://example.com/mcp, the direct authorization-server discovery list already included:

  • https://example.com/.well-known/oauth-authorization-server/mcp
  • https://example.com/.well-known/openid-configuration/mcp
  • https://example.com/mcp/.well-known/openid-configuration
  • https://example.com/.well-known/oauth-authorization-server

It did not try:

  • https://example.com/mcp/.well-known/oauth-authorization-server

This updates the candidate builder to include that OAuth path-appended URL before the OpenID Connect fallback variants. The canonical OAuth fallback remains last.

Verification

cargo test -p rmcp --features auth generate_discovery_urls
cargo test -p rmcp --features auth --test test_client_credentials test_client_credentials_discovers_path_append_oauth_metadata
cargo test -p rmcp --features auth
cargo test --all-features

@jstar0 jstar0 requested a review from a team as a code owner June 4, 2026 16:30
@github-actions github-actions Bot added T-test Testing related changes T-core Core library changes T-transport Transport layer changes labels Jun 4, 2026
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-test Testing related changes T-transport Transport layer changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement SEP-2351: RFC 8414 well-known URI suffix handling

1 participant