This is the documentation for v2 — looking for the v1 documentation?
Skip to content

MCP TypeScript SDK (V2) / @modelcontextprotocol/server / server/listenRouter

server/listenRouter ​

Classes ​

StdioListenRouter ​

Defined in: packages/server/src/server/listenRouter.ts:302

Per-connection listen state for the stdio entry. One instance is held by serveStdio for the connection lifetime; it routes inbound subscriptions/listen / notifications/cancelled and rewrites outbound change notifications onto the active subscriptions. No bus — the long-lived pinned instance's existing send*ListChanged() calls feed straight into routeOutbound().

Constructors ​

Constructor ​

new StdioListenRouter(_maxSubscriptions?, serverCapabilities?, serverInfo?): StdioListenRouter

Defined in: packages/server/src/server/listenRouter.ts:319

Parameters ​
_maxSubscriptions? ​

number = DEFAULT_MAX_SUBSCRIPTIONS

serverCapabilities? ​
completions? ​

{[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null; } = ...

Present if the server supports sending completions to the client.

experimental? ​

{[key: string]: object; } = ...

Experimental, non-standard capabilities that the server supports.

extensions? ​

{[key: string]: object; } = ...

Extensions that the server supports. Keys are extension identifiers (vendor-prefix/extension-name).

logging? ​

{[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null; } = ...

Present if the server supports sending log messages to the client.

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to stderr logging (STDIO servers) or OpenTelemetry.

prompts? ​

{ listChanged?: boolean; } = ...

Present if the server offers any prompt templates.

prompts.listChanged? ​

boolean = ...

Whether this server supports issuing notifications for changes to the prompt list.

resources? ​

{ listChanged?: boolean; subscribe?: boolean; } = ...

Present if the server offers any resources to read.

resources.listChanged? ​

boolean = ...

Whether this server supports issuing notifications for changes to the resource list.

resources.subscribe? ​

boolean = ...

Whether this server supports clients subscribing to resource updates.

tasks? ​

{[key: string]: unknown; cancel?: {[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null; }; list?: {[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null; }; requests?: {[key: string]: unknown; tools?: {[key: string]: unknown; call?: {[key: string]: ... | ... | ... | ... | ... | ... | ...; }; }; }; } = ...

Present if the server supports task creation.

Deprecated

2025-11-25 wire vocabulary with no SDK runtime; parsed for interoperability only — servers built on this SDK never advertise it.

tasks.cancel? ​

{[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null; } = ...

Present if the server supports cancelling tasks.

tasks.list? ​

{[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null; } = ...

Present if the server supports listing tasks.

tasks.requests? ​

{[key: string]: unknown; tools?: {[key: string]: unknown; call?: {[key: string]: ... | ... | ... | ... | ... | ... | ...; }; }; } = ...

Capabilities for task creation on specific request types.

tasks.requests.tools? ​

{[key: string]: unknown; call?: {[key: string]: ... | ... | ... | ... | ... | ... | ...; }; } = ...

Task support for tool requests.

tasks.requests.tools.call? ​

{[key: string]: ... | ... | ... | ... | ... | ... | ...; } = ...

tools? ​

{ listChanged?: boolean; } = ...

Present if the server offers any tools to call.

tools.listChanged? ​

boolean = ...

Whether this server supports issuing notifications for changes to the tool list.

serverInfo? ​
description? ​

string = ...

An optional human-readable description of what this implementation does.

This can be used by clients or servers to provide context about their purpose and capabilities. For example, a server might describe the types of resources or tools it provides, while a client might describe its intended use case.

icons? ​

object[] = ...

Optional set of sized icons that the client can display in a user interface.

Clients that support rendering icons MUST support at least the following MIME types:

  • image/png - PNG images (safe, universal compatibility)
  • image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)

Clients that support rendering icons SHOULD also support:

  • image/svg+xml - SVG images (scalable but requires security precautions)
  • image/webp - WebP images (modern, efficient format)
name ​

string = ...

Intended for programmatic or logical use, but used as a display name in past specs or fallback

title? ​

string = ...

Intended for UI and end-user contexts — optimized to be human-readable and easily understood, even by those unfamiliar with domain-specific terminology.

If not provided, the name should be used for display (except for Tool, where annotations.title should be given precedence over using name, if present).

version ​

string = ...

websiteUrl? ​

string = ...

An optional URL of the website for this implementation.

Returns ​

StdioListenRouter

Methods ​

cancel() ​

cancel(id): boolean

Defined in: packages/server/src/server/listenRouter.ts:382

Tear down one subscription (inbound notifications/cancelled). Returns true when a subscription was removed. After this call NOTHING further is delivered for that subscription id (the post-cancel hardening).

Parameters ​
id ​

RequestId

Returns ​

boolean

has() ​

has(id): boolean

Defined in: packages/server/src/server/listenRouter.ts:340

Whether id is an active listen subscription on this connection.

Parameters ​
id ​

RequestId

Returns ​

boolean

routeOutbound() ​

routeOutbound(message): NotificationBody[] | "passthrough"

Defined in: packages/server/src/server/listenRouter.ts:395

Route an outbound notification through the active subscriptions.

  • For a subscription-gated change notification, returns one stamped copy per subscription that opted in to it (an empty array means it is dropped — the modern era never delivers an un-requested change type).
  • For any other outbound message, returns 'passthrough' (the entry forwards it as-is).
Parameters ​
message ​
method ​

string

params? ​

{[key: string]: unknown; }

Returns ​

NotificationBody[] | "passthrough"

serve() ​

serve(message): NotificationBody | { error: { code: number; message: string; }; id: RequestId; jsonrpc: "2.0"; }

Defined in: packages/server/src/server/listenRouter.ts:355

Serve one inbound subscriptions/listen request: registers the subscription and returns the stamped acknowledged notification (or, on capacity / params rejection, the in-band JSON-RPC error response).

Parameters ​
message ​
id ​

string | number = RequestIdSchema

jsonrpc ​

"2.0" = ...

method ​

string = ...

params? ​

{[key: string]: unknown; _meta?: {[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; }; } = ...

params._meta? ​

{[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; } = ...

See General fields: _meta for notes on _meta usage.

{ taskId: string; } = ...

If specified, this request is related to the provided task.

string = ...

params._meta.progressToken? ​

string | number = ...

If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.

Returns ​

NotificationBody | { error: { code: number; message: string; }; id: RequestId; jsonrpc: "2.0"; }

Throws ​

when called before setServerCapabilities (or the constructor) has supplied the serving instance's capabilities. Honoring a filter without knowing the server's advertised capabilities would fail open (deliver unadvertised types); the entry guarantees capabilities are set before any listen request is routed here.

setServerCapabilities() ​

setServerCapabilities(capabilities, serverInfo?): void

Defined in: packages/server/src/server/listenRouter.ts:334

Record the serving instance's declared capabilities and identity once it has been constructed. Called by serveStdio's connect path; subsequent serve() calls narrow the honored filter against the capabilities, and teardownAll() stamps the identity.

Parameters ​
capabilities ​
completions? ​

{[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null; } = ...

Present if the server supports sending completions to the client.

experimental? ​

{[key: string]: object; } = ...

Experimental, non-standard capabilities that the server supports.

extensions? ​

{[key: string]: object; } = ...

Extensions that the server supports. Keys are extension identifiers (vendor-prefix/extension-name).

logging? ​

{[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null; } = ...

Present if the server supports sending log messages to the client.

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to stderr logging (STDIO servers) or OpenTelemetry.

prompts? ​

{ listChanged?: boolean; } = ...

Present if the server offers any prompt templates.

prompts.listChanged? ​

boolean = ...

Whether this server supports issuing notifications for changes to the prompt list.

resources? ​

{ listChanged?: boolean; subscribe?: boolean; } = ...

Present if the server offers any resources to read.

resources.listChanged? ​

boolean = ...

Whether this server supports issuing notifications for changes to the resource list.

resources.subscribe? ​

boolean = ...

Whether this server supports clients subscribing to resource updates.

tasks? ​

{[key: string]: unknown; cancel?: {[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null; }; list?: {[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null; }; requests?: {[key: string]: unknown; tools?: {[key: string]: unknown; call?: {[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | ...[] | null; }; }; }; } = ...

Present if the server supports task creation.

Deprecated

2025-11-25 wire vocabulary with no SDK runtime; parsed for interoperability only — servers built on this SDK never advertise it.

tasks.cancel? ​

{[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null; } = ...

Present if the server supports cancelling tasks.

tasks.list? ​

{[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null; } = ...

Present if the server supports listing tasks.

tasks.requests? ​

{[key: string]: unknown; tools?: {[key: string]: unknown; call?: {[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | ...[] | null; }; }; } = ...

Capabilities for task creation on specific request types.

tasks.requests.tools? ​

{[key: string]: unknown; call?: {[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | ...[] | null; }; } = ...

Task support for tool requests.

tasks.requests.tools.call? ​

{[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | ...[] | null; } = ...

tools? ​

{ listChanged?: boolean; } = ...

Present if the server offers any tools to call.

tools.listChanged? ​

boolean = ...

Whether this server supports issuing notifications for changes to the tool list.

serverInfo? ​
description? ​

string = ...

An optional human-readable description of what this implementation does.

This can be used by clients or servers to provide context about their purpose and capabilities. For example, a server might describe the types of resources or tools it provides, while a client might describe its intended use case.

icons? ​

object[] = ...

Optional set of sized icons that the client can display in a user interface.

Clients that support rendering icons MUST support at least the following MIME types:

  • image/png - PNG images (safe, universal compatibility)
  • image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)

Clients that support rendering icons SHOULD also support:

  • image/svg+xml - SVG images (scalable but requires security precautions)
  • image/webp - WebP images (modern, efficient format)
name ​

string = ...

Intended for programmatic or logical use, but used as a display name in past specs or fallback

title? ​

string = ...

Intended for UI and end-user contexts — optimized to be human-readable and easily understood, even by those unfamiliar with domain-specific terminology.

If not provided, the name should be used for display (except for Tool, where annotations.title should be given precedence over using name, if present).

version ​

string = ...

websiteUrl? ​

string = ...

An optional URL of the website for this implementation.

Returns ​

void

teardownAll() ​

teardownAll(): ListenCloseFrame[]

Defined in: packages/server/src/server/listenRouter.ts:418

Server-side graceful teardown of every active subscription: returns the empty subscriptions/listen JSON-RPC result for each subscription id — the spec's graceful-close signal, _meta carrying the subscription id and the serving instance's identity — for the entry to emit before closing the wire. Clears the set so nothing further is delivered.

Returns ​

ListenCloseFrame[]

Interfaces ​

ListenCloseFrame ​

Defined in: packages/server/src/server/listenRouter.ts:278

A graceful-close subscriptions/listen result frame emitted by StdioListenRouter.teardownAll.

Properties ​

id ​

id: RequestId

Defined in: packages/server/src/server/listenRouter.ts:280

jsonrpc ​

jsonrpc: "2.0"

Defined in: packages/server/src/server/listenRouter.ts:279

result ​

result: object

Defined in: packages/server/src/server/listenRouter.ts:281

_meta ​

_meta: object

_meta.io.modelcontextprotocol/serverInfo? ​

optional io.modelcontextprotocol/serverInfo?: object

_meta.io.modelcontextprotocol/serverInfo.description? ​

optional description?: string

An optional human-readable description of what this implementation does.

This can be used by clients or servers to provide context about their purpose and capabilities. For example, a server might describe the types of resources or tools it provides, while a client might describe its intended use case.

_meta.io.modelcontextprotocol/serverInfo.icons? ​

optional icons?: object[]

Optional set of sized icons that the client can display in a user interface.

Clients that support rendering icons MUST support at least the following MIME types:

  • image/png - PNG images (safe, universal compatibility)
  • image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)

Clients that support rendering icons SHOULD also support:

  • image/svg+xml - SVG images (scalable but requires security precautions)
  • image/webp - WebP images (modern, efficient format)
_meta.io.modelcontextprotocol/serverInfo.name ​

name: string

Intended for programmatic or logical use, but used as a display name in past specs or fallback

_meta.io.modelcontextprotocol/serverInfo.title? ​

optional title?: string

Intended for UI and end-user contexts — optimized to be human-readable and easily understood, even by those unfamiliar with domain-specific terminology.

If not provided, the name should be used for display (except for Tool, where annotations.title should be given precedence over using name, if present).

_meta.io.modelcontextprotocol/serverInfo.version ​

version: string

_meta.io.modelcontextprotocol/serverInfo.websiteUrl? ​

optional websiteUrl?: string

An optional URL of the website for this implementation.

_meta.io.modelcontextprotocol/subscriptionId ​

io.modelcontextprotocol/subscriptionId: RequestId

resultType ​

resultType: "complete"


ListenRouter ​

Defined in: packages/server/src/server/listenRouter.ts:98

The HTTP listen router: holds the set of open subscriptions and serves each listen request as an SSE response.

Properties ​

openCount ​

readonly openCount: number

Defined in: packages/server/src/server/listenRouter.ts:119

The number of currently open subscription streams (for tests / introspection).

Methods ​

closeAll() ​

closeAll(): void

Defined in: packages/server/src/server/listenRouter.ts:117

Gracefully close every open subscription stream: emits the empty subscriptions/listen JSON-RPC result (the spec's graceful-close signal) as the final SSE frame, then closes the stream.

Returns ​

void

serve() ​

serve(message, signal, capabilities, serverInfo): Response

Defined in: packages/server/src/server/listenRouter.ts:111

Serve one subscriptions/listen request and return the SSE Response (or, on capacity / params rejection, the in-band JSON-RPC error Response). The ack notification is the first SSE frame.

capabilities is required: the acknowledged filter is always narrowed against what the serving instance advertises (honoring a filter without capabilities would fail open and deliver unadvertised types). serverInfo is the serving instance's identity, stamped onto the graceful-close result's _meta (the spec's SubscriptionsListenResultMetaObject extends ResultMetaObject, so the serverInfo SHOULD applies there too).

Parameters ​
message ​
id ​

string | number = RequestIdSchema

jsonrpc ​

"2.0" = ...

method ​

string = ...

params? ​

{[key: string]: unknown; _meta?: {[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; }; } = ...

params._meta? ​

{[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; } = ...

See General fields: _meta for notes on _meta usage.

{ taskId: string; } = ...

If specified, this request is related to the provided task.

string = ...

params._meta.progressToken? ​

string | number = ...

If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.

signal ​

AbortSignal | undefined

capabilities ​
completions? ​

{[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null; } = ...

Present if the server supports sending completions to the client.

experimental? ​

{[key: string]: object; } = ...

Experimental, non-standard capabilities that the server supports.

extensions? ​

{[key: string]: object; } = ...

Extensions that the server supports. Keys are extension identifiers (vendor-prefix/extension-name).

logging? ​

{[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null; } = ...

Present if the server supports sending log messages to the client.

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to stderr logging (STDIO servers) or OpenTelemetry.

prompts? ​

{ listChanged?: boolean; } = ...

Present if the server offers any prompt templates.

prompts.listChanged? ​

boolean = ...

Whether this server supports issuing notifications for changes to the prompt list.

resources? ​

{ listChanged?: boolean; subscribe?: boolean; } = ...

Present if the server offers any resources to read.

resources.listChanged? ​

boolean = ...

Whether this server supports issuing notifications for changes to the resource list.

resources.subscribe? ​

boolean = ...

Whether this server supports clients subscribing to resource updates.

tasks? ​

{[key: string]: unknown; cancel?: {[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null; }; list?: {[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null; }; requests?: {[key: string]: unknown; tools?: {[key: string]: unknown; call?: {[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | ...[] | null; }; }; }; } = ...

Present if the server supports task creation.

Deprecated

2025-11-25 wire vocabulary with no SDK runtime; parsed for interoperability only — servers built on this SDK never advertise it.

tasks.cancel? ​

{[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null; } = ...

Present if the server supports cancelling tasks.

tasks.list? ​

{[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null; } = ...

Present if the server supports listing tasks.

tasks.requests? ​

{[key: string]: unknown; tools?: {[key: string]: unknown; call?: {[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | ...[] | null; }; }; } = ...

Capabilities for task creation on specific request types.

tasks.requests.tools? ​

{[key: string]: unknown; call?: {[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | ...[] | null; }; } = ...

Task support for tool requests.

tasks.requests.tools.call? ​

{[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | ...[] | null; } = ...

tools? ​

{ listChanged?: boolean; } = ...

Present if the server offers any tools to call.

tools.listChanged? ​

boolean = ...

Whether this server supports issuing notifications for changes to the tool list.

serverInfo ​
description? ​

string = ...

An optional human-readable description of what this implementation does.

This can be used by clients or servers to provide context about their purpose and capabilities. For example, a server might describe the types of resources or tools it provides, while a client might describe its intended use case.

icons? ​

object[] = ...

Optional set of sized icons that the client can display in a user interface.

Clients that support rendering icons MUST support at least the following MIME types:

  • image/png - PNG images (safe, universal compatibility)
  • image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)

Clients that support rendering icons SHOULD also support:

  • image/svg+xml - SVG images (scalable but requires security precautions)
  • image/webp - WebP images (modern, efficient format)
name ​

string = ...

Intended for programmatic or logical use, but used as a display name in past specs or fallback

title? ​

string = ...

Intended for UI and end-user contexts — optimized to be human-readable and easily understood, even by those unfamiliar with domain-specific terminology.

If not provided, the name should be used for display (except for Tool, where annotations.title should be given precedence over using name, if present).

version ​

string = ...

websiteUrl? ​

string = ...

An optional URL of the website for this implementation.

Returns ​

Response


ListenRouterOptions ​

Defined in: packages/server/src/server/listenRouter.ts:43

Options for createListenRouter.

Properties ​

bus ​

bus: ServerEventBus

Defined in: packages/server/src/server/listenRouter.ts:45

The event bus listen streams subscribe to.

keepAliveMs? ​

optional keepAliveMs?: number

Defined in: packages/server/src/server/listenRouter.ts:49

SSE comment-frame keepalive interval; 0 disables keepalive (default 15000).

maxSubscriptions? ​

optional maxSubscriptions?: number

Defined in: packages/server/src/server/listenRouter.ts:47

Reject a new listen with -32603 when this many subscriptions are already open (default 1024).

onerror? ​

optional onerror?: (error) => void

Defined in: packages/server/src/server/listenRouter.ts:51

Out-of-band error reporting (never alters the response).

Parameters ​
error ​

Error

Returns ​

void


NotificationBody ​

Defined in: packages/server/src/server/listenRouter.ts:58

Internal

A wire-shape notification body (method + loose params).

Properties ​

method ​

method: string

Defined in: packages/server/src/server/listenRouter.ts:59

params ​

params: object

Defined in: packages/server/src/server/listenRouter.ts:60

Index Signature ​

[key: string]: unknown

_meta? ​

optional _meta?: Record<string, unknown>

Variables ​

DEFAULT_MAX_SUBSCRIPTIONS ​

const DEFAULT_MAX_SUBSCRIPTIONS: 1024 = 1024

Defined in: packages/server/src/server/listenRouter.ts:40

Default capacity guard: refuse a new subscription when this many are already open.

Functions ​

createListenRouter() ​

createListenRouter(options): ListenRouter

Defined in: packages/server/src/server/listenRouter.ts:122

Parameters ​

options ​

ListenRouterOptions

Returns ​

ListenRouter


parseListenFilter() ​

parseListenFilter(message): { promptsListChanged?: boolean; resourcesListChanged?: boolean; resourceSubscriptions?: string[]; toolsListChanged?: boolean; } | undefined

Defined in: packages/server/src/server/listenRouter.ts:87

Read the requested filter off a subscriptions/listen request body. Returns the validated filter, or undefined when params.notifications is absent or fails the schema (the caller answers -32602 — the spec marks notifications REQUIRED on the listen request).

Parameters ​

message ​
id ​

string | number = RequestIdSchema

jsonrpc ​

"2.0" = ...

method ​

string = ...

params? ​

{[key: string]: unknown; _meta?: {[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; }; } = ...

params._meta? ​

{[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; } = ...

See General fields: _meta for notes on _meta usage.

{ taskId: string; } = ...

If specified, this request is related to the provided task.

string = ...

params._meta.progressToken? ​

string | number = ...

If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.

Returns ​

Type Literal ​

{ promptsListChanged?: boolean; resourcesListChanged?: boolean; resourceSubscriptions?: string[]; toolsListChanged?: boolean; }

promptsListChanged? ​

optional promptsListChanged?: boolean

If true, receive notifications/prompts/list_changed.

resourcesListChanged? ​

optional resourcesListChanged?: boolean

If true, receive notifications/resources/list_changed.

resourceSubscriptions? ​

optional resourceSubscriptions?: string[]

Subscribe to notifications/resources/updated for these resource URIs. Replaces the former resources/subscribe RPC on the 2026-07-28 revision.

toolsListChanged? ​

optional toolsListChanged?: boolean

If true, receive notifications/tools/list_changed.


undefined