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

Open
#326 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Quiet
Tech stack
php

Research direction

Start by tracing the PHP client’s initialize negotiation and its handling of WWW-Authenticate when resource_metadata is absent. Implement and test the ordered discovery branches for the MCP origin and issuer-derived URL, gated on revision 2025-03-26. Verify the unit-test branches and the auth/2025-03-26-oauth-metadata-backcompat and auth/2025-03-26-oauth-endpoint-fallback conformance scenarios after blockers #317 and #318 are resolved.

Written by the indexing model from the issue text.

Description

auth Client enhancement improves spec compliance

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

Dominant language
PHP
Stars
1.6k
Forks
173
Avg merge
2d 49m
Merged PRs (30d)
23

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from modelcontextprotocol/php-sdk

All issues in modelcontextprotocol/php-sdk

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.