mcp: support stateless connections for streamable #159
+181
−31
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.
When the client lost the connection to the mcp server or the mcp server runs on distributed nodes (e.g. behind a loadbalancer), it can be desired to run the server in stateless mode. When doing so, the Mcp-Session-Id should not generated or verified to allow the execution of methods without prior initialization.
Or would it be better to still generate the session id and send the
Mcp-Session-Id
but just not validate it?The Rust sdk, mcp-go and the typescript sdk also support it for example. Additionally, this mode is mentioned in the typescript documentation although the official documentation does not seem to contain any information about it.
Fixes #148