Skip to content

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

Open
wants to merge 8 commits into
base: ihrpr/streamablehttp-server
Choose a base branch
from

Conversation

ihrpr
Copy link
Contributor

@ihrpr ihrpr commented Apr 21, 2025

  • Adding support for stateless servers using StreamableHttp transport. Each request is independent and does not require initialization.
  • Adding an example of stateless server with streamable http transport.

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

  • Support GET SSE
  • Streamable Http Client
  • Resumability

Stacked on top of #553

Copy link
Contributor

@jerome3o-anthropic jerome3o-anthropic left a 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.

# 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,
Copy link
Contributor

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

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants