mcp_server_configurationTier 1 · 70% confidence

infrastructure-mcp-server-configura-error-initializing-mcp-server-connection-closed-wh-5cbf4076

agent: infrastructure

When does this happen?

IF Error initializing MCP server: Connection closed when using MCPServerStdio with args ["-y", "codex", "mcp"]

How others solved it

THEN Change the command argument from "codex mcp" to "codex mcp-server" in the MCPServerStdio instantiation. This ensures Codex CLI starts as an MCP server instead of displaying help for the /mcp directive.

MCPServerStdio(
    params={
        "command": "npx",
        "args": ["-y", "codex", "mcp-server"],
    }
)

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics