Kuberwastaken/claurst · error · anyhow::Error

Unknown MCP server

Error message

Unknown MCP server: {}

What it means

ConnectionManager::connect looks up the named server in its state map; if the name isn't registered, it returns this error without touching any connection state. Only servers present in the manager's configuration can be connected. It propagates to connect_all and restart.

Solutions

  1. Use a name exactly matching an entry in the MCP servers config (check spelling/case).
  2. Reload MCP server configuration before connecting.
  3. List available server names via the manager's state before calling connect/restart.

Example fix

// before
manager.connect("github").await?; // typo: config has 'GitHub'
// after
if !manager.is_configured("GitHub") {
    eprintln!("server 'GitHub' not in config; available: {:?}", manager.server_names());
    return Ok(());
}
manager.connect("GitHub").await?;
Defensive patterns

Strategy: validation

Validate before calling

fn assert_configured(manager: &ConnectionManager, name: &str) -> anyhow::Result<()> {
    anyhow::ensure!(
        manager.server_names().contains(&name.to_string()),
        "MCP server '{}' is not configured", name
    );
    Ok(())
}

Prevention

When it happens

Trigger: Calling connect(name) (or restart(name)) with a name that has no entry in the MCP server configuration map — typo'd name, server removed from config, or connect before config is loaded.

Common situations: Settings.json MCP server renamed while the UI holds a stale reference; case mismatch in server name; calling connect before add/register; calling restart on a server that failed to register at startup.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of Kuberwastaken/claurst@b0637c97ec (2026-09-10). Data as JSON: /api/errors/60987a7f7ff5c06f. Report an issue: GitHub.

Appendix: source

Thrown at src-rust/crates/mcp/src/connection_manager.rs:146

                    )
                }
            }
        } else {
            None
        };
        McpClient::connect(config, auth_token).await
    }

    // -----------------------------------------------------------------------
    // Connect / disconnect / restart
    // -----------------------------------------------------------------------

    /// Connect to a single server by name, marking status along the way.
    pub async fn connect(&self, name: &str) -> anyhow::Result<()> {
        let entry = self
            .state
            .get(name)
            .ok_or_else(|| anyhow::anyhow!("Unknown MCP server: {}", name))?;
        let state_arc = entry.value().clone();
        drop(entry); // release dashmap read-guard

        {
            let mut st = state_arc.lock().await;
            st.status = McpServerStatus::Connecting;
        }

        let config = {
            let st = state_arc.lock().await;
            expand_server_config(&st.config)
        };

        debug!(server = %name, transport = %config.server_type, command = ?config.command, url = ?config.url, "Connecting to MCP server");

        match Self::connect_expanded_config(name, &config).await {
            Ok(client) => {
                let tool_count = client.tools.len();

View on GitHub (pinned to b0637c97ec)