Hmbown/CodeWhale · error
Failed to connect MCP server
Error message
Failed to connect MCP server '{server_name}': server is disabled What it means
An explicit connect request targeted a named MCP server whose configuration has `enabled = false`. The pool looks the server up in configured or dynamic servers, finds it, then refuses to start a connection because the server is disabled in config.
Solutions
- Enable the server in the MCP config (`enabled = true`) or via the UI/CLI toggle, then retry.
- Remove the `enabled = false` / disabled flag from the server's config block.
- If the server should not be used, stop calling connect for it and handle it as intentionally unavailable.
Example fix
// before (mcp config) [server.myserver] enabled = false // after [server.myserver] enabled = true
Defensive patterns
Strategy: validation
Validate before calling
if let Some(cfg) = pool.server_config(name) {
if !cfg.is_enabled() {
return Err(format!("server '{name}' is disabled; enable it before connecting"));
}
} Try / catch
match pool.connect(name).await {
Err(e) if e.to_string().ends_with("server is disabled") => {
// surface 'server disabled' to the user; do not retry
}
r => r?,
} Prevention
- Check `is_enabled()` from the server listing before issuing connects.
- Keep disabled servers out of auto-connect/startup lists.
- When toggling a server off, also drop pending/retry connect attempts for it.
When it happens
Trigger: Calling the pool's connect method for `server_name` when `server_config.is_enabled()` returns false.
Common situations: Server disabled in mcp config file (`enabled = false` or disabled via UI/CLI), stale dynamic server entry disabled earlier, user forgot they disabled a server after an auth failure.
Related errors
- MCP server ' ' is disabled
- Failed to find MCP server
- MCP pool has no configuration source to reload
- MCP server ' ' has no command configured
- MCP server ' ' has no command configured
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/bd020ca3328f77d1.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/mcp.rs:3199
tracing::debug!(
target: "mcp",
server = %server_name,
reason = "reconnect",
"detached MCP connection for reconnect"
);
}
// Check static config first, then dynamic servers
let server_config = self
.config
.servers
.get(server_name)
.cloned()
.or_else(|| self.dynamic_servers.read().get(server_name).cloned())
.ok_or_else(|| anyhow::anyhow!("Failed to find MCP server: {server_name}"))?;
if !server_config.is_enabled() {
anyhow::bail!("Failed to connect MCP server '{server_name}': server is disabled");
}
let mut connection = match McpConnection::connect_with_policy(
server_name.to_string(),
server_config,
&self.config.timeouts,
self.network_policy.as_ref(),
)
.await
{
Ok(connection) => connection,
Err(error) => {
self.note_connect_failure(server_name, &error);
if let Some(previous) = previous_connection {
tracing::debug!(
target: "mcp",
server = %server_name,
"reconnect failed; restored the previous MCP connection and its last-good catalog"View on GitHub (pinned to 73e0f67d83)