Hmbown/CodeWhale · error

reviewed plugin MCP endpoint must not contain a query or…

Error message

reviewed plugin MCP endpoint must not contain a query or fragment

What it means

reviewed_remote_endpoint_identity rejects remote MCP endpoint URLs containing a query string or fragment. Queries/fragments carry per-request or session state that would be baked into the reviewed identity and could smuggle parameters or change what the URL resolves to after approval. The endpoint must be a bare, stable origin+path URL.

Solutions

  1. Strip the query string and fragment so the endpoint is only scheme://host/path
  2. Move any key from the query into an authentication header or secret store
  3. Re-approve the plugin with the cleaned endpoint if the approved record contains the query-laden URL

Example fix

// before
"endpoint": "https://api.example.com/mcp?session=abc#tools"
// after
"endpoint": "https://api.example.com/mcp"
Defensive patterns

Strategy: validation

Validate before calling

function endpointIsBare(endpoint) {
  const u = new URL(endpoint);
  return u.search === '' && u.hash === '';
}

Prevention

When it happens

Trigger: Thrown when endpoint.query().is_some() or endpoint.fragment().is_some() — e.g. https://api.example.com/mcp?token=x or .../mcp#frag — during endpoint normalization in reviewed_remote_endpoint_identity.

Common situations: Copied a URL straight from a browser address bar (fragments/queries attached); embedded an API key in the query string because the vendor's docs suggested it; left a tracking suffix on the URL.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


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

Appendix: source

Thrown at crates/tui/src/mcp.rs:1114

#[cfg(windows)]
fn open_reviewed_launch_file(path: &Path) -> Result<fs::File> {
    crate::plugins::manifest::open_bundle_file(path)
        .context("open reviewed launch file without links, hard links, or write/delete sharing")
}

#[cfg(all(not(unix), not(windows)))]
fn open_reviewed_launch_file(path: &Path) -> Result<fs::File> {
    fs::File::open(path).context("open reviewed launch file")
}

fn reviewed_remote_endpoint_identity(endpoint: &str) -> Result<(String, String)> {
    let endpoint =
        reqwest::Url::parse(endpoint).context("reviewed plugin MCP endpoint is invalid")?;
    if !endpoint.username().is_empty() || endpoint.password().is_some() {
        anyhow::bail!("reviewed plugin MCP endpoint must not contain user information");
    }
    if endpoint.query().is_some() || endpoint.fragment().is_some() {
        anyhow::bail!("reviewed plugin MCP endpoint must not contain a query or fragment");
    }
    let origin = reviewed_remote_origin(&endpoint)
        .ok_or_else(|| anyhow::anyhow!("reviewed plugin MCP endpoint has an unsafe origin"))?;
    Ok((endpoint.to_string(), origin))
}

fn reviewed_remote_origin(endpoint: &reqwest::Url) -> Option<String> {
    if !endpoint.username().is_empty() || endpoint.password().is_some() {
        return None;
    }
    let host = endpoint.host_str()?;
    let allowed_scheme = endpoint.scheme() == "https"
        || (endpoint.scheme() == "http"
            && (host.eq_ignore_ascii_case("localhost")
                || host
                    .trim_matches(['[', ']'])
                    .parse::<std::net::IpAddr>()
                    .is_ok_and(|address| address.is_loopback())));

View on GitHub (pinned to 73e0f67d83)