Skip to content

Support resource subscriptions#839

Merged
chemicL merged 5 commits intomainfrom
resource-subscriptions
Mar 2, 2026
Merged

Support resource subscriptions#839
chemicL merged 5 commits intomainfrom
resource-subscriptions

Conversation

@chemicL
Copy link
Member

@chemicL chemicL commented Feb 27, 2026

This change allows clients to register subscriptions for resource updates.

This PR aims to supersede #838 and resolve #837 and #776.

Motivation and Context

This functionality was missing.

How Has This Been Tested?

Unit and integration tests added.

New API

Nothing breaking but new API is introduced:

  • New default method McpServerTransportProviderBase#notifyClient(String sessionId, String method, Object params)
  • New constructor in McpServerSession that accepts a Supplier<Mono<Void>> onClose callback
  • New constructor in DefaultMcpStreamableServerSessionFactory that accepts a Function<String, Mono<Void>> onClose

Behaviour changes

  • Previously, McpAsyncServer#notifyResourceUpdated broadcast to all connected clients. Now it only notifies sessions that have subscribed to the specific resource URI.
    `

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Copy link
Contributor

@tzolov tzolov left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @chemicL

@chemicL chemicL modified the milestones: 1.0.0, 1.1.0 Mar 2, 2026
@chemicL chemicL added the enhancement New feature or request label Mar 2, 2026
@chemicL chemicL merged commit 7f68ea5 into main Mar 2, 2026
24 checks passed
@chemicL chemicL deleted the resource-subscriptions branch March 2, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement resource subscribe/unsubscribe feature

2 participants