feat: implement resource update notifications (#264)

This enables servers to notify clients when specific resources are updated,
allowing clients to react to individual resource changes rather than just
list changes.

- Add ResourcesUpdatedNotification schema with uri field
- Add METHOD_NOTIFICATION_RESOURCES_UPDATED constant
- Implement notifyResourcesUpdated() methods in McpAsyncServer and McpSyncServer
- Add client-side support for resource update consumers and handlers
- Client automatically reads updated resource content when notification received
- Add tests for both async and sync server implementations

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
This commit is contained in:
gongwn1 2025-05-26 12:08:37 +08:00 • committed by Christian Tzolov
commit 9ebff0c5d9

View file

@ -141,6 +141,13 @@ public class McpSyncServer {
this.asyncServer.notifyResourcesListChanged().block();
}
/**
* Notify clients that the resources have updated.
*/
public void notifyResourcesUpdated(McpSchema.ResourcesUpdatedNotification resourcesUpdatedNotification) {
this.asyncServer.notifyResourcesUpdated(resourcesUpdatedNotification).block();
}
/**
* Notify clients that the list of available prompts has changed.
*/