FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

StreamableHttp - GET request standalone SSE by ihrpr · Pull Request #561 · modelcontextprotocol/python-sdk · GitHub

StreamableHttp - GET request standalone SSE - #561

Merged
ihrpr merged 37 commits into
mainfrom
ihrpr/get-sse
May 2, 2025
Merged

StreamableHttp - GET request standalone SSE #561
ihrpr merged 37 commits into
mainfrom
ihrpr/get-sse

Conversation

ihrpr commented Apr 22, 2025

Copy link
Copy Markdown
Contributor

As per spec, the client MAY issue an HTTP GET to the MCP endpoint. This can be used to open an SSE stream, allowing the server to communicate to the client, without the client first sending data via HTTP POST. This PR implements establishing SSE stream on GET request.

Follow ups

  • Streamable Http Client
  • Resumability

Stacked on top of #554

jerome3o-anthropic left a comment
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

lgtm!
edit: one suggestion on adding a test for the GET stream actually being used for notifications

if i < count - 1: # Don't wait after the last notification
await anyio.sleep(interval)

# This will send a resource notificaiton though standalone SSE

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Actually - a test for this would be awesome

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

have a test for this in the next PR, where I have a client!

dsp-ant previously approved these changes May 1, 2025
Comment on lines +486 to +492
if GET_STREAM_KEY in self._request_streams:
response = self._create_error_response(
"Conflict: Only one SSE stream is allowed per session",
HTTPStatus.CONFLICT,
)
await response(request.scope, request.receive, send)
return

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I am okay with this, but I don't think this is necessarily true: https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#multiple-connections. A client could have multiple SSE connections open but we should just reply to one.

Base automatically changed from ihrpr/streamablehttp-stateless to main May 2, 2025 12:40
ihrpr dismissed stale reviews from dsp-ant and jerome3o-anthropic May 2, 2025 12:40

The base branch was changed.

ihrpr merged commit 46523af into main May 2, 2025
ihrpr deleted the ihrpr/get-sse branch May 2, 2025 12:52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

3 participants


Back | FazBrowse Home | New Git URL