modelcontextprotocol / modelcontextprotocol/php-sdk

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

オープン
#317 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

auth Client enhancement improves spec compliance
主要言語
PHP
スター
1.6k
フォーク
173
平均マージ
2日 49分
マージ済み PR(30日)
23

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

#316から始めて401フックを理解し、次にMcp\Client\Auth\ProtectedResourceMetadataDiscovererとconformance fixturesディレクトリを調査します。メタデータ検出のスコープを実装し、ユニットテストと統合テストのカバレッジを追加します。完了の条件は、記載されている4つのベースラインシナリオにパスし、resource-mismatchのバリデーションも引き続きパスすることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
php
領域
api, authentication
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。