modelcontextprotocol / modelcontextprotocol/java-sdk

Resolve message endpoint path using request context path

未关闭 适合新手
#400 3 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

area/server enhancement P2
主要语言
Java
星标
3.7k
派生
1.1k
平均合并
1 天 15 小时
30 天内合并 PR
9

描述

When HttpServletSseServerTransportProvider handling the GET request to establish a new SSE connection, the message endpoint is advertised using the immutable field "baseUrl" that's set in the constructor:

// Send initial endpoint event this.sendEvent(writer, ENDPOINT_EVENT_TYPE, this.baseUrl + this.messageEndpoint + "?sessionId=" + sessionId);

This will not work if clients use a different base URL to access this servlet (e.g.: using reverse proxies). The servlet implementation should allow the request context path to be used to produce the endpoint path appropriate for that request:

// Send initial endpoint event this.sendEvent(writer, ENDPOINT_EVENT_TYPE, request.getContextPath() + this.messageEndpoint + "?sessionId=" + sessionId);

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 HttpServletSseServerTransportProvider 开始,找到用于建立新 SSE 连接并发送初始 endpoint 事件的 GET handler。跟踪 request context path 和 message endpoint 在那里如何可用,然后验证对于位于反向代理后的客户端,公布的 endpoint 使用了 context path。完成的标准是 endpoint URL 从 request 推导,而不是从不可变的 baseUrl 推导。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
api, backend
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
冷清
描述清晰度
描述清楚
新手友好度
68/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。