modelcontextprotocol / modelcontextprotocol/php-sdk

[Client] Implement OAuth 2.0 Authorization Code flow with PKCE (RFC 6749 + RFC 7636)

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

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

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

説明

Context

Primary user-facing flow. Required for any interactive MCP client to obtain tokens after PRM/AS discovery.

Scope

  • Mcp\Client\Auth\Grant\AuthorizationCodeGrant:
    • Generate PKCE code_verifier + code_challenge (S256).
    • Build authorize URL with client_id, redirect_uri, response_type=code, code_challenge, code_challenge_method, scope, state, resource (audience-binding RFC 8707).
    • Pluggable user-agent dispatcher: callback hook so library users can open a browser / present URL in CLI.
    • Local loopback redirect listener (default) or custom redirect handler.
    • Exchange code → tokens at token_endpoint; persist via TokenStorageInterface.
  • Verify state round-trip; reject mismatched.

Conformance scenarios unblocked

auth/basic-cimd and prerequisite for all scope/refresh/cross-app scenarios.

Dependencies

Blocked by: #315, #316, #317, #318. Pairs with #319 (token endpoint auth methods).

Acceptance

  • Unit tests for PKCE generation + state validation.
  • Conformance: auth/basic-cimd passes.

cc @soyuka

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

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

はじめの一歩

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

調査の方向性

まず依存関係 #315、#316、#317、#318 を確認し、次に Mcp\Client\Auth\Grant\AuthorizationCodeGrant と TokenStorageInterface を調査します。user-agent と redirect-handler の統合を定義する前に、認可エンドポイントとトークンエンドポイントを追跡します。PKCE と state 検証のユニットテストに合格し、auth/basic-cimd 適合シナリオに合格すれば完了です。

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

評価

技術スタック
php
領域
authentication
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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