{"record":{"id":"67ba9ffa0da883d6","repo":"Hmbown/CodeWhale","slug":"mcp-server-server-name-unsupported-protocol-version-protocol","errorCode":null,"errorMessage":"MCP server '{server_name}': unsupported protocol version '{protocol_version}' (supported: {})","messagePattern":"MCP server '(.+?)': unsupported protocol version '(.+?)' \\(supported: (.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/mcp/src/stdio_client.rs","lineNumber":440,"sourceCode":"}\n\nfn validate_initialize_result(\n    server_name: &str,\n    result: &Value,\n) -> Result<Option<ServerCapabilities>> {\n    let response = result.as_object().with_context(|| {\n        format!(\"MCP server '{server_name}': initialize result must be an object\")\n    })?;\n    let protocol_version = response\n        .get(\"protocolVersion\")\n        .and_then(Value::as_str)\n        .with_context(|| {\n            format!(\"MCP server '{server_name}': initialize result omitted protocolVersion\")\n        })?;\n    // Negotiation per spec: we advertise the newest revision and accept any\n    // dated revision we still implement; anything else ends the handshake.\n    if !MCP_SUPPORTED_PROTOCOL_VERSIONS.contains(&protocol_version) {\n        bail!(\n            \"MCP server '{server_name}': unsupported protocol version '{protocol_version}' (supported: {})\",\n            MCP_SUPPORTED_PROTOCOL_VERSIONS.join(\", \")\n        );\n    }\n\n    let server_info = response\n        .get(\"serverInfo\")\n        .and_then(Value::as_object)\n        .with_context(|| {\n            format!(\"MCP server '{server_name}': initialize result omitted serverInfo\")\n        })?;\n    for field in [\"name\", \"version\"] {\n        if !server_info.get(field).is_some_and(Value::is_string) {\n            bail!(\"MCP server '{server_name}': initialize serverInfo.{field} must be a string\");\n        }\n    }\n\n    match response.get(\"capabilities\") {","sourceCodeStart":422,"sourceCodeEnd":458,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/mcp/src/stdio_client.rs#L422-L458","documentation":"After the initialize handshake, validate_initialize_result checks that the server's protocolVersion is one of MCP_SUPPORTED_PROTOCOL_VERSIONS — the dated revisions this client implements. Negotiation per spec: the client advertises the newest revision and accepts any dated revision it still supports; anything else aborts the connection with this error.","triggerScenarios":"spawn_with_timeouts completes an initialize request and the server replies with a protocolVersion that is missing from MCP_SUPPORTED_PROTOCOL_VERSIONS — too old, too new, or a non-dated value like \"1.0\" or \"latest\".","commonSituations":"Server built against a newer MCP spec revision than the client supports; very old server pinned to a retired revision; server hardcoding a wrong version string instead of echoing a negotiated one.","solutions":["Upgrade codewhale (the client) so its MCP_SUPPORTED_PROTOCOL_VERSIONS includes the server's revision","Downgrade or update the MCP server to one speaking a supported dated revision","Fix a misconfigured server that reports a bogus version string instead of a spec date"],"exampleFix":"// before (server)\n\"protocolVersion\": \"1.0\"\n// after (server echoes a supported dated revision)\n\"protocolVersion\": \"2025-06-18\"","handlingStrategy":"try-catch","validationCode":"const SUPPORTED: &[&str] = &[\"2024-11-05\", \"2025-03-26\", \"2025-06-18\"];\n// check the server's advertised version from its manifest/docs before spawning\nfn protocol_supported(v: &str) -> bool { SUPPORTED.contains(&v) }","typeGuard":"fn is_supported_protocol(v: &str) -> bool {\n    [\"2024-11-05\", \"2025-03-26\", \"2025-06-18\"].contains(&v)\n}","tryCatchPattern":"match client.spawn(config).await {\n    Ok(handle) => use(handle),\n    Err(e) if e.to_string().contains(\"unsupported protocol version\") => {\n        eprintln!(\"server speaks an unsupported MCP revision; upgrade client or server\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Pin MCP servers to revisions the client supports","Upgrade the client when adopting servers built on newer spec dates","Never hardcode a non-dated version string (e.g. \"1.0\") in servers","Log the server's protocolVersion at connect time for diagnosis"],"tags":["mcp","protocol","handshake","versioning"],"backgroundTag":"incompatible-source-type","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"}