modelcontextprotocol / modelcontextprotocol/java-sdk

Add X-Accel-Buffering: no Header for SSE Responses

未关闭
#293 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

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

描述

Quick Search Confirmation

I searched existing issues in this repository and did not find a duplicate request for adding X-Accel-Buffering headers to SSE responses.

Expected Behavior

When using the spring-ai-starter-mcp-server-webmvc module to handle Server-Sent Events (SSE), the framework should automatically inject the header X-Accel-Buffering: no into all SSE responses. This ensures proxy servers (e.g., Nginx) disable response buffering, allowing real-time streaming of AI-generated content (e.g., chat completions, streaming predictions) without latency.

Example of Expected Headers:
For an SSE endpoint like /stream, the response should include:

Content-Type: text/event-stream
X-Accel-Buffering: no
Current Behavior
  • Missing Header: SSE responses from spring-ai-starter-mcp-server-webmvc do not include X-Accel-Buffering: no.
  • Consequence: Proxy servers (e.g., Nginx) buffer SSE responses by default, causing:
    • Delayed delivery of real-time data (e.g., chat messages appear in batches instead of streaming).
    • Inconsistent behavior in AI applications where low latency is critical.

贡献指南

打开贡献指南

从这里开始

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

调研方向

从 issue 中描述的 spring-ai-starter-mcp-server-webmvc SSE 响应处理开始,检查 SSE 响应是如何生成的。验证 SSE 端点的响应头,然后确保完成后的行为包含 Content-Type: text/event-stream 和 X-Accel-Buffering: no,且不会进行代理缓冲。

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

评估

技术栈
java, spring
领域
api, backend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
50/100

把新 issue 发到你的邮箱

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