Skip to content

fix(server): deliver resource updates to modern listen subscriptions - #1976

Open
Coding-Professional wants to merge 1 commit into
modelcontextprotocol:mainfrom
Coding-Professional:fix/1930-resource-update-subscriptions
Open

Coding-Professional wants to merge 1 commit into
modelcontextprotocol:mainfrom
Coding-Professional:fix/1930-resource-update-subscriptions

Conversation

@Coding-Professional

Copy link
Copy Markdown
Contributor

Problem

A server can call SendNotificationAsync(NotificationMethods.ResourceUpdatedNotification, ...) to inform legacy resources/subscribe clients that a resource changed. On a 2026-07-28 connection, clients instead request a URI through subscriptions/listen's resourceSubscriptions filter, but the built-in server handler only fans out */list_changed. The application-sent resource update is not delivered on those listen streams.

Change

Route an application-sent notifications/resources/updated to each active, built-in subscriptions/listen stream that was granted its URI. Each delivery uses the listen request's transport and _meta["io.modelcontextprotocol/subscriptionId"]; unrelated subscriptions and clients without a listen stream receive nothing. Clone the notification params per delivery so the application's metadata remains intact and multiple subscriptions do not share a parented JsonNode.

Legacy sessions continue to receive their session-wide notification. A custom SubscriptionsListenHandler remains a full replacement, and the built-in stateless HTTP handler continues to grant no subscriptions. The resource guide documents these boundaries.

Regression tests cover two matching streams, an unrelated URI, application metadata, no active listener, absence of the subscribe capability, and legacy delivery. The no-listener test first sends an ordinary modern request because server/discover is only a probe and does not commit the session's protocol version.

Validation

  • Focused resource-update and SubscriptionsListenTests: 7 passed on .NET 10 and 7 passed on .NET 8 (Windows).
  • Focused ASP.NET Core subscription and legacy notification tests: 4 passed on .NET 10 (Windows).
  • ModelContextProtocol.Core builds for net8.0, net9.0, net10.0, and netstandard2.0 with 0 warnings and 0 errors.
  • A broader local core run was interrupted after the test host stopped making progress; no full-suite pass is claimed. CI should provide the full matrix result.

Fixes #1930

Copilot AI balanced review requested due to automatic review settings October 30, 2026 09:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@Coding-Professional

Coding-Professional commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

CI update: The initial Ubuntu Debug run timed out after seven minutes of test inactivity during the existing StdioClientTransportTests.CreateAsync_ValidProcessInvalidServer_StdErrCallbackInvoked test. A fresh run on commit 7e3560d completed successfully: all six build/test matrix jobs, analysis, markdown checks, and coverage publishing are green. No rerun is needed.

@Coding-Professional
Coding-Professional requested a max review from Copilot October 30, 2026 09:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@Coding-Professional
Coding-Professional force-pushed the fix/1930-resource-update-subscriptions branch from cb8c825 to 7e3560d Compare October 30, 2026 09:50

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants