{"record":{"id":"366084ce098bd4d7","repo":"Hmbown/CodeWhale","slug":"mcp-server-negotiated-unsupported-protocol-version","errorCode":null,"errorMessage":"MCP server '{}' negotiated unsupported protocol version '{negotiated}' (supported: {})","messagePattern":"MCP server '(.+?)' negotiated unsupported protocol version '(.+?)' \\(supported: (.+?)\\)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/mcp.rs","lineNumber":1899,"sourceCode":"        let response = self.recv(init_id).await?;\n        let result = response_result(\n            &response,\n            \"initialize\",\n            self.config.reviewed_plugin.is_some(),\n        )?;\n        // Per spec, a server that cannot speak the advertised revision answers\n        // with one it does support. Accept any dated revision we still\n        // implement; anything else ends the handshake.\n        let negotiated = result\n            .and_then(|result| result.get(\"protocolVersion\"))\n            .and_then(|version| version.as_str())\n            .ok_or_else(|| {\n                anyhow::anyhow!(\n                    \"MCP server '{}' initialize result omitted protocolVersion\",\n                    self.name\n                )\n            })?;\n        anyhow::ensure!(\n            MCP_SUPPORTED_PROTOCOL_VERSIONS.contains(&negotiated),\n            \"MCP server '{}' negotiated unsupported protocol version '{negotiated}' (supported: {})\",\n            self.name,\n            MCP_SUPPORTED_PROTOCOL_VERSIONS.join(\", \")\n        );\n        self.transport.set_protocol_version(negotiated);\n        self.server_capabilities = McpServerCapabilities::from_initialize_response(&response);\n\n        // Send initialized notification (no id, no response expected)\n        self.send(serde_json::json!({\n            \"jsonrpc\": \"2.0\",\n            \"method\": \"notifications/initialized\"\n        }))\n        .await?;\n\n        Ok(())\n    }\n","sourceCodeStart":1881,"sourceCodeEnd":1917,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/mcp.rs#L1881-L1917","documentation":"After extracting the server's protocolVersion, the client checks it against MCP_SUPPORTED_PROTOCOL_VERSIONS (the dated revisions this client still implements). A server proposing a version outside that set ends the handshake, since message schemas may differ across revisions and the client refuses to guess compatibility.","triggerScenarios":"Server's initialize result advertises a protocolVersion string not in the client's supported list — a newer spec revision the client hasn't adopted, or an old/draft revision that was dropped.","commonSituations":"Server updated to a brand-new MCP spec revision before the client added support (or vice versa: very old server pinned to a retired revision), a custom server hard-coding a made-up version string like \"1.0\", or a mismatched client/server deployment where one was upgraded without the other.","solutions":["Upgrade the MCP client (this application) to a build supporting the server's protocol revision.","Downgrade or reconfigure the server to advertise one of the supported versions listed in the error message.","If you own the server, have it propose a version from the supported list (spec-compliant servers accept the client's requested version).","Check MCP_SUPPORTED_PROTOCOL_VERSIONS in the code and align server and client deployments to the same revision."],"exampleFix":"// before (server-side)\n\"protocolVersion\": \"1999-01-01\"\n// after\n\"protocolVersion\": \"2025-06-18\"  // a version in the client's supported set","handlingStrategy":"try-catch","validationCode":"// preflight the negotiated version against the client's supported set\nlet version = probe_initialize(endpoint).await?.protocolVersion;\nif !SUPPORTED_VERSIONS.contains(&version.as_str()) {\n    return Err(format!(\"server speaks {version}; client supports {SUPPORTED_VERSIONS:?}\"));\n}","typeGuard":"fn is_supported_version(v: &str) -> bool {\n    MCP_SUPPORTED_PROTOCOL_VERSIONS.contains(&v)\n}","tryCatchPattern":"match client.initialize().await {\n    Err(e) if e.to_string().contains(\"negotiated unsupported protocol version\") => {\n        warn!(\"version mismatch; upgrading client or downgrading server required\");\n        Err(e)\n    }\n    other => other,\n}","preventionTips":["Upgrade client and server together so protocol revisions stay in lockstep","Have servers echo a client-requested version from the supported list","Check the error's 'supported:' list before choosing a server version","Avoid hard-coding invented version strings like \"1.0\" in custom servers"],"tags":["mcp","handshake","protocol","version-mismatch"],"backgroundTag":"unexpected-response-shape","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T11:17:16.035Z"}