Skip to content

[Client] Implement Protected Resource Metadata discovery (RFC 9728) #317

Open

Description

@soyuka

Context

Per the MCP authorization spec (2025-06-18+), an unauthenticated client receiving a 401 MUST parse WWW-Authenticate: Bearer resource_metadata="<url>", fetch the indicated /.well-known/oauth-protected-resource document, and use it to locate the authorization server.

Scope

  • Mcp\Client\Auth\ProtectedResourceMetadataDiscoverer:
    • Parse WWW-Authenticate for resource_metadata.
    • GET the URL, parse JSON.
    • Resolve authorization_servers[], bearer_methods_supported, scopes_supported, resource (audience).
  • Validate resource matches the MCP server origin (defense-in-depth for auth/resource-mismatch, already passing).

Conformance scenarios unblocked

auth/metadata-default, auth/metadata-var1, auth/metadata-var2, auth/metadata-var3, auth/basic-cimd.

Dependencies

Blocked by: #316 (Bearer injection plumbs the 401 hook).

Acceptance

  • Unit + integration tests against fixtures from the conformance fixtures dir.
  • Conformance: 4 baseline scenarios above pass.

cc @soyuka

Activity

  1. added
    ClientIssues & PRs related to the Client component
    P1Significant bug affecting many users, highly requested 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
    P1Significant bug affecting many users, highly requested feature
    on Aug 19, 2026
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