Skip to content

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

@soyuka

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    ClientIssues & PRs related to the Client componentP2Moderate issues affecting some users, edge cases, potentially valuable featureauthIssues 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
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions