Interface McpNotificationWatchOptionsExperimental

interface McpNotificationWatchOptions {
    initialReconnectDelayMs?: number;
    maxReconnectAttempts?: number;
    maxReconnectDelayMs?: number;
    onError?: ((error: unknown) => void);
    onNotification?: ((notification: McpNotification) => void);
    onStatusChange?: ((status: McpNotificationStreamStatus, detail?: string) => void);
    reconnectBackoffFactor?: number;
    signal?: AbortSignal;
    stableStreamMs?: number;
}

Hierarchy (view full)

Properties

initialReconnectDelayMs?: number
1000
maxReconnectAttempts?: number

Reconnect budget. 0 never reconnects.

5
maxReconnectDelayMs?: number
30000
onError?: ((error: unknown) => void)

Observes recoverable failures — a dropped connection, a non-2xx GET, a malformed frame. A stream that is still retrying reports here and keeps going; the terminal outcome arrives through onStatusChange.

onNotification?: ((notification: McpNotification) => void)

Called for every server-initiated notification. Never called after a terminal status.

onStatusChange?: ((status: McpNotificationStreamStatus, detail?: string) => void)

Observes every lifecycle transition, including the terminal one.

reconnectBackoffFactor?: number
2
signal?: AbortSignal

Tears the subscription down — the in-flight GET is aborted, not merely ignored.

stableStreamMs?: number

How long a connection must stay open, with no frames at all, before it counts as healthy and resets the reconnect budget. See the module doc's flap guard.

maxReconnectDelayMs