zed-industries/zed · error
unsupported MCP url scheme
Error message
unsupported MCP url scheme {} What it means
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).
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.
Example fix
# before: non-http scheme for an http-transport MCP server
# settings.json (Zed):
"context_servers": { "my-server": { "settings": { "url": "ws://localhost:8765/mcp" } } }
# after: http(s) endpoint for remote servers; command for local ones
"context_servers": { "my-server": { "settings": { "url": "http://localhost:8765/mcp" } } }
# or stdio:
"context_servers": { "my-server": { "command": { "path": "npx", "args": ["-y", "some-mcp-server"] } } } Defensive patterns
Strategy: validation
Validate before calling
// Validate the endpoint scheme before constructing the server
let scheme = endpoint.scheme();
anyhow::ensure!(matches!(scheme, "http" | "https"), "MCP endpoint must be http(s), got {scheme}"); Type guard
fn is_http_mcp_endpoint(endpoint: &url::Url) -> bool {
matches!(endpoint.scheme(), "http" | "https")
} Try / catch
match ContextServer::new_http(id, endpoint, headers, client, executor, timeout).await {
Err(err) if err.to_string().contains("unsupported MCP url scheme") => {
return Err(anyhow!("{err:#}; use http(s) for remote servers or the command/stdio config for local ones"));
}
result => result?,
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Context server request timeout
- Expected exactly one context server configuration
- remote context server settings not supported in 0.6.0
- Auth server metadata issuer mismatch: expected
- authorization server does not advertise…
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/1094430266e18f20.
Report an issue: GitHub.
Appendix: source
Thrown at crates/context_server/src/context_server.rs:80
}
}
pub fn http(
id: ContextServerId,
endpoint: &Url,
headers: HashMap<String, String>,
http_client: Arc<dyn HttpClient>,
executor: gpui::BackgroundExecutor,
request_timeout: Option<Duration>,
) -> Result<Self> {
let transport = match endpoint.scheme() {
"http" | "https" => {
log::info!("Using HTTP transport for {}", endpoint);
let transport =
HttpTransport::new(http_client, endpoint.to_string(), headers, executor);
Arc::new(transport) as _
}
_ => anyhow::bail!("unsupported MCP url scheme {}", endpoint.scheme()),
};
Ok(Self::new_with_timeout(id, transport, request_timeout))
}
pub fn new(id: ContextServerId, transport: Arc<dyn crate::transport::Transport>) -> Self {
Self::new_with_timeout(id, transport, None)
}
pub fn new_with_timeout(
id: ContextServerId,
transport: Arc<dyn crate::transport::Transport>,
request_timeout: Option<Duration>,
) -> Self {
Self {
id,
client: RwLock::new(None),
configuration: ContextServerTransport::Custom(transport),
request_timeout,View on GitHub (pinned to f4178619ac)