{"record":{"id":"68ac458f3313dcf8","repo":"Kuberwastaken/claurst","slug":"mcp-server-legacy-sse-post-request-failed","errorCode":null,"errorMessage":"MCP server '{}': legacy SSE POST request failed: {}","messagePattern":"MCP server '(.+?)': legacy SSE POST request failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-rust/crates/mcp/src/rmcp_backend.rs","lineNumber":388,"sourceCode":"                anyhow::anyhow!(\n                    \"MCP server '{}': legacy SSE POST endpoint has not been discovered\",\n                    server_name\n                )\n            })?;\n\n            let mut request = client\n                .post(endpoint)\n                .header(reqwest::header::CONTENT_TYPE, \"application/json\")\n                .json(&item);\n            if let Some(token) = &auth_token {\n                request = request.header(\n                    reqwest::header::AUTHORIZATION,\n                    transport::bearer_header_value(token)?,\n                );\n            }\n\n            let response = request.send().await.map_err(|e| {\n                anyhow::anyhow!(\n                    \"MCP server '{}': legacy SSE POST request failed: {}\",\n                    server_name,\n                    e\n                )\n            })?;\n\n            handle_legacy_sse_http_response(server_name, response, incoming_tx, background_tasks)\n                .await\n                .map_err(Into::into)\n        }\n    }\n\n    fn receive(\n        &mut self,\n    ) -> impl std::future::Future<Output = Option<rmcp::service::RxJsonRpcMessage<RoleClient>>> + Send {\n        let incoming_rx = Arc::clone(&self.incoming_rx);\n        async move {\n            let mut rx = incoming_rx.lock().await;","sourceCodeStart":370,"sourceCodeEnd":406,"githubUrl":"https://github.com/Kuberwastaken/claurst/blob/b0637c97ec34144387cbf2f74f65df6d16a6cef1/src-rust/crates/mcp/src/rmcp_backend.rs#L370-L406","documentation":"This error wraps a reqwest transport failure that occurred while POSTing a JSON-RPC message to a legacy (HTTP+SSE) MCP server's message endpoint. It is raised in the `send` implementation of `LegacySseRmcpTransport`, which serializes the outgoing rmcp message as JSON and sends it to the previously discovered post endpoint. Any error at the HTTP layer (DNS, connect, TLS, timeout, body encode, request build) is wrapped with the MCP server name so the operator can identify which configured server is unreachable. The inner reqwest error is preserved in the message, so the actual root cause (e.g. 'connection refused', 'timed out') appears after the colon.","triggerScenarios":"Calling any MCP operation through a backend configured with the legacy SSE transport when `request.send().await` fails: server process is down, wrong host/port in the MCP server config, the SSE-post endpoint URL is stale after a server restart, TLS certificate problems, or the network drops mid-request.","commonSituations":"MCP server binary not running or crashed; `mcpServers` entry points at a port nothing listens on; server restarted and returned a different message endpoint; corporate proxy or firewall blocking the connection; request timeout because the server is overloaded and slow to accept POSTs.","solutions":["Verify the MCP server is running and reachable: `curl -v <post-endpoint-URL>` from the same host.","Check the mcpServers config entry (command/args or url) for a wrong host, port, or path.","If the server was restarted, reconnect — the discovered post endpoint may be stale.","Inspect the inner reqwest error text in the message (connection refused / timed out / dns error) to pick the right fix.","If timeouts are the cause, increase the reqwest client timeout or check server load/proxy settings."],"exampleFix":"// before: transport constructed with a hardcoded port that nothing listens on\nlet backend = RmcpClientBackend::connect_legacy_sse(\"http://127.0.0.1:9999/sse\", ...).await?;\n// after: start the MCP server first and derive the port/URL from its startup log\nlet server = spawn_mcp_server(port_file)?;\nlet port = read_port(port_file).await?;\nlet backend = RmcpClientBackend::connect_legacy_sse(&format!(\"http://127.0.0.1:{port}/sse\"), ...).await?;","handlingStrategy":"retry","validationCode":"async fn mcp_server_reachable(sse_url: &str) -> bool {\n    reqwest::get(sse_url).await.map(|r| r.status().is_success()).unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"match backend.list_tools().await {\n    Ok(t) => t,\n    Err(e) if e.to_string().contains(\"legacy SSE POST request failed\") => {\n        eprintln!(\"MCP server unreachable, check config/process: {e}\");\n        Vec::new()\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Health-check the SSE endpoint before establishing the backend session.","Reconnect (rebuild the backend) whenever the MCP server process restarts; never reuse stale endpoints.","Keep MCP server URLs in config with explicit host/port and validate them at startup.","Set a sane reqwest timeout so hangs surface as timeouts rather than indefinite stalls."],"tags":["network","mcp","sse","http-client","connection"],"backgroundTag":"http-request-failed","analyzedSha":"b0637c97ec34144387cbf2f74f65df6d16a6cef1","analyzedAt":"2026-09-10T00:24:58.650Z","contentChangedAt":"2026-09-10T00:24:58.650Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}