Skip to content

Support resource subscriptions#839

Open
chemicL wants to merge 4 commits intomainfrom
resource-subscriptions
Open

Support resource subscriptions#839
chemicL wants to merge 4 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>
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.

Implement resource subscribe/unsubscribe feature

1 participant