modelcontextprotocol / modelcontextprotocol/java-sdk

Current implementation of HttpServletStreamableServerTransportProvider or HttpServletSseServerTransportProvider needs strict stickyness

Open
#499 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement feature/session-storage P2
Dominant language
Java
Stars
3.7k
Forks
1.1k
Avg merge
1d 15h
Merged PRs (30d)
9

Description

Current implementations are holding mcp sessions into a in memory Map https://github.com/modelcontextprotocol/java-sdk/blob/713ee1add0e29d184224aabdf06d024ef30a2754/mcp/src/main/java/io/modelcontextprotocol/server/transport/HttpServletStreamableServerTransportProvider.java#L108
This make it mandatory to have strict stickyness "a la" browser" in a replicated/high availability environement which doesn't exist for agent (and we cannot rely on llm agents to implement this)
The feature could be

  • first very simple option an option for HttpServletStreamableServerTransportProvider.Builder to have an option to provide the map (then users can use different tools to have some shared Map)
  • create an interface to handle those sessions (with minimum operations such add, get. delete)

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 HttpServletStreamableServerTransportProvider.java around the in-memory session Map at line 108, then inspect HttpServletSseServerTransportProvider for the same session handling. Compare the proposed builder-provided Map and a session-management interface, and define which operations are required for replicated deployments without strict stickiness. Done means both servlet transports can use shared session state through a documented extension point.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, distributed-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.