[Client] Implement Protected Resource Metadata discovery (RFC 9728)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- php
- Domain
- api, authentication
Research direction
Start with #316 to understand the 401 hook, then inspect Mcp\Client\Auth\ProtectedResourceMetadataDiscoverer and the conformance fixtures directory. Implement the metadata discovery scope and add unit and integration coverage; done means the four listed baseline scenarios pass and resource-mismatch validation remains passing.
Written by the indexing model from the issue text.
Description
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-Authenticateforresource_metadata. - GET the URL, parse JSON.
- Resolve
authorization_servers[],bearer_methods_supported,scopes_supported,resource(audience).
- Parse
- Validate
resourcematches the MCP server origin (defense-in-depth forauth/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
- Dominant language
- PHP
- Stars
- 1.6k
- Forks
- 173
- Avg merge
- 2d 49m
- Merged PRs (30d)
- 23
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelcontextprotocol/php-sdk
-
[Server] Handler type uses bare Closure, hard to decorate RegistryInterface under strict PHPStan OpenServer
Difficulty 1/5 Under an hour Newbie friendliness 78/100
modelcontextprotocol/php-sdk#468 · 2 comments ·
-
needs confirmation needs maintainer action Server
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
modelcontextprotocol/php-sdk#398 · 1 reaction ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
modelcontextprotocol/php-sdk#370 ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 55/100
modelcontextprotocol/php-sdk#510 · 1 comment ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 45/100
modelcontextprotocol/php-sdk#504 ·
All issues in modelcontextprotocol/php-sdk
Similar issues
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·
-
0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nextcloud/fulltextsearch#1011 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
phpstan/phpstan-doctrine#794 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Automattic/static-site-importer#1767 ·