Model Context Protocol's resource subscription mechanism lets a client be notified when a server-side resource changes. Unlike polling, the server pushes an update notification, and the client decides whether to refetch. Essential for any context that mutates during a session.

Advertisement

Subscription request

{
  "method": "resources/subscribe",
  "params": { "uri": "file:///workspace/notes.md" }
}

Update notification

{
  "method": "notifications/resources/updated",
  "params": { "uri": "file:///workspace/notes.md" }
}
Advertisement

Refetch on notification

Notification carries no content — just 'this URI changed'. Client decides whether to fetch (resources/read) immediately or batch with other updates. This decoupling keeps the protocol lightweight even for fast-changing resources.

Unsubscribe

resources/unsubscribe with the same URI. Required for clean shutdown — orphan subscriptions waste server resources. Most clients track active subscriptions and unsubscribe on context end.

When NOT to subscribe

Read-only or rarely-changing resources: just fetch once. Resources you control (your own DB): your app already knows when it changes. Subscriptions are for resources where the server knows about change and you don't.

Subscribe → push notification → client-controlled refetch. Cleaner than polling, lighter than streaming all content.