modelcontextprotocol / modelcontextprotocol/java-sdk

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

Open
#293 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/server enhancement good first issue P2
Dominant language
Java
Stars
3.7k
Forks
1.1k
Avg merge
1d 15h
Merged PRs (30d)
9

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the spring-ai-starter-mcp-server-webmvc SSE response handling described in the issue and inspect how SSE responses are produced. Verify the response headers for an SSE endpoint, then ensure completed behavior includes Content-Type: text/event-stream and X-Accel-Buffering: no without proxy buffering.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.