Title: McpServerSession lifecycle doesn't support distributed services · Issue #274 · modelcontextprotocol/java-sdk · GitHub
Open Graph Title: McpServerSession lifecycle doesn't support distributed services · Issue #274 · modelcontextprotocol/java-sdk
X Title: McpServerSession lifecycle doesn't support distributed services · Issue #274 · modelcontextprotocol/java-sdk
Description: This issue is closely related to #273 and could be considered as a follow up to that, but I decided to split it for convenience and readability. Consider an MCP server written with this SDK and using the StreamableHttp transport. We depl...
Open Graph Description: This issue is closely related to #273 and could be considered as a follow up to that, but I decided to split it for convenience and readability. Consider an MCP server written with this SDK and usi...
X Description: This issue is closely related to #273 and could be considered as a follow up to that, but I decided to split it for convenience and readability. Consider an MCP server written with this SDK and usi...
Opengraph URL: https://github.com/modelcontextprotocol/java-sdk/issues/274
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"McpServerSession lifecycle doesn't support distributed services","articleBody":"This issue is closely related to #273 and could be considered as a follow up to that, but I decided to split it for convenience and readability.\n\nConsider an MCP server written with this SDK and using the StreamableHttp transport. We deploy two replicas (`A` and `B`) of this server, with a load balancer in front.\n\n1. A new client application initiates a session by sending an `initialize` message, followed by a `notifications/initialized` notifications. \n2. Let's say that the Load Balancer routed both messages to replica `A`\n3. As a result, replica `A` generated a new session which Id is communicated back to the client\n4. Replica `A` now has an `McpServerSession` instance properly initialized with all the necessary client information\n \nProblem:\n \n1. Next the client sends a `tools/list` message with the obtain sessionId, but this time the load balancer routes the message to replica `B`\n2. Even though I believe it should be the server's responsibility to share the session id across replicas, the `McpServerSession` instance that lives in replica `B` has never received (and will never receive) the initialize message and notifications\n3. Although it's possible to distribute all that state and `simulate` that handshake in replica `B` (I actually did it), I think this SDK should have an OOTB support for that, or at the very least, SessionFactory methods that make it easier to generate \"ready to use\" Sessions based on previous initializations. \n","author":{"url":"https://github.com/marianogonzalez","@type":"Person","name":"marianogonzalez"},"datePublished":"2025-05-28T16:13:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":17},"url":"https://github.com/274/java-sdk/issues/274"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6465eb39-da91-0bc1-e648-39f44e28d8d0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EB32:3DDD4:D07296:115DF72:6A59A39A |
| html-safe-nonce | 94ed6612902e825ee9c324a9e2d0a4f4d9401183292d44b5ee6b249fecb60ca0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQjMyOjNEREQ0OkQwNzI5NjoxMTVERjcyOjZBNTlBMzlBIiwidmlzaXRvcl9pZCI6IjE5ODQwODg5NjM0MDIwMTU2NDMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3f5095c9b7c14ceb72ce325ed6382991efc0d97e75c6a42c7f99fc466bf5323d |
| hovercard-subject-tag | issue:3097888675 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/modelcontextprotocol/java-sdk/274/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fdd552d125454344d074686a7d4530f25600644b94cc0f66a7147f3831e18f95/modelcontextprotocol/java-sdk/issues/274 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fdd552d125454344d074686a7d4530f25600644b94cc0f66a7147f3831e18f95/modelcontextprotocol/java-sdk/issues/274 |
| og:image:alt | This issue is closely related to #273 and could be considered as a follow up to that, but I decided to split it for convenience and readability. Consider an MCP server written with this SDK and usi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | marianogonzalez |
| hostname | github.com |
| expected-hostname | github.com |
| None | a540949572872b935b393b36db38922db390ae71c859537d741b8f3eb7e545b5 |
| turbo-cache-control | no-preview |
| go-import | github.com/modelcontextprotocol/java-sdk git https://github.com/modelcontextprotocol/java-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 919609219 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/java-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 919609219 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/java-sdk |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 0b971869dd75eec26500a9de7e85b8137c6bf0f6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width