spring-projects / spring-projects/spring-ai

MCP (using SSE) Connection failed when API scaled up to 2 or more.

Open
#3,947 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

Bug description
MCP has endpoints of "/sse" and "mcp/message".
After /sse is called, MCP server is waiting second call of "mcp/message" from client.
However when you scaled up APIs then there will be load balancer(which means each request might go to different instance of APIs).
Instance 1 is waiting second call but instance 2 is receiving second call which will fail connection.
Is there way to share state across the multiple instances for connections?

Environment
Spring AI 1.0.0

Expected behavior
MCP connection should support on shared state so that it will support multiple instances of MCP server after scaled up.

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 with the MCP /sse and /mcp/message entry points and reproduce the failure with two API instances behind a load balancer. Trace how the connection state is held between requests; done means the same MCP connection remains usable when successive requests reach different instances.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.