openai/codex · error · anyhow::Error

MCP server '{server}' is not connected

Error message

MCP server '{server}' is not connected

What it means

Error "MCP server '{server}' is not connected" thrown in openai/codex.

Source

Thrown at codex-rs/codex-mcp/src/connection_manager.rs:905

                view.metadata.environment_id
            );
        }
        if !view.tool_filter.allows(tool) {
            return Err(anyhow!(
                "tool '{tool}' is disabled for MCP server '{server}'"
            ));
        }
        let client = if wait_for_server {
            view.connection
                .client()
                .await
                .context("failed to get client")?
        } else {
            let client = view
                .connection
                .client
                .ready_client()
                .ok_or_else(|| anyhow!("MCP server '{server}' is not connected"))?;
            if client.client.is_closed().await {
                bail!("MCP server '{server}' is not connected");
            }
            client
        };

        let effective_timeout = match (view.tool_timeout, requested_timeout) {
            (Some(server_timeout), Some(requested_timeout)) => {
                Some(server_timeout.min(requested_timeout))
            }
            (server_timeout, requested_timeout) => server_timeout.or(requested_timeout),
        };
        let result: rmcp::model::CallToolResult = client
            .client
            .call_tool(tool.to_string(), arguments, meta, effective_timeout)
            .await
            .with_context(|| format!("tool call failed for `{server}/{tool}`"))?;

View on GitHub (pinned to 339751715c)

Solutions

  1. Check that MCP server '{server}' is configured and its startup succeeded; inspect its startup logs and retry the connection.

When it happens

Trigger: Thrown at codex-rs/codex-mcp/src/connection_manager.rs:905 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/614a3cf67cf37402. Report an issue: GitHub.