| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Per the MCP Streamable HTTP transport spec, servers MUST respond with HTTP 404 when the session ID is not found. This aligns behavior with the TypeScript SDK implementation. Github-Issue: modelcontextprotocol#1727
- Replace raw dict with JSONRPCError and ErrorData types for consistency with the rest of the codebase - Use INVALID_REQUEST (-32600) error code instead of -32001, which is in the reserved JSON-RPC implementation range (see spec issue modelcontextprotocol#509) - Remove pragma: no cover and add unit test for unknown session ID - Test verifies HTTP 404 status and proper JSON-RPC error format Github-Issue:modelcontextprotocol#1727
There was a problem hiding this comment.
Thanks for the fix! I've gone ahead and used the existing type objects and added a unit test so we can get this merged
Sorry, something went wrong.
Link to tracking issue for JSON-RPC error code clarification.
…textprotocol#1808) Co-authored-by: Max Isbey <224885523+maxisbey@users.noreply.github.com>
| Back | FazBrowse Home | New Git URL |
Summary
Fixes incorrect HTTP status code returned by StreamableHTTPSessionManager when receiving requests with unknown or expired session IDs.
Per the MCP Streamable HTTP transport specification, servers MUST respond with HTTP 404 (Not Found) when the session ID is not recognized. The previous implementation returned HTTP 400 (Bad Request), which incorrectly signals a malformed request rather than a missing resource.
This change aligns the Python SDK behavior with:
Changes
Fixes #1727