Hmbown/CodeWhale · error · anyhow::Error

Unsupported MCP transport

Error message

Unsupported MCP transport

What it means

After target validation, the entry's optional `transport` field is checked with validate_mcp_transport; a value outside the supported set is rejected. The mapped error hides the unsupported value so untrusted source content is never echoed.

Solutions

  1. Set transport to a supported value (omit it entirely for command/stdio entries; use a supported HTTP transport for url entries)
  2. Check the tool's documentation for the exact accepted transport strings (case-sensitive)
  3. Remove the transport field and let the tool infer it from command vs url

Example fix

// before
{"mcpServers":{"api":{"url":"https://mcp.example.com","transport":"websocket"}}}
// after
{"mcpServers":{"api":{"url":"https://mcp.example.com","transport":"sse"}}}
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = new Set(["sse","streamable-http"]); // confirm exact values in tool docs
function transportOk(t) { return t == null || SUPPORTED.has(t); }

Try / catch

catch, then compare the entry's transport string (case-sensitively) against the documented set

Prevention

When it happens

Trigger: An entry contains `transport` with a value the tool does not support, e.g. `"stdio"` on a url-based entry, `"websocket"`, or a typo like `"streamable_http"`.

Common situations: Copying entries from other MCP clients that support additional transports; case or spelling differences ("SSE" vs "sse"); mixing transport and target kinds the tool doesn't allow.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/2495292213c14de2. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/mcp/external_import.rs:218

        if let Some(command) = &server.command {
            anyhow::ensure!(
                !command.trim().is_empty() && !command.chars().any(char::is_control),
                "Invalid MCP command"
            );
        }
        if let Some(url) = &server.url {
            let parsed =
                reqwest::Url::parse(url).map_err(|_| anyhow::anyhow!("Invalid MCP URL"))?;
            anyhow::ensure!(
                matches!(parsed.scheme(), "http" | "https")
                    && parsed.host_str().is_some()
                    && parsed.username().is_empty()
                    && parsed.password().is_none(),
                "Unsupported MCP URL"
            );
        }
        super::validate_mcp_transport(server.transport.as_deref())
            .map_err(|_| anyhow::anyhow!("Unsupported MCP transport"))?;
        let hard_blocked = !server.is_enabled();
        out.push(ImportCandidate {
            summary: server_summary(&name, &server),
            name,
            source_kind: kind.clone(),
            source_path: path.to_path_buf(),
            content_hash: hash.clone(),
            hard_blocked,
            block_reason: hard_blocked.then(|| "Disabled at its source; cannot import".into()),
            server,
        });
    }
    Ok(out)
}

fn extract_servers_map(value: &Value) -> Vec<(String, Value)> {
    // Claude / team: { "mcpServers": { name: {...} } }
    // Marketplace catalog: { "servers": { name: {...} } } or array of {name, ...}

View on GitHub (pinned to 73e0f67d83)