{"record":{"id":"6d7e30e61adb8942","repo":"Hmbown/CodeWhale","slug":"mcp-server-name-connection-to-host-require","errorCode":null,"errorMessage":"MCP server '{name}' connection to '{host}' requires approval; re-run after `/network allow {host}` or set network.default = \"allow\" in config","messagePattern":"MCP server '(.+?)' connection to '(.+?)' requires approval; re-run after `/network allow (.+?)` or set network\\.default = \"allow\" in config","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"crates/tui/src/mcp.rs","lineNumber":1500,"sourceCode":"                Arc::clone(&authority_revocation_reason),\n            )\n        });\n        let transport: Box<dyn McpTransport> = if let Some(url) = &config.url {\n            // Per-domain network policy gate (#135). Only the HTTP/SSE transport\n            // is gated; STDIO MCP servers run as local subprocesses and never\n            // touch the network from this code path.\n            if let Some(decider) = network_policy\n                && let Some(host) = host_from_url(url)\n            {\n                match decider.evaluate(&host, \"mcp\") {\n                    Decision::Allow => {}\n                    Decision::Deny => {\n                        anyhow::bail!(\n                            \"MCP server '{name}' connection to '{host}' blocked by network policy\"\n                        );\n                    }\n                    Decision::Prompt => {\n                        anyhow::bail!(\n                            \"MCP server '{name}' connection to '{host}' requires approval; \\\n                             re-run after `/network allow {host}` or set network.default = \\\"allow\\\" in config\"\n                        );\n                    }\n                }\n            }\n            // Honor the standard `HTTP_PROXY` / `HTTPS_PROXY` (and their\n            // lowercase equivalents) plus `NO_PROXY` env vars when\n            // reaching MCP HTTP servers (#1408). Reqwest 0.13 does not\n            // auto-detect these by default, so users behind corporate\n            // proxies, on China-mainland connections routing through a\n            // local Clash / Shadowsocks tunnel, etc. previously had MCP\n            // HTTP traffic bypass the proxy entirely while every other\n            // tool on the box (curl, npm, …) used it.\n            // `connect_timeout` bounds only the connect phase; the total request\n            // timeout is the read timeout (a sane backstop) so per-call\n            // execute_timeout can actually govern request duration. Previously\n            // this set reqwest's TOTAL `.timeout()` from connect_timeout (10s),","sourceCodeStart":1482,"sourceCodeEnd":1518,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/tui/src/mcp.rs#L1482-L1518","documentation":"The same network-policy gate as the Deny case, but the decider returned Prompt: the host is neither allowed nor denied and the default posture requires interactive approval before this host may be contacted (crates/tui/src/mcp.rs:1499-1504). Because connect_with_policy does not prompt interactively, it fails immediately with the remediation embedded in the message.","triggerScenarios":"First connection to a new remote MCP host under the default prompt posture; the host has not been added to the session allow list.","commonSituations":"Fresh installs; newly added servers in config; scripted or CI contexts where nobody can answer an interactive prompt.","solutions":["Run /network allow <host> in the session, then retry the operation.","Or set [network] default = \"allow\" in ~/.codewhale/config.toml to stop prompting globally (a weaker posture - prefer per-host allows).","For scripts/CI, pre-allowlist the exact MCP hosts before starting the run."],"exampleFix":"# before: connect fails\n#   MCP server 'linear' connection to 'mcp.linear.app' requires approval\n# after (session-scoped): run in the TUI, then retry\n#   /network allow mcp.linear.app\n# after (config, ~/.codewhale/config.toml):\n#   [network]\n#   default = \"allow\"","handlingStrategy":"validation","validationCode":"// Before connecting under a prompt-default posture, confirm the host is\n// already allowlisted for this session (via /network allow <host>).\nuse crate::network_policy::{host_from_url, Decision};\n\nfn host_preapproved(policy: &NetworkPolicyDecider, url: &str) -> bool {\n    match host_from_url(url) {\n        Some(host) => !matches!(policy.evaluate(&host, \"mcp\"), Decision::Prompt | Decision::Deny),\n        None => false,\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pre-allowlist remote MCP hosts with /network allow <host> before first use.","In CI/scripts, allowlist hosts in setup rather than weakening the default.","Prefer per-host allows over setting network.default = \"allow\" globally."],"tags":["network","policy","mcp","approval"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}