Hmbown/CodeWhale · error

Refusing MCP server ' ': its remote endpoint no longer…

Error message

Refusing MCP server '{server_name}': its remote endpoint no longer matches the reviewed plugin origin

What it means

validate_remote_endpoint re-derives the reviewed plugin's remote MCP endpoint identity (canonical URL + origin) and compares it against what the user approved. This error is thrown when the endpoint or its origin differs from the approved values, i.e. the reviewed plugin now points somewhere it was not reviewed to point. It is a security tripwire preventing reviewed plugins from silently redirecting to a different remote server.

Solutions

  1. Re-review the plugin: remove it and re-approve the plugin with its new remote endpoint so the approved identity matches
  2. Verify the new endpoint is legitimate (check the plugin vendor) before re-approving — a changed endpoint can indicate a supply-chain compromise
  3. Restore the original endpoint value in the MCP server configuration to match what was reviewed

Example fix

// before
"endpoint": "https://api.newhost.example/mcp"  // no longer matches approved origin
// after
"endpoint": "https://api.reviewedhost.example/mcp"  // matches approved_remote_endpoint/origin, or re-approve the plugin
Defensive patterns

Strategy: validation

Validate before calling

fn endpoint_matches_approved(endpoint: &str, approved_endpoint: &str, approved_origin: &str) -> bool {
    let url = reqwest::Url::parse(endpoint).ok()?;
    if !url.username().is_empty() || url.password().is_some() { return false; }
    if url.query().is_some() || url.fragment().is_some() { return false; }
    url.as_str() == approved_endpoint
        && url.origin().ascii_serialization() == approved_origin
}

Prevention

When it happens

Trigger: validate_remote_endpoint is called when launching a reviewed-plugin MCP server; it bails when approved_remote_endpoint != canonical endpoint string or approved_remote_origin != derived origin. Any change to the plugin's declared remote URL after review triggers it.

Common situations: The plugin was updated upstream and changed its endpoint URL; the user edited the endpoint manually; URL canonicalization changes the stored string (scheme casing, default port, path normalization) so it no longer byte-matches the approved value.

Understand the failure class

Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.

Related errors


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

Appendix: source

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

        );
        crate::plugins::registry::verify_plugin_component_authority(
            &self.authority,
            self.required_capability(),
        )
        .map_err(|reason| {
            anyhow::anyhow!(
                "Refusing to {operation} MCP server '{server_name}' from plugin bundle `{}`: {reason}. {remediation}",
                self.authority.plugin_name
            )
        })
    }

    fn validate_remote_endpoint(&self, server_name: &str, endpoint: &str) -> Result<()> {
        let (endpoint, origin) = reviewed_remote_endpoint_identity(endpoint)?;
        if self.approved_remote_endpoint.as_deref() != Some(endpoint.as_str())
            || self.approved_remote_origin.as_deref() != Some(origin.as_str())
        {
            anyhow::bail!(
                "Refusing MCP server '{server_name}': its remote endpoint no longer matches the reviewed plugin origin"
            );
        }
        Ok(())
    }

    fn catalog_is_current(&self) -> bool {
        // Catalog exposure is an authority boundary too: stale tool, prompt,
        // or resource descriptions can steer the model even when the later
        // operation would be denied. Revalidate both the mutable reviewed
        // source and the Codewhale-owned stage before publishing any entry.
        crate::plugins::registry::verify_plugin_component_authority(
            &self.authority,
            self.required_capability(),
        )
        .is_ok()
    }
}

View on GitHub (pinned to 73e0f67d83)