codex icon indicating copy to clipboard operation
codex copied to clipboard

Windows can not launch MCP servers using PNPM

Open CXwudi opened this issue 2 months ago • 1 comments

What version of Codex is running?

0.30.0

Which model were you using?

gpt-5

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64

What steps can reproduce the bug?

Add a MCP server config, using pnpm:

[mcp_servers.deepwiki]
type = "stdio"
command = "pnpx"
args = ["-y", "supergateway", "--streamableHttp", "https://mcp.deepwiki.com/mcp"]

Then launch codex and type /mcp to see that MCP server "request timed out"

What is the expected behavior?

MCP servers should be connected normally

What do you see instead?

No response

Additional information

PNPM is working fine on Linux and WSL2, only if running from windows has this problem

Windows + PNPM was common problems with lots of CLI agent tool, Claude Code and Gemini CLI used to have this problems, but now they have already fixed this bug

CXwudi avatar Sep 06 '25 10:09 CXwudi

#2968 I sent a pull request that completely solves this problem by loading reactively. However, it hasn’t been reviewed, and now there are conflicts.

Using which in Rust makes your code Windows-friendly because it resolves the exact path to the command before execution.

On Linux/Mac, it behaves like the which shell command.

On Windows, it works like where, automatically handling .exe, .cmd, .bat, and PATHEXT rules.

This guarantees you're running the intended program rather than an alias or script and avoids environment and configuration conflicts.

AdsQnn avatar Sep 06 '25 12:09 AdsQnn