Skip to main content

Interface: MCPSubscription

Defined in: node_modules/.bun/@modelcontextprotocol+client@2.2.0/node_modules/@modelcontextprotocol/client/dist/index.d.mts:2103

A handle to an open subscriptions/listen stream (protocol revision 2026-07-28). Change notifications delivered on the stream dispatch to the existing Client.setNotificationHandler registrations.

Properties​

closed​

readonly closed: Promise<"local" | "graceful" | "remote">

Defined in: node_modules/.bun/@modelcontextprotocol+client@2.2.0/node_modules/@modelcontextprotocol/client/dist/index.d.mts:2128

Resolves exactly once when the subscription has terminated. Never rejects — this is an observation, not an operation.

  • 'local' — you called close (or aborted the RequestOptions.signal you passed to listen()).
  • 'graceful' — the server ended the subscription deliberately by sending the empty subscriptions/listen response (e.g. on shutdown).
  • 'remote' — the stream ended without a response, or the transport dropped — an unexpected disconnect. Re-listen if you still want events.

honoredFilter​

readonly honoredFilter: object

Defined in: node_modules/.bun/@modelcontextprotocol+client@2.2.0/node_modules/@modelcontextprotocol/client/dist/index.d.mts:2108

The subset of the requested filter the server agreed to honor (from notifications/subscriptions/acknowledged).

promptsListChanged?​

optional promptsListChanged?: boolean

resourcesListChanged?​

optional resourcesListChanged?: boolean

resourceSubscriptions?​

optional resourceSubscriptions?: string[]

toolsListChanged?​

optional toolsListChanged?: boolean

Methods​

close()​

close(): Promise<void>

Defined in: node_modules/.bun/@modelcontextprotocol+client@2.2.0/node_modules/@modelcontextprotocol/client/dist/index.d.mts:2115

Tears the subscription down. Idempotent. Aborts the listen request's stream (where the transport supports it) AND sends notifications/cancelled referencing the listen request id — both, always, so close works on any transport.

Returns​

Promise<void>