-
Notifications
You must be signed in to change notification settings - Fork 1.1k
StreamableHttp - stateless server support #554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: ihrpr/streamablehttp-server
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question around initialization, also tests for this would be good.
examples/servers/simple-streamablehttp-stateless/mcp_simple_streamablehttp_stateless/server.py
Outdated
Show resolved
Hide resolved
src/mcp/server/lowlevel/server.py
Outdated
# When True, the server will wait for the client to send an initialization | ||
# message before processing any other messages. | ||
# False should be used for stateless servers. | ||
require_initialization: bool = True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit / question] should we just spoof the initialization on these requests with capabilities that a stateless server would have (i.e. capabilities={})? that way the life cycle of the mcp server is still spec compliant - it's a bit of a pointless dance though, so I'm happy to leave it as you have it.
The code as it stands feels like this could be interpreted as initialization being optional - that's my main concern
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd probaly change the name, require_initialization
sounds like we are skipping the protocol requirement on intialization
Tested with multi-client test script in Typescript introduced in this PR
uv run mcp-simple-streamablehttp-stateless --log-level DEBUG
uv run mcp-simple-streamablehttp-stateless --json-response
Follow ups
Stacked on top of #553