modelcontextprotocol / modelcontextprotocol/python-sdk

docs: clarify when Client(raise_exceptions=True) actually raises

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

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

P3 v1 v2
主要言語
Python
スター
24.3k
フォーク
4k
平均マージ
1日 1時間
マージ済み PR(30日)
31

説明

Description

Client exposes raise_exceptions: bool = False with a code TODO asking when raise_exceptions=True actually raises:

https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/client/client.py (around the raise_exceptions field)

What's missing

There is no clear user-facing documentation of:

  1. Which failure modes are affected (in-process server exceptions vs transport/protocol errors)
  2. How this interacts with ExceptionGroup wrapping from async with Client(...)
  3. Recommended patterns vs catching MCPError inside the context manager (as docs/troubleshooting.md already teaches)
Proposed work
  • Trace current behavior on main for in-memory and HTTP clients
  • Document the real semantics in docs/client/ and/or docs/troubleshooting.md
  • Add a small docs_src example and/or regression test if behavior is surprising
  • Only change runtime behavior if docs reveal a clear bug; prefer docs-first
Related
  • TODO(Marcelo) on Client.raise_exceptions in src/mcp/client/client.py
  • #1401 ClientSession Error Handling (different surface; has an open PR)
  • troubleshooting ExceptionGroup guidance

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

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

はじめの一歩

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

調査の方向性

src/mcp/client/client.py の raise_exceptions TODO から始め、インメモリクライアントと HTTP クライアントの現在の挙動を、async with Client(...) における ExceptionGroup の処理も含めて追跡します。これを docs/troubleshooting.md のガイダンスと比較し、確認できたセマンティクスを docs/client/ および/または docs/troubleshooting.md にドキュメント化します。ユーザーが影響を受ける失敗を特定し、推奨されるパターンとコンテキストマネージャー内で MCPError を捕捉する方法のどちらかを選択できれば完了です。

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

評価

技術スタック
python
領域
documentation
issue の種類
ドキュメント
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
72/100

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

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