modelcontextprotocol / modelcontextprotocol/php-sdk

[Client] Implement OAuth scope handling (WWW-Authenticate, scopes_supported, step-up, retry-limit, omitted)

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

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

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

説明

Context

Five baseline scenarios cover scope acquisition strategies the client must follow when constructing authorize/token requests:

  • auth/scope-from-www-authenticate — parse scope="<list>" from WWW-Authenticate insufficient_scope challenges and request those scopes on next authorize.
  • auth/scope-from-scopes-supported — when no challenge hint, fall back to scopes_supported from AS metadata.
  • auth/scope-omitted-when-undefined — when neither source provides scopes, omit the scope parameter entirely (do not send empty string).
  • auth/scope-step-up — on 403/401 with error=insufficient_scope, restart auth flow requesting the augmented scope set.
  • auth/scope-retry-limit — bound step-up retries to one to prevent infinite loops.

Scope

  • Mcp\Client\Auth\ScopeResolver consulted by AuthCoordinator before every authorize/token request.
  • WwwAuthenticateParser returning scope, error, error_description, resource_metadata.
  • Step-up retry counter held in AuthCoordinator state.

Conformance scenarios unblocked

All 5 scope scenarios above.

Dependencies

Blocked by: #316 (401 plumbing), #318 (AS metadata), #319 (Auth Code flow).

Acceptance

  • Unit tests per resolution path.
  • Conformance: 5 baseline scenarios pass.

cc @soyuka

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

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

はじめの一歩

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

調査の方向性

まず Mcp\Client\Auth\ScopeResolver と AuthCoordinator から始め、次に WwwAuthenticateParser と名前付きの5つのコンフォーマンスシナリオを調べます。省略された scope を含め、scope 解決の各経路を検証し、insufficient_scope に対する step-up の再試行が1回に制限されていることを確認します。ユニットテストと5つすべてのベースラインシナリオがパスする必要があります。

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

評価

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

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

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