Skip to content

[Client] Add OAuth 2025-03-26 metadata backcompat fallback #326

Closed

Description

@soyuka

Context

Older MCP servers (spec revision 2025-03-26) do not publish /.well-known/oauth-protected-resource. The client must fall back to discovering OAuth metadata directly from the MCP server origin's /.well-known/oauth-authorization-server and, if missing, from the issuer derived by URL convention.

Scope

  • Order of operations when WWW-Authenticate lacks resource_metadata:
    1. Try /.well-known/oauth-protected-resource at MCP server origin.
    2. Try /.well-known/oauth-authorization-server at MCP server origin.
    3. Fall back to OIDC discovery (/.well-known/openid-configuration).
  • Track protocol revision negotiated during initialize; only enable fallback chain when the server announced 2025-03-26.

Conformance scenarios unblocked

auth/2025-03-26-oauth-metadata-backcompat, auth/2025-03-26-oauth-endpoint-fallback.

Dependencies

Blocked by: #317, #318.

Acceptance

  • Unit tests covering all fallback branches.
  • Conformance: 2 baseline scenarios pass.

cc @soyuka

Activity

  1. added
    ClientIssues & PRs related to the Client component
    P2Moderate issues affecting some users, edge cases, potentially valuable feature
    authIssues and PRs related to Authentication / OAuth
    improves spec complianceImproves consistency with other SDKs such as TyepScript
    enhancementRequest for a new feature that's not currently supported
    on May 19, 2026
  2. removed
    P2Moderate issues affecting some users, edge cases, potentially valuable feature
    on Aug 19, 2026
  3. chr-hertel commented on Nov 10, 2026

    @chr-hertel
    Member

    Solved with #666 - will be part of v0.10.0. It is opt-in with OAuth::setLegacyDiscovery(true).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ClientIssues & PRs related to the Client componentauthIssues and PRs related to Authentication / OAuthenhancementRequest for a new feature that's not currently supportedimproves spec complianceImproves consistency with other SDKs such as TyepScript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions