spring-projects / spring-projects/spring-ai
MCP (using SSE) Connection failed when API scaled up to 2 or more.
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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