Skip to content

Conversation

@findleyr
Copy link
Contributor

@findleyr findleyr commented Aug 15, 2025

Several improvements for the stateless streamable mode, plus support for
a 'distributed' (or rather, distributable) version of the stateless
server.

  • Add a 'Stateless' option to StreamableHTTPOptions and
    StreamableServerTransport, which controls stateless behavior.
    GetSessionID may still return a non-empty session ID.
  • Audit validation of stateless mode to allow requests with a session
    id. Propagate this session ID to the temporary connection.
  • Peek at requests to allow 'initialize' and 'initialized' requests to go through to the
    session, so that version negotiation can occur (FIXME: add tests).

Fixes #284
Fixes #10
Updates #148

Copy link

@BC-ACherednichenko BC-ACherednichenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I checked a quick implementation on top of this PR, works as expected!

findleyr added a commit to findleyr/go-sdk that referenced this pull request Aug 18, 2025
A few problems with reconnection cropped up in the review of PR modelcontextprotocol#307.
We should allow for the hanging GET to fail with StatusMethodNotAllowed.
This simply means that the server does not support sending notifications
or requests over the GET, which is allowed in the spec.

Also, we should fix the initial delay of the hanging GET request: it
should start with 0 delay. Fix the math for this and subsequent
attempts. Incidentally, this makes the tests take 3s on my machine, down
from 9s.

Also address some comments from modelcontextprotocol#307.
@findleyr findleyr mentioned this pull request Aug 19, 2025
6 tasks
jba
jba previously approved these changes Aug 20, 2025
The next CL will test stateless and distributable server transport
configurations, using the HTTP testing strategy of
TestStreamableServerTransport.
Several improvements for the stateless streamable mode, plus support for
a 'distributed' (or rather, distributable) version of the stateless
server.

- Add a 'Stateless' option to StreamableHTTPOptions and
  StreamableServerTransport, which controls stateless behavior.
  GetSessionID may still return a non-empty session ID.
- Audit validation of stateless mode to allow requests with a session
  id. Propagate this session ID to the temporary connection.
- Peek at requests to allow 'initialize' requests to go through to the
  session, so that version negotiation can occur (FIXME: add tests).

Fixes modelcontextprotocol#284
For modelcontextprotocol#148
findleyr added a commit to findleyr/go-sdk that referenced this pull request Aug 20, 2025
A few problems with reconnection cropped up in the review of PR modelcontextprotocol#307.
We should allow for the hanging GET to fail with StatusMethodNotAllowed.
This simply means that the server does not support sending notifications
or requests over the GET, which is allowed in the spec.

Also, we should fix the initial delay of the hanging GET request: it
should start with 0 delay. Fix the math for this and subsequent
attempts. Incidentally, this makes the tests take 3s on my machine, down
from 9s.

Also address some comments from modelcontextprotocol#307.
A few problems with reconnection cropped up in the review of PR modelcontextprotocol#307.
We should allow for the hanging GET to fail with StatusMethodNotAllowed.
This simply means that the server does not support sending notifications
or requests over the GET, which is allowed in the spec.

Also, we should fix the initial delay of the hanging GET request: it
should start with 0 delay. Fix the math for this and subsequent
attempts. Incidentally, this makes the tests take 3s on my machine, down
from 9s.

Also address some comments from modelcontextprotocol#307.
@findleyr findleyr merged commit 1a54234 into modelcontextprotocol:main Aug 20, 2025
5 checks passed
yasomaru pushed a commit to yasomaru/go-sdk that referenced this pull request Aug 28, 2025
A few problems with reconnection cropped up in the review of PR modelcontextprotocol#307.
We should allow for the hanging GET to fail with StatusMethodNotAllowed.
This simply means that the server does not support sending notifications
or requests over the GET, which is allowed in the spec.

Also, we should fix the initial delay of the hanging GET request: it
should start with 0 delay. Fix the math for this and subsequent
attempts. Incidentally, this makes the tests take 3s on my machine, down
from 9s.

Also address some comments from modelcontextprotocol#307.
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.

Fail requests immediately in 'stateless' mode Streamable HTTP support

4 participants