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 摘要。