Skip to content

Conversation

@jba
Copy link
Contributor

@jba jba commented Jul 7, 2025

ClientSessions and ServerSessions created by SSE have non-empty session IDs.

Fixes #98.

ClientSessions and ServerSessions created by SSE have non-empty
session IDs.

Fixes modelcontextprotocol#98.
@jba jba requested a review from findleyr July 7, 2025 13:54
@jba jba enabled auto-merge (squash) July 7, 2025 13:55
s := &sseClientConn{
sseEndpoint: c.sseEndpoint,
msgEndpoint: msgEndpoint,
sessionID: msgEndpoint.Query().Get("sessionid"),
Copy link
Contributor

Choose a reason for hiding this comment

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

This is, unfortunately, not part of the spec.
Why do we want to have session IDs for the SSE connection? In theory, there is no way for the client to actually know its session id.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was requested in #98, and I obliged.
We could also say that SSE is unsupported, and drop this.

Copy link

@tylerwilliams tylerwilliams Jul 7, 2025

Choose a reason for hiding this comment

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

👋 I filed this bug.

The part of the spec that led me down this session ID path was this: https://modelcontextprotocol.io/docs/concepts/transports#session-management.

Maybe there's another way to approach this (setting or grabbing the header manually) that I should look into?

Choose a reason for hiding this comment

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

I see SSE is deprecated https://modelcontextprotocol.io/docs/concepts/transports#server-sent-events-sse-deprecated so I think this is my bad and I should just be using mcp.NewStreamableHTTPHandler instead of mcp.NewSSEHandler. Sorry for the noise :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem! Closing this PR.

@jba jba closed this Jul 9, 2025
auto-merge was automatically disabled July 9, 2025 11:19

Pull request was closed

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.

SessionID is blank / empty when read from mcp.ServerSession

3 participants