User-Agent header in sHTTP transport is not forwarded to auth flow
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 68/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- python
調査の方向性
examples/clients/simple-auth-client/mcp_simple_auth_client/main.py の streamablehttp_client の使用箇所、特に 214-220 行付近の headers 引数から始めて、認証フローがどのようにリクエストを構築しているかを追跡してください。カスタム User-Agent がそれらのリクエストに到達することを、AWS WAF のユースケースも含めて確認してください。完了の条件は、呼び出し元がそのルールを無効化せずに SDK 経由でヘッダーを設定できることです。
索引モデルが issue の本文から書いたものです。
説明
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
Passing a custom User-Agent header to the sHTTP transport, e.g. here does not result in auth flow requests including that user agent. There also does not appear to be any way to customize this behavior externally to the SDK itself.
In particular, this becomes a problem when working with AWS WAF, as one of its baseline rules is to require all requests to include a User-Agent header, to filter out low-grade spam.
I am currently recommending to internal teams that they disable this rule for the time being, but this is not a great solution for them, as it means removing an application guardrail to work around an SDK limitation.
Example Code
print("📡 Opening StreamableHTTP transport connection with auth...")
async with streamablehttp_client(
url=self.server_url,
auth=oauth_auth,
timeout=timedelta(seconds=60),
headers={
"User-Agent": "mcp-python-sdk/0.1.0",
},
) as (read_stream, write_stream, get_session_id):
await self._run_session(read_stream, write_stream, get_session_id)
Python & MCP Python SDK
Latest SDK commit: 27279bc (1.22.0)
Python 3.13.2
- 主要言語
- Python
- スター
- 24.3k
- フォーク
- 4k
- 平均マージ
- 1日 1時間
- マージ済み PR(30日)
- 31
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelcontextprotocol/python-sdk のほかの issue
-
v1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
modelcontextprotocol/python-sdk#3546 · コメント 4 件 ·
-
v1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
modelcontextprotocol/python-sdk#3545 · コメント 1 件 ·
-
v1 v2
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
modelcontextprotocol/python-sdk#3508 · コメント 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
modelcontextprotocol/python-sdk#3504 ·
-
v1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
modelcontextprotocol/python-sdk#3492 · コメント 1 件 ·
modelcontextprotocol/python-sdk の issue をすべて見る
似ている issue
-
link-check link-check:sphinx-theme
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
OpenHands/extensions#626 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
CSCfi/sd-search-api#39 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100