modelcontextprotocol / modelcontextprotocol/java-sdk
I would like to maintain MCP server state persisted (sessionId)
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 1.1k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 9
Description
Now the session id is maintained in memory in a map. But since I have my MCP server multiple pods running, I would like the state to be persisted in redis or in a DB.
I would like to override the session Validator as a parameter in the HttpServletStreamableServerTransportProvider
Current Behavior
Currently only the session creation can be customised but not maintaining the state fully.
Context
I am not able to implement stateful session in a distributed setup
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 HttpServletStreamableServerTransportProvider and inspect how session creation, validation, and the in-memory session map are handled. Define an extension point for custom session validation and persistence that works across multiple pods, with Redis or a database as the target; done means stateful sessions no longer depend on one process.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, redis
- Domain
- backend, distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100