modelcontextprotocol / modelcontextprotocol/python-sdk
ClientAuthenticator ignores token_endpoint_auth_method="none" when client_secret is stored
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 24.3k
- フォーク
- 4k
- 平均マージ
- 1日 1時間
- マージ済み PR(30日)
- 31
説明
Initial Checks
- I confirm that I'm using the latest version of MCP Python SDK
- I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue
Description
ClientAuthenticator behavior is only partially honoring token_endpoint_auth_method="none":
Essentially:
token_endpoint_auth_method="none"=> skip extracting credentials from the request (correct)client.client_secretexists => raise error if no credentials were extracted from the request (incorrect)
If token_endpoint_auth_method="none" is set, it should never be checking for a client_secret value on the request, regardless of whether a secret has ever been generated for the client.
Suggested fix is to condition the client.client_secret check on token_endpoint_auth_method not being none:
if token_endpoint_auth_method != "none" and client.client_secret: # pragma: no branch
if not request_client_secret:
raise AuthenticationError("Client secret is required") # pragma: no cover
Example Code
Python & MCP Python SDK
1.25.0
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
src/mcp/server/auth/middleware/client_auth.py のリンク先の ClientAuthenticator ロジックから始めます。クライアントシークレットが保存されている一方で token_endpoint_auth_method が none であるケースを再現し、このメソッドではリクエストの認証情報が不要であり、他のメソッドではチェックが維持されることを確認します。この動作を対象とする関連する認証テストを追加または更新します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- authentication
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 静か
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 72/100