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

MCP TypeScript SDK (V2) / @modelcontextprotocol/client / client/probeClassifier

client/probeClassifier

Interfaces

ProbeClassifierContext

Defined in: packages/client/src/client/probeClassifier.ts:54

Properties

clientModernVersions

clientModernVersions: readonly string[]

Defined in: packages/client/src/client/probeClassifier.ts:56

Modern-era versions this client can negotiate, in preference order (never empty).

environment

environment: ProbeEnvironment

Defined in: packages/client/src/client/probeClassifier.ts:71

See ProbeEnvironment.

fallbackAvailable

fallbackAvailable: boolean

Defined in: packages/client/src/client/probeClassifier.ts:69

Whether a legacy initialize fallback is possible — false for a modern-only client and for pin mode. Without a fallback, rows carrying modern evidence but no usable version overlap — a DiscoverResult with no overlapping version, or a -32022 whose data.supported lists only legacy revisions — yield a typed UnsupportedProtocolVersionError built from that evidence; the remaining rows that would have fallen back still classify as legacy, and the caller reports them as a typed negotiation error instead of starting an initialize handshake.

requestedVersion

requestedVersion: string

Defined in: packages/client/src/client/probeClassifier.ts:58

The version the probe carried in its _meta envelope (used to synthesize data.requested on typed errors).

transportKind

transportKind: ProbeTransportKind

Defined in: packages/client/src/client/probeClassifier.ts:73

See ProbeTransportKind.

Type Aliases

ProbeEnvironment

ProbeEnvironment = "node" | "browser"

Defined in: packages/client/src/client/probeClassifier.ts:28

The runtime environment the probe executed in. Only consulted for the network-failure row: a browser CORS-preflight rejection is treated as a legacy signal, while in Node a network failure stays a typed connect error.


ProbeOutcome

ProbeOutcome = { kind: "result"; result: unknown; } | { code: number; data?: unknown; kind: "rpc-error"; message: string; } | { body?: string; kind: "http-error"; status: number; } | { error: unknown; kind: "network-error"; } | { error: Error; kind: "auth-required"; } | { kind: "timeout"; timeoutMs: number; }

Defined in: packages/client/src/client/probeClassifier.ts:42

A normalized probe outcome, produced by the connect-time wiring from the raw transport exchange.

Union Members

Type Literal

{ kind: "result"; result: unknown; }


Type Literal

{ code: number; data?: unknown; kind: "rpc-error"; message: string; }

Answered with a JSON-RPC error (any HTTP status, including 200-bodied errors and stdio in-band errors).


Type Literal

{ body?: string; kind: "http-error"; status: number; }

The HTTP layer rejected the probe POST (non-2xx); body is the raw response text, when available.


Type Literal

{ error: unknown; kind: "network-error"; }


Type Literal

{ error: Error; kind: "auth-required"; }

The transport's auth flow challenged during the probe send (UnauthorizedError).


Type Literal

{ kind: "timeout"; timeoutMs: number; }

No response arrived within the probe timeout.


ProbeTransportKind

ProbeTransportKind = "stdio" | "http"

Defined in: packages/client/src/client/probeClassifier.ts:36

The transport class the probe ran on. Only consulted for the timeout row: a stdio probe that times out signals a legacy server, while an HTTP timeout stays a typed error. Anything that is not the stdio child-process transport is treated like HTTP.


ProbeVerdict

ProbeVerdict = { discover: DiscoverResult; kind: "modern"; version: string; } | { error: UnsupportedProtocolVersionError; kind: "corrective"; version: string; } | { kind: "legacy"; } | { error: Error; kind: "error"; }

Defined in: packages/client/src/client/probeClassifier.ts:76

Union Members

Type Literal

{ discover: DiscoverResult; kind: "modern"; version: string; }

Definitive modern evidence: select version and continue without initialize.


Type Literal

{ error: UnsupportedProtocolVersionError; kind: "corrective"; version: string; }

-32022 with a mutual modern version: re-send the probe at version. Spec-mandated select-and-continue — the caller runs it exactly once and arms a loop guard on the second rejection, throwing error.


Type Literal

{ kind: "legacy"; }

Definitive legacy signal or unrecognized shape: perform the plain legacy initialize handshake on the same connection.


Type Literal

{ error: Error; kind: "error"; }

Typed connect error — never converted to an era verdict.

Functions

classifyProbeOutcome()

classifyProbeOutcome(outcome, context): ProbeVerdict

Defined in: packages/client/src/client/probeClassifier.ts:105

Classify a single probe outcome. Pure: no I/O, no state — loop-guard and retry state live in the caller.

Parameters

outcome

ProbeOutcome

context

ProbeClassifierContext

Returns

ProbeVerdict