vercel/ai · error · MCPClientError

Server's protocol version is not supported: ${result.protoco

Error message

Server's protocol version is not supported: ${result.protocolVersion}

What it means

Thrown by applyInitializeResult during the legacy initialize handshake when the server's response protocolVersion is not in SUPPORTED_PROTOCOL_VERSIONS. The client only speaks known MCP protocol versions and rejects unknown or obsolete ones.

Source

Thrown at packages/mcp/src/tool/mcp-client.ts:680

    this._initializeResult = {
      protocolVersion: this.protocolVersion,
      capabilities: result.capabilities,
      serverInfo: this._serverInfo,
      instructions: result.instructions,
    };
  }

  private setTransportProtocolVersion(version: string): void {
    if (this.transport.setProtocolVersion) {
      this.transport.setProtocolVersion(version);
    } else {
      this.transport.protocolVersion = version;
    }
  }

  private applyInitializeResult(result: InitializeResult): void {
    if (!SUPPORTED_PROTOCOL_VERSIONS.includes(result.protocolVersion)) {
      throw new MCPClientError({
        message: `Server's protocol version is not supported: ${result.protocolVersion}`,
      });
    }

    this.serverCapabilities = result.capabilities;
    this.protocolEra = 'legacy';
    this.protocolVersion = result.protocolVersion;
    this._serverInfo = result.serverInfo;
    this._initializeResult = result;
    this.setTransportProtocolVersion(result.protocolVersion);
    this._serverInstructions = result.instructions;
  }

  async close(): Promise<void> {
    if (this.isClosed) return;
    await this.transport?.close();
    this.onClose();
  }

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Update @ai-sdk/mcp (and @ai-sdk/provider-utils) to a version supporting the server's protocol version.
  2. Pin or downgrade the MCP server to a protocol version the SDK supports.
  3. Log result.protocolVersion and compare against SUPPORTED_PROTOCOL_VERSIONS to confirm the mismatch.
  4. Ensure no proxy rewrites the protocolVersion field between client and server.

Example fix

// before (server response)
{ protocolVersion: '2099-01-01', ... }
// after: update SDK or pin server
npm i @ai-sdk/mcp@latest // supports newer protocol versions
Defensive patterns

Strategy: try-catch

Validate before calling

const SUPPORTED = ['2025-06-18', '2025-03-26', '2024-11-05'];
if (!SUPPORTED.includes(serverProtocolVersion)) {
  throw new Error(`Server protocol version ${serverProtocolVersion} not supported by this SDK`);
}

Type guard

function isSupportedProtocolVersion(v: string): boolean {
  return ['2025-06-18', '2025-03-26', '2024-11-05'].includes(v);
}

Try / catch

try {
  const client = await createMCPClient({ transport });
} catch (e) {
  if (MCPClientError.isInstance(e) && e.message.startsWith("Server's protocol version is not supported")) {
    // upgrade @ai-sdk/mcp or pin the server to a supported version
  } else throw e;
}

Prevention

When it happens

Trigger: The initialize request succeeds but result.protocolVersion (the server-chosen version) is not among SUPPORTED_PROTOCOL_VERSIONS — e.g. the server picks a brand-new or very old version string.

Common situations: Server upgraded to a newer MCP spec than the SDK supports; very old server pinned to a retired version; server echoing back a wrong/typo'd version string; SDK dependency lagging behind a spec release.

Related errors


AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30). Data as JSON: /api/errors/6be56eca2523f3aa. Report an issue: GitHub.