mcp.protocol.versions

Undocumented in source.

Members

Aliases

cacheableResults
alias cacheableResults = isModern

Modern returns ttlMs/cacheScope on cacheable results.

supportsDiscover
alias supportsDiscover = isModern

Modern implements server/discover.

usesMRTR
alias usesMRTR = isModern

Modern uses Multi Round-Trip Requests instead of server-initiated requests.

usesPerRequestMeta
alias usesPerRequestMeta = isModern

Modern uses per-request _meta (protocolVersion/clientInfo/clientCapabilities) instead of an initialize handshake.

usesSubscriptionsListen
alias usesSubscriptionsListen = isModern

Modern uses subscriptions/listen instead of GET stream + resources/subscribe.

Enums

ProtocolVersion
enum ProtocolVersion

A supported MCP protocol version, ordered oldest to newest.

Functions

isLegacy
bool isLegacy(ProtocolVersion v)

Whether a version predates the modern redesign (< 2026-07-28).

isModern
bool isModern(ProtocolVersion v)

The modern (>= 2026-07-28) redesign: stateless HTTP, per-request _meta, server/discover, MRTR, subscriptions/listen, cacheable results, and the standard request headers. Gated behind this single predicate so older versions keep their session/handshake-based behavior.

negotiate
ProtocolVersion negotiate(string clientRequested)

Server-side negotiation: accept the client's version if supported, otherwise offer our latest stable version.

parseVersion
ProtocolVersion parseVersion(string s)

Parse a wire string into a ProtocolVersion, or throw if unknown.

resourceNotFoundCode
int resourceNotFoundCode(ProtocolVersion v)

The JSON-RPC error code for "resource not found": modern aligns it to invalidParams (-32602); earlier versions used the MCP-specific -32002.

supportsElicitation
bool supportsElicitation(ProtocolVersion v)

Whether elicitation (client feature) is available at this version.

supportsProgressMessage
bool supportsProgressMessage(ProtocolVersion v)

Whether notifications/progress may carry the optional message field. The 2024-11-05 ProgressNotification params are {progressToken, progress, total?} with NO message; message was introduced in 2025-03-26 and is retained in every later version. Emitting it to a 2024-11-05 peer would inject an out-of-schema key, so the server gates it on this predicate.

toWire
string toWire(ProtocolVersion v)

Convert a version to its on-the-wire date string.

tryParseVersion
bool tryParseVersion(string s, ProtocolVersion v)

Parse a wire string; returns false (without throwing) if unknown.

Variables

latestStable
enum ProtocolVersion latestStable;

The newest stable (legacy) version this SDK speaks. Versions before modern (2026-07-28) are "legacy"; modern and later are "modern".

supportedVersions
ProtocolVersion[] supportedVersions;

All versions this SDK can speak, oldest to newest (modern last).