fix: improve streamable HTTP session reinitialization #469
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements the MCP spec guidelines for streamable HTTP (re)initialization:
Changes:
Fixes #459
Motivation and Context
This change addresses issue #459 and implements the MCP specification requirements for streamable HTTP (re)initialization:
McpTransportSessionNotFoundException
for any 404/400 response, even when no session ID was present, which didn't align with the spec.McpError
for transport-layer issues made it difficult to distinguish between different error types and handle them appropriately.This fix ensures proper session reinitialization flow where clients can detect terminated sessions (404 with session ID) and start fresh sessions without an ID.
How Has This Been Tested?
Breaking Changes
Minor breaking changes for users who catch specific exception types:
McpError
for transport errors will need to catchMcpTransportException
insteadTypes of changes
Checklist