{"record":{"id":"1094430266e18f20","repo":"zed-industries/zed","slug":"unsupported-mcp-url-scheme","errorCode":null,"errorMessage":"unsupported MCP url scheme {}","messagePattern":"unsupported MCP url scheme (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/context_server/src/context_server.rs","lineNumber":80,"sourceCode":"        }\n    }\n\n    pub fn http(\n        id: ContextServerId,\n        endpoint: &Url,\n        headers: HashMap<String, String>,\n        http_client: Arc<dyn HttpClient>,\n        executor: gpui::BackgroundExecutor,\n        request_timeout: Option<Duration>,\n    ) -> Result<Self> {\n        let transport = match endpoint.scheme() {\n            \"http\" | \"https\" => {\n                log::info!(\"Using HTTP transport for {}\", endpoint);\n                let transport =\n                    HttpTransport::new(http_client, endpoint.to_string(), headers, executor);\n                Arc::new(transport) as _\n            }\n            _ => anyhow::bail!(\"unsupported MCP url scheme {}\", endpoint.scheme()),\n        };\n        Ok(Self::new_with_timeout(id, transport, request_timeout))\n    }\n\n    pub fn new(id: ContextServerId, transport: Arc<dyn crate::transport::Transport>) -> Self {\n        Self::new_with_timeout(id, transport, None)\n    }\n\n    pub fn new_with_timeout(\n        id: ContextServerId,\n        transport: Arc<dyn crate::transport::Transport>,\n        request_timeout: Option<Duration>,\n    ) -> Self {\n        Self {\n            id,\n            client: RwLock::new(None),\n            configuration: ContextServerTransport::Custom(transport),\n            request_timeout,","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/context_server/src/context_server.rs#L62-L98","documentation":"When constructing an HTTP-based MCP context server, the factory inspects `endpoint.scheme()` and only accepts `http` and `https`; every other scheme (file:, ws://, stdio:, unknown) bails with the offending scheme name. Remote MCP servers in this codebase are HTTP-only; other transports are built elsewhere (e.g., stdio transport from command configuration).","triggerScenarios":"Creating a context server from an endpoint URL whose scheme isn't http/https: `file:///path/to/server`, `ws://host/mcp`, `sse://...` (legacy), a scheme-less/malformed URL that parsed into an unexpected scheme, or a config typo like `http//host` that changes how the URL parses.","commonSituations":"Pointing an http-transport MCP config at a WebSocket endpoint; pasting a local binary path where a URL is expected; older SSE-style MCP URLs; URL formatting mistakes that shift the scheme field.","solutions":["Use an `http://` or `https://` URL for remote MCP servers.","For a local command-based server, configure it via the stdio/command transport instead of a URL.","Fix malformed URLs: verify with a URL parser or `curl` that the scheme and host parse as intended.","If you need ws/sse transports, check for a newer version where transports may be registered, or contribute the transport."],"exampleFix":"# before: non-http scheme for an http-transport MCP server\n# settings.json (Zed):\n\"context_servers\": { \"my-server\": { \"settings\": { \"url\": \"ws://localhost:8765/mcp\" } } }\n\n# after: http(s) endpoint for remote servers; command for local ones\n\"context_servers\": { \"my-server\": { \"settings\": { \"url\": \"http://localhost:8765/mcp\" } } }\n# or stdio:\n\"context_servers\": { \"my-server\": { \"command\": { \"path\": \"npx\", \"args\": [\"-y\", \"some-mcp-server\"] } } }","handlingStrategy":"validation","validationCode":"// Validate the endpoint scheme before constructing the server\nlet scheme = endpoint.scheme();\nanyhow::ensure!(matches!(scheme, \"http\" | \"https\"), \"MCP endpoint must be http(s), got {scheme}\");","typeGuard":"fn is_http_mcp_endpoint(endpoint: &url::Url) -> bool {\n    matches!(endpoint.scheme(), \"http\" | \"https\")\n}","tryCatchPattern":"match ContextServer::new_http(id, endpoint, headers, client, executor, timeout).await {\n    Err(err) if err.to_string().contains(\"unsupported MCP url scheme\") => {\n        return Err(anyhow!(\"{err:#}; use http(s) for remote servers or the command/stdio config for local ones\"));\n    }\n    result => result?,\n}","preventionTips":["Parse and check `url::Url::scheme()` at config-load time so bad endpoints fail fast with the key path in the message.","Use http(s) URLs for remote MCP servers; use the command (stdio) configuration for local binaries.","Beware legacy `sse://` or `ws://` endpoints — this HTTP transport accepts neither."],"tags":["mcp","context-server","url","scheme","http-transport"],"backgroundTag":"unsupported-url-scheme","analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}