{"record":{"id":"6be56eca2523f3aa","repo":"vercel/ai","slug":"server-s-protocol-version-is-not-supported-resu","errorCode":null,"errorMessage":"Server's protocol version is not supported: ${result.protocolVersion}","messagePattern":"Server's protocol version is not supported: (.+?)","errorType":"exception","errorClass":"MCPClientError","httpStatus":null,"severity":"error","filePath":"packages/mcp/src/tool/mcp-client.ts","lineNumber":680,"sourceCode":"    this._initializeResult = {\n      protocolVersion: this.protocolVersion,\n      capabilities: result.capabilities,\n      serverInfo: this._serverInfo,\n      instructions: result.instructions,\n    };\n  }\n\n  private setTransportProtocolVersion(version: string): void {\n    if (this.transport.setProtocolVersion) {\n      this.transport.setProtocolVersion(version);\n    } else {\n      this.transport.protocolVersion = version;\n    }\n  }\n\n  private applyInitializeResult(result: InitializeResult): void {\n    if (!SUPPORTED_PROTOCOL_VERSIONS.includes(result.protocolVersion)) {\n      throw new MCPClientError({\n        message: `Server's protocol version is not supported: ${result.protocolVersion}`,\n      });\n    }\n\n    this.serverCapabilities = result.capabilities;\n    this.protocolEra = 'legacy';\n    this.protocolVersion = result.protocolVersion;\n    this._serverInfo = result.serverInfo;\n    this._initializeResult = result;\n    this.setTransportProtocolVersion(result.protocolVersion);\n    this._serverInstructions = result.instructions;\n  }\n\n  async close(): Promise<void> {\n    if (this.isClosed) return;\n    await this.transport?.close();\n    this.onClose();\n  }","sourceCodeStart":662,"sourceCodeEnd":698,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/mcp/src/tool/mcp-client.ts#L662-L698","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Update @ai-sdk/mcp (and @ai-sdk/provider-utils) to a version supporting the server's protocol version.","Pin or downgrade the MCP server to a protocol version the SDK supports.","Log result.protocolVersion and compare against SUPPORTED_PROTOCOL_VERSIONS to confirm the mismatch.","Ensure no proxy rewrites the protocolVersion field between client and server."],"exampleFix":"// before (server response)\n{ protocolVersion: '2099-01-01', ... }\n// after: update SDK or pin server\nnpm i @ai-sdk/mcp@latest // supports newer protocol versions","handlingStrategy":"try-catch","validationCode":"const SUPPORTED = ['2025-06-18', '2025-03-26', '2024-11-05'];\nif (!SUPPORTED.includes(serverProtocolVersion)) {\n  throw new Error(`Server protocol version ${serverProtocolVersion} not supported by this SDK`);\n}","typeGuard":"function isSupportedProtocolVersion(v: string): boolean {\n  return ['2025-06-18', '2025-03-26', '2024-11-05'].includes(v);\n}","tryCatchPattern":"try {\n  const client = await createMCPClient({ transport });\n} catch (e) {\n  if (MCPClientError.isInstance(e) && e.message.startsWith(\"Server's protocol version is not supported\")) {\n    // upgrade @ai-sdk/mcp or pin the server to a supported version\n  } else throw e;\n}","preventionTips":["Update the SDK promptly after new MCP spec releases","Pin the MCP server's protocol version in its config if it negotiates too-new versions","Monitor protocolVersion in integration tests to catch drift early"],"tags":["mcp","protocol-version","handshake","compatibility"],"backgroundTag":"protocol-version-mismatch","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}