-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Open
Labels
P2Moderate issues affecting some users, edge cases, potentially valuable featureModerate issues affecting some users, edge cases, potentially valuable featurebugSomething isn't workingSomething isn't workingready for workEnough information for someone to start working onEnough information for someone to start working on
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 provided by a client, but it is not present in the in-memory session store for the server, the server returns a 400
python-sdk/src/mcp/server/streamable_http_manager.py
Lines 250 to 256 in d0443a1
else: | |
# Invalid session ID | |
response = Response( | |
"Bad Request: No valid session ID provided", | |
status_code=HTTPStatus.BAD_REQUEST, | |
) | |
await response(scope, receive, send) |
This is a problem, because as noted in #880 sessions are not persisted between restarts
This library should return a 404, as in
python-sdk/src/mcp/server/streamable_http.py
Line 371 in d0443a1
HTTPStatus.NOT_FOUND, |
400 isn't applicable because the request isn't bad, but the server simply doesn't persist sessions between restarts.
Example Code
Python & MCP Python SDK
3.10.12 and 2.3.4
Kludex, mirek-capgemini and Zalewa
Metadata
Metadata
Assignees
Labels
P2Moderate issues affecting some users, edge cases, potentially valuable featureModerate issues affecting some users, edge cases, potentially valuable featurebugSomething isn't workingSomething isn't workingready for workEnough information for someone to start working onEnough information for someone to start working on