notifyResourceUpdated() signature and related session behavior.
Use subscriptions for resource-specific updates
Subscriptions are for resource content changes, not general status events.
Clients subscribe to a resource URI. Your server notifies subscribers after that resource changes. Clients then read the resource again.
Define the resource
Start with a resource that returns the current content for a stable URI.Notify subscribers after updates
When server state changes, callserver.notifyResourceUpdated(uri).
resources/read for the URI again.
Notify list changes separately
UsesendResourcesListChanged() only when the available resource set changes.
notifyResourceUpdated(uri) instead.
Design for stateful sessions
Resource subscriptions depend on connected sessions. They are not a durable queue. Use subscriptions when:- Clients are connected through stateful MCP sessions.
- Missing an update is acceptable because the client can read the resource again.
- The resource URI is stable.
Test resource updates locally
Use a stateful MCP client that can sendresources/subscribe.
settings://app resource URI and keep the connection open. In a third terminal, call the update_settings tool with theme=dark.
Verify these cases:
- The resource can be read before any updates.
- The update tool calls
notifyResourceUpdated()after changing state. - The client receives the update notification and can read the new content.
Next steps
Resources
Create static resources and resource templates.
Notifications
Send custom status, progress, and list-changed notifications.
MCPServer API reference
Look up
notifyResourceUpdated() and resource notification methods.MCP resources specification
Read the protocol-level subscription behavior.