{"record":{"id":"c5210b2ef78acd78","repo":"vercel/ai","slug":"server-does-not-support-the-requested-protocol-ver","errorCode":null,"errorMessage":"Server does not support the requested protocol version: ${this.protocolVersion}","messagePattern":"Server does not support the requested protocol version: (.+?)","errorType":"exception","errorClass":"MCPClientError","httpStatus":null,"severity":"error","filePath":"packages/mcp/src/tool/mcp-client.ts","lineNumber":643,"sourceCode":"\n      this.applyDiscoverResult(result);\n      return true;\n    } catch (error) {\n      if (\n        MCPClientError.isInstance(error) &&\n        error.code != null &&\n        MODERN_PROTOCOL_ERROR_CODES.includes(error.code)\n      ) {\n        throw error;\n      }\n\n      return false;\n    }\n  }\n\n  private applyDiscoverResult(result: DiscoverResult): void {\n    if (!result.supportedVersions.includes(this.protocolVersion)) {\n      throw new MCPClientError({\n        message: `Server does not support the requested protocol version: ${this.protocolVersion}`,\n      });\n    }\n\n    const serverInfo = result._meta?.['io.modelcontextprotocol/serverInfo'];\n    if (\n      serverInfo != null &&\n      typeof serverInfo === 'object' &&\n      'name' in serverInfo &&\n      typeof serverInfo.name === 'string' &&\n      'version' in serverInfo &&\n      typeof serverInfo.version === 'string'\n    ) {\n      this._serverInfo = serverInfo as Configuration;\n    }\n\n    this.serverCapabilities = result.capabilities;\n    this._serverInstructions = result.instructions;","sourceCodeStart":625,"sourceCodeEnd":661,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/mcp/src/tool/mcp-client.ts#L625-L661","documentation":"Thrown by applyDiscoverResult during modern protocol discovery when the server's server/discover result does not list the client's requested protocolVersion in supportedVersions. The client refuses to proceed because the server explicitly does not support the negotiated version.","triggerScenarios":"Client attempts protocol version discovery ('server/discover'); the server responds successfully but its supportedVersions array omits the version the client sent (LATEST_PROTOCOL_VERSION).","commonSituations":"Connecting to a newer/older MCP server that supports different protocol versions; mixed client/server SDK versions after an MCP spec release; proxies that advertise discovery but with restricted versions.","solutions":["Upgrade @ai-sdk/mcp so the client requests a protocol version the server supports.","Upgrade the MCP server so it supports the client's requested protocol version.","Check the server's serverInfo/_meta in the discover result to see which versions are supported and align deployments.","Disable protocol version discovery if the server only supports the legacy handshake."],"exampleFix":"// before (server discover result)\n{ supportedVersions: ['2025-03-26'], _meta: {...} }\n// after (server supports client's requested version)\n{ supportedVersions: ['2025-06-18', '2025-03-26'], _meta: {...} }","handlingStrategy":"try-catch","validationCode":"// probe discovery manually\nconst res = await fetch(mcpUrl, { method: 'POST', body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'server/discover' }) });\nconst { result } = await res.json();\nif (!result?.supportedVersions?.includes('2025-06-18')) {\n  console.warn('Server does not support client protocol version; upgrade server or SDK');\n}","typeGuard":"function supportsVersion(r: unknown, v: string): boolean {\n  return !!r && typeof r === 'object' && Array.isArray((r as any).supportedVersions) && (r as any).supportedVersions.includes(v);\n}","tryCatchPattern":"try {\n  const client = await createMCPClient({ transport });\n} catch (e) {\n  if (MCPClientError.isInstance(e) && e.message.startsWith('Server does not support the requested protocol version')) {\n    // align server/SDK versions or fall back to legacy handshake\n  } else throw e;\n}","preventionTips":["Keep @ai-sdk/mcp and the MCP server on versions supporting the same protocol versions","Check server supportedVersions after each MCP spec release","Pin server versions in deployment to avoid silent drift"],"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"}