Skip to content

MCP stdio server fails to initialize unless Codex is started with a -c log_dir=... override on Windows #51803

Open

Description

@m0nteg0

What version of Codex CLI is running?

codex-cli 0.161.0

What subscription do you have?

plus

Which model were you using?

No response

What platform is your computer?

Windows 11

What terminal emulator and version are you using (if applicable)?

PowerShell

Codex doctor report

What issue are you seeing?

On Windows, a configured stdio MCP server fails to initialize when Codex is started normally:

codex

The MCP server appears as:

unreal-engine: failed (0 tools)

However, starting Codex with an explicit log_dir CLI override makes the same MCP server connect successfully:

codex -c 'log_dir="D:/development/projects/ue5/StartProject/.codex-log"'
The interesting part is that adding the exact same log_dir setting to ~/.codex/config.toml does not fix the issue:

log_dir = "D:/development/projects/ue5/StartProject/.codex-log"

So the behavior appears to depend on passing a configuration override via -c, rather than on log_dir itself.

When Codex is started with the -c log_dir=... workaround, the MCP connection is fully functional, not just reported as connected. I can successfully execute MCP operations that modify the Unreal Editor scene.

Environment
OS: Windows 11
Codex CLI: 0.161.0
MCP transport: stdio
MCP server: unreal-engine-mcp-server@beta
MCP server runtime: Node.js / npx
MCP github: https://github.com/ChiR24/Unreal_mcp

What steps can reproduce the bug?

  1. Start Codex normally:

codex

  1. Check /mcp.

Result:

unreal-engine: failed (0 tools)

  1. Exit Codex.

  2. Start it with an explicit CLI config override:

codex -c 'log_dir="D:/development/projects/ue5/StartProject/.codex-log"'

  1. Check /mcp again.

Result: the MCP server connects successfully and its tools work.

What is the expected behavior?

No response

Additional information

This looks like it may be related to Codex startup/config initialization on Windows rather than to the MCP server itself, because:

  • the MCP server starts successfully outside Codex;
  • Codex reads the MCP configuration correctly;
  • the server uses stderr for diagnostic output;
  • the connection works reliably when any explicit -c log_dir=... override is supplied;
  • putting the same log_dir value in config.toml does not have the same effect.

Activity

  1. added
    bug
    on Oct 7, 2026
  2. added
    CLI
    windows-os
    mcp
    config
    on Oct 7, 2026
  3. naelonambul commented on Oct 20, 2026

    @naelonambul

    Sharing a related case on Windows in case it helps:

    Environment:

    • OS: Windows 11
    • Codex CLI: 0.163.0 (PyCharm / TUI)
    • MCP Server: Chrome DevTools MCP
    • Node Setup: Installed via nvm

    What happened:

    1. codex mcp list showed the server as enabled, but in the TUI it initially showed failed (0 tools).
    2. Root cause (PATH): The nvm Node installation directory was missing from the MCP process PATH, so node/npx could not be resolved.
    3. Fix & Result: After explicitly adding the Node directory to the MCP process PATH, the status changed from failed (0 tools) to connected (32 tools).

    About the -c log_dir=... workaround:
    While I didn't test it myself, my coworkers tested the -c log_dir=... workaround and confirmed that changing the log directory name on each launch (e.g., appending 2, 3, etc.) makes the tools work again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIbugconfigmcpwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions