Hmbown/CodeWhale · error

MCP server ' ' connection to ' ' requires approval; re-run…

Error message

MCP server '{name}' connection to '{host}' requires approval; re-run after `/network allow {host}` or set network.default = "allow" in config

What it means

When the network policy returns Decision::Prompt for an MCP server's host and no interactive approval can be granted (or the session cannot prompt), the client bails with instructions: allow the host via `/network allow {host}` or set network.default = "allow". Nothing was connected; the error is an approval gate.

Solutions

  1. Run `/network allow <host>` for the host named in the error, then retry
  2. Set `network.default = "allow"` in config if you trust all hosts
  3. Add an explicit allow rule for the host in the network config
  4. Pre-approve hosts when running in CI so no interactive prompt is needed

Example fix

// before (config)
[network]
default = "prompt"
// after
[network]
default = "allow"
# or keep prompt and add: allow = ["mcp.example.com"]
Defensive patterns

Strategy: fallback

Validate before calling

let host = url::Url::parse(&cfg.url)?.host_str().unwrap_or_default();
let approved = allowed_hosts.contains(host) || cfg.network.default == "allow";
if !approved { /* pre-run `/network allow <host>` or adjust config */ }

Try / catch

match err {
    e if e.to_string().contains("requires approval") => {
        // surface host to user / retry after `/network allow <host>`
    }
    e => return Err(e),
}

Prevention

When it happens

Trigger: Connecting an MCP server whose host is not explicitly allowed while the policy default requires per-host approval (network.default is not "allow" and no standing rule covers the host).

Common situations: First connection to a brand-new MCP server under a default-deny/prompt policy; running non-interactively (CI, scripted sessions) where a prompt cannot be answered; config copied to a machine with stricter network defaults.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


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

Appendix: source

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

                Arc::clone(&authority_revocation_reason),
            )
        });
        let transport: Box<dyn McpTransport> = if let Some(url) = &config.url {
            // Per-domain network policy gate (#135). Only the HTTP/SSE transport
            // is gated; STDIO MCP servers run as local subprocesses and never
            // touch the network from this code path.
            if let Some(decider) = network_policy
                && let Some(host) = host_from_url(url)
            {
                match decider.evaluate(&host, "mcp") {
                    Decision::Allow => {}
                    Decision::Deny => {
                        anyhow::bail!(
                            "MCP server '{name}' connection to '{host}' blocked by network policy"
                        );
                    }
                    Decision::Prompt => {
                        anyhow::bail!(
                            "MCP server '{name}' connection to '{host}' requires approval; \
                             re-run after `/network allow {host}` or set network.default = \"allow\" in config"
                        );
                    }
                }
            }
            let client = http_client::McpHttpClient::new(
                url,
                config.runtime_added,
                config.reviewed_plugin.is_some(),
                config.allow_private_network,
                network_policy,
                Duration::from_secs(connect_timeout_secs),
                Duration::from_secs(read_timeout_secs),
            )?;
            let oauth_runtime = if config.reviewed_plugin.is_some() {
                None
            } else {

View on GitHub (pinned to 73e0f67d83)