{"record":{"id":"830d1bfb22e2f7b1","repo":"Kuberwastaken/claurst","slug":"legacy-sse-endpoint-event-did-not-include-a-post-e","errorCode":null,"errorMessage":"legacy SSE endpoint event did not include a POST endpoint","messagePattern":"legacy SSE endpoint event did not include a POST endpoint","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-rust/crates/mcp/src/lib.rs","lineNumber":417,"sourceCode":"\r\n    pub(crate) fn bearer_header_value(token: &str) -> anyhow::Result<HeaderValue> {\r\n        HeaderValue::from_str(&format!(\"Bearer {}\", token))\r\n            .map_err(|e| anyhow::anyhow!(\"invalid bearer token header: {}\", e))\r\n    }\r\n\r\n    pub(crate) fn is_event_stream_response(response: &reqwest::Response) -> bool {\r\n        response\r\n            .headers()\r\n            .get(CONTENT_TYPE)\r\n            .and_then(|value| value.to_str().ok())\r\n            .map(|value| value.contains(\"text/event-stream\"))\r\n            .unwrap_or(false)\r\n    }\r\n\r\n    pub(crate) fn resolve_legacy_endpoint(base_url: &str, endpoint: &str) -> anyhow::Result<String> {\r\n        let endpoint = endpoint.trim();\r\n        if endpoint.is_empty() {\r\n            anyhow::bail!(\"legacy SSE endpoint event did not include a POST endpoint\");\r\n        }\r\n        if let Ok(url) = url::Url::parse(endpoint) {\r\n            return Ok(url.to_string());\r\n        }\r\n        let base = url::Url::parse(base_url)\r\n            .map_err(|e| anyhow::anyhow!(\"invalid legacy SSE base URL '{}': {}\", base_url, e))?;\r\n        base.join(endpoint)\r\n            .map(|url| url.to_string())\r\n            .map_err(|e| anyhow::anyhow!(\"failed to resolve legacy SSE endpoint '{}': {}\", endpoint, e))\r\n    }\r\n\r\n    #[cfg(test)]\r\n    pub(super) fn route_incoming_value(\r\n        server_name: &str,\r\n        value: serde_json::Value,\r\n        response_tx: &mpsc::UnboundedSender<JsonRpcResponse>,\r\n        notification_tx: &mpsc::UnboundedSender<serde_json::Value>,\r\n    ) -> anyhow::Result<()> {\r","sourceCodeStart":399,"sourceCodeEnd":435,"githubUrl":"https://github.com/Kuberwastaken/claurst/blob/b0637c97ec34144387cbf2f74f65df6d16a6cef1/src-rust/crates/mcp/src/lib.rs#L399-L435","documentation":"Legacy SSE MCP servers first send an 'endpoint' event telling the client where to POST JSON-RPC messages. If that event's payload is empty or whitespace-only after trimming, the client cannot construct the POST endpoint and bails. This protects against malformed servers that open an SSE stream but never advertise a message endpoint.","triggerScenarios":"resolve_legacy_endpoint is called with an empty or whitespace-only endpoint string, i.e. the server's SSE 'endpoint' event carried no endpoint data.","commonSituations":"Server behind a proxy that strips the endpoint event body; a non-MCP SSE endpoint mistakenly registered as an MCP server; old/broken SSE server implementations; URL path not URL-encoded when parsed upstream.","solutions":["Verify the server actually implements the legacy SSE MCP handshake and emits an 'endpoint' event with a non-empty value","If the server supports the streamable HTTP transport, switch the config type from 'sse' to 'http'","Check intermediate proxies/gateways for rewriting or dropping the endpoint event payload","Confirm the base_url is correct so relative endpoints can be resolved"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match client.connect().await {\n    Err(e) if e.to_string().contains(\"legacy SSE endpoint event\") => {\n        // fall back to streamable HTTP transport or surface server-compat error\n    }\n    other => other?,\n}","preventionTips":["Prefer the streamable HTTP transport when the server supports it","Test MCP servers behind proxies for intact endpoint events","Pin to server versions known to implement the legacy SSE handshake correctly"],"tags":["mcp","sse","protocol","endpoint"],"backgroundTag":"unexpected-response-shape","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"}