Title: Session ID not present in memory store should return 404, not 400 · Issue #1004 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: Session ID not present in memory store should return 404, not 400 · Issue #1004 · modelcontextprotocol/python-sdk
X Title: Session ID not present in memory store should return 404, not 400 · Issue #1004 · modelcontextprotocol/python-sdk
Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue Description When a session ID is p...
Open Graph Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this ...
X Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening t...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/1004
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Session ID not present in memory store should return 404, not 400","articleBody":"### Initial Checks\n\n- [x] I confirm that I'm using the latest version of MCP Python SDK\n- [x] I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue\n\n### Description\n\nWhen a session ID is provided by a client, but it is not present in the in-memory session store for the server, the server returns a 400 https://github.com/modelcontextprotocol/python-sdk/blob/d0443a18328a2fc9e87da6feee9130f95c0b37a7/src/mcp/server/streamable_http_manager.py#L250-L256\n\nThis is a problem, because as noted in https://github.com/modelcontextprotocol/python-sdk/issues/880 sessions are not persisted between restarts\n\nThis library should return a 404, as in https://github.com/modelcontextprotocol/python-sdk/blob/d0443a18328a2fc9e87da6feee9130f95c0b37a7/src/mcp/server/streamable_http.py#L371 So that the client can re-initialize and get a new session ID as needed (as in https://github.com/mark3labs/mcp-go/blob/8f5b048218f6d044c3322f16b8cb0b08e10bf5d0/client/transport/streamable_http.go#L257). \n\n400 isn't applicable because the request isn't _bad_, but the server simply doesn't persist sessions between restarts.\n\n### Example Code\n\n```Python\n\n```\n\n### Python \u0026 MCP Python SDK\n\n```Text\n3.10.12 and 2.3.4\n```","author":{"url":"https://github.com/sthomson-wyn","@type":"Person","name":"sthomson-wyn"},"datePublished":"2025-06-23T11:44:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/1004/python-sdk/issues/1004"}
| 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:b1077fcb-bdd3-9fad-2d6e-a138d3b031e7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A68A:3C94F8:28B222F:37D67A6:6A56D408 |
| html-safe-nonce | 0a6e49300b01b739cbc5ad2f194ce770343c5a477c2ff87a4988edbb0e7ecda9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjhBOjNDOTRGODoyOEIyMjJGOjM3RDY3QTY6NkE1NkQ0MDgiLCJ2aXNpdG9yX2lkIjoiMjA3Njc5MjI1NDc3ODIzMzg2NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5e2e7e269c9a49d24651567437ab819b601047af1f4380202a02905e3154cd67 |
| hovercard-subject-tag | issue:3167882528 |
| 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/python-sdk/1004/issue_layout |
| twitter:image | https://opengraph.githubassets.com/eb7c0278776358c0c7b999259915a67ae44c8cbb66db7acc313263b23f0ab654/modelcontextprotocol/python-sdk/issues/1004 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/eb7c0278776358c0c7b999259915a67ae44c8cbb66db7acc313263b23f0ab654/modelcontextprotocol/python-sdk/issues/1004 |
| og:image:alt | Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sthomson-wyn |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5220a278731283038daf0ed00b41f06ef7ff9539020ecc806c5c5a0fb6bda25a |
| turbo-cache-control | no-preview |
| go-import | github.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 862584018 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 862584018 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/python-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 | 952dc124c1d105aa6fc49def04bb458db95747d7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width