Repository navigation
Conversation
Client::listen() opens a subscriptions/listen stream with a SubscriptionFilter, hands the acknowledgment and each notification of the subscription to callbacks, and returns when the server ends it. Adds SubscriptionFilter, SubscriptionsListenRequest and SubscriptionsAcknowledgedNotification to Mcp\Schema, and Notification::getMeta().
songecko
requested review from
CodeWithKyrian,
Nyholm,
chr-hertel and
soyuka
as code owners
November 19, 2026 03:45
This branch has not been deployed
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
Client::listen(), which opens asubscriptions/listenstream with aSubscriptionFilter, hands the acknowledged filter and each notification of the subscription to callbacks, and returns when the server ends it. AddsSubscriptionFilter,SubscriptionsListenRequestandSubscriptionsAcknowledgedNotificationtoMcp\Schema, andNotification::getMeta().Motivation and Context
On 2026-07-28 the server answers
subscriptions/listen, but the client could not open the stream, so it could not receivenotifications/resources/updatedor list changes. This is the client side #340 and #185 left open.Closes #752
How Has This Been Tested?
Unit tests for the schema types and for routing in
Protocol(notifications of the open subscription, stray ones dropped, the stdionotifications/cancelledtermination).SubscriptionsTestruns the client against the SDK server underphp -Swith a PSR-16 bus: only subscribed updates arrive after the acknowledgment, cancellation, graceful end at the server's lifetime, an empty agreed filter, and refusal on a handshake-era connection. Also used in a real application that keeps listen streams open to an MCP server and reacts to resource updates.Breaking Changes
None.
listen()andNotification::getMeta()are additions.Types of changes
Checklist
Additional context
A listen request uses no request timeout: it lasts until the server ends it or the caller cancels. Handshake-era
resources/subscribeis out of scope.