Skip to content

Conversation

@slimslenderslacks
Copy link
Contributor

Background

Since the Server has a map of ServersSessions->subscriptions, and takes care of routing ResourceUpdate messages to ServerSessions, I think the decision was made to leave *ServerSession out of the SubscribeHandler/UnsubscribeHandler signatures. However, resource subscriptions are not specific to the a particular client and this information is kept private in the Session today.

Proposal

Align the Subscribe/Unsubscribe handlers with the other two handlers that are client specific (ProgressNotificationHandler, and RootListChangeHanlder), and include *ServerSession in the signature.

It comes in practice because because a gateway server that needs to forward subscriptions still needs this information. The routing logic in Server is convenient and means that most servers won't need to know which ServerSessions are subscribed. But I think there are still use cases where the user will need to know.

@samthanawalla
Copy link
Contributor

This change makes sense to me. @jba Do you see any problems with adding ServerSession to the Subscribe Handlers?

@jba
Copy link
Contributor

jba commented Aug 4, 2025

Agreed, this seems right.

@jba jba self-requested a review August 4, 2025 17:31
jba
jba previously approved these changes Aug 4, 2025
@slimslenderslacks
Copy link
Contributor Author

@jba @samthanawalla sorry, just realized there was a ref to these two handlers in design/design.md so updated them as well.

Since this would be a breaking change, do we have a change log that you want updated?

@slimslenderslacks slimslenderslacks requested a review from jba August 4, 2025 17:43
@jba
Copy link
Contributor

jba commented Aug 4, 2025

We don't need one; we run apidiff to compare the previous and candidate releases.

@jba jba merged commit cb17593 into modelcontextprotocol:main Aug 4, 2025
3 checks passed
BC-ACherednichenko pushed a commit to BC-ACherednichenko/go-sdk that referenced this pull request Aug 5, 2025
…ocol#231)

## Background

Since the Server has a map of ServersSessions->subscriptions, and takes
care of routing ResourceUpdate messages to ServerSessions, I think the
decision was made to leave *ServerSession out of the
SubscribeHandler/UnsubscribeHandler signatures. However, resource
subscriptions are not specific to the a particular client and this
information is kept private in the Session today.

## Proposal

Align the Subscribe/Unsubscribe handlers with the other two handlers
that are client specific (ProgressNotificationHandler, and
RootListChangeHanlder), and include *ServerSession in the signature.

It comes in practice because because a gateway server that needs to
forward subscriptions still needs this information. The routing logic in
Server is convenient and means that most servers won't need to know
which ServerSessions are subscribed. But I think there are still use
cases where the user will need to know.
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