modelcontextprotocol / modelcontextprotocol/python-sdk

Does same-origin redirect enforcement break MCP servers behind a reverse proxy?

未關閉 適合新手
#3,504 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
Python
星號
24.3k
分支
4k
平均合併
1 天 1 小時
30 天內合併 PR
31

描述

Reading the v2.2.0 release notes: the HTTP client now fails redirects with MCPError unless the target is same-origin. For self-hosted setups this seems like it could bite people running an MCP server behind something like Caddy or nginx — e.g. an HTTP→HTTPS redirect, or a redirect from a bare port to a subpath, which often lands on a different-looking origin even though it's the same server.

The changelog doesn't say whether there's a way to allowlist additional origins for these cases, or whether the guidance is simply "don't let your reverse proxy redirect, terminate TLS and proxy_pass directly." Is there a documented escape hatch, or is this an intentional hard stop meant to force removing redirects from self-hosted deployments entirely? A line in the migration notes about the reverse-proxy case would save people a confusing debugging session when their server that worked in 2.1.x suddenly throws on upgrade.

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從 v2.2.0 發行說明以及 issue 中描述的 HTTP 用戶端重新導向強制機制開始。確認是否可以將其他 origin 加入 allowlist,以及 HTTP 到 HTTPS 的重新導向或子路徑重新導向在 reverse proxy 後方如何運作。使用已確認的 escape hatch 或針對自託管 MCP 伺服器的部署指引更新遷移說明。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
nginx, python
領域
documentation, networking
Issue 類型
文件
難度
2/5
預估耗時
1-3 小時
活躍度
活躍
描述清晰度
基本清楚
新手友好度
64/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。