modelcontextprotocol / modelcontextprotocol/java-sdk

I would like to maintain MCP server state persisted (sessionId)

Open
#738 2 comments 3 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

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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.