Skip to content

Resources: subscriptions/listen model on modern servers (era fork) #1630

Description

@cliffhall

Stack: SDK V2 + New Spec — 7 of 10 (tab era-fork; needs era model from card 3).

Fork Resource subscriptions by era. On modern servers resources/subscribe/unsubscribe and the session-scoped subscription model are replaced by entries in a single long-lived subscriptions/listen stream.

Scope

  • Legacy era: keep resources/subscribe/unsubscribe and the current ResourceSubscriptionsState (button already gated on resources.subscribe — see Hide Subscribe/Unsubscribe button and Subscriptions section when server doesn't support resource subscriptions #1478 precedent).
  • Modern era: model subscriptions as a filter over one subscriptions/listen stream — { toolsListChanged, promptsListChanged, resourcesListChanged, resourceSubscriptions: [uris] }. The state store becomes "one listen stream + filter set + acknowledged state + reconnect-by-re-listen" (no resumability; a broken stream re-lists). Notifications arrive tagged _meta["io.modelcontextprotocol/subscriptionId"].
  • Reflect that request-scoped notifications never appear on the listen stream (they ride the originating request).

Key files

core/mcp/state/resourceSubscriptionsState.ts, core/react/useResourceSubscriptions.ts, clients/web/src/components/screens/ResourcesScreen/*, core/mcp/inspectorClient.ts (client.listen(filter) / McpSubscription).

Acceptance

  • Legacy subscribe/unsubscribe unchanged.
  • Modern subscriptions modeled as a listen filter; acknowledged + reconnect-by-re-listen handled.
  • npm run ci green.

Ref: specification/v2_new_spec_impact.md §7.4, §8.2(notifications), §9.3(Resources), §9.5(5).

Metadata

Metadata

Assignees

Labels

v2Issues and PRs for v2

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions