MoonshotAI / MoonshotAI/kimi-code

[Windows] stdio MCP servers with bare commands (npx, ...) fail with "spawn ENOENT" since 0.37.x

Open
#3,216 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.5k
Forks
1.2k
Avg merge
11h 53m
Merged PRs (30d)
350

Description

Summary

On Windows, stdio MCP servers configured with bare command names (npx, codegraph, ...) fail to start with spawn <cmd> ENOENT since 0.37.x. The identical config works on 0.36.0. Servers pointing at an absolute .exe path are unaffected.

This config style matches the official docs example ("command": "npx"): https://www.kimi.com/code/docs/en/kimi-code-cli/customization/mcp.html

Environment

  • OS: Windows 11 (10.0.22621)
  • Kimi Code CLI: 0.37.2 and 0.38.0 (regression introduced between 0.36.0 and 0.37.2)
  • Node.js: v24.17.0 at D:\node.js\ (on system PATH); npm global dir C:\Users\<user>\AppData\Roaming\npm (on user PATH)

Config (~/.kimi-code/mcp.json)

{
  "mcpServers": {
    "github": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"] },
    "codegraph": { "command": "codegraph", "args": ["mcp", "serve", "--root", ".", "--stdio"] }
  }
}

Actual behavior

From ~/.kimi-code/logs/kimi-code.log:

ERROR mcp server unavailable  server=github transport=stdio status=failed reason="spawn npx ENOENT"
ERROR mcp server unavailable  server=codegraph transport=stdio status=failed reason="spawn codegraph ENOENT"

All bare-command stdio servers fail this way; the one server configured with an absolute .exe path connects fine.

Evidence / timeline (from local logs)

  • 0.36.0 sessions (Aug 14 / 17 / 18): all MCP servers connect, zero errors.
  • First session running 0.37.2 (Aug 20, 02:22:27Z): the same second, the first spawn npx ENOENT / spawn codegraph ENOENT errors appear.
  • Every session since (0.37.2, then 0.38.0): same ENOENT for all four bare-command servers.

Environment did not change across the boundary: node.exe, npx.cmd, the npm shims and PATH entries all predate the regression by months.

Likely root cause

On Windows, npx / codegraph are .cmd shims, not executables. child_process.spawn('npx') without a shell cannot resolve them → ENOENT. Verified directly with Node on the same machine:

spawnSync('npx', ['--version'])                          -> ENOENT
spawnSync('cmd.exe', ['/d','/s','/c','npx','--version']) -> works

Presumably the CLI previously launched stdio MCP servers through a shell or resolved .cmd shims, and a recent change (possibly related to the binary-planting hardening in 0.35.0/0.36.0) switched MCP server spawning to bare spawn in 0.37.x.

Workaround

Wrap the command in cmd.exe:

{ "command": "cmd.exe", "args": ["/d", "/s", "/c", "npx", "-y", "@modelcontextprotocol/server-github"] }

All affected servers connect fine with this wrapper.

Expected behavior

Bare command names in stdio MCP config keep working on Windows (resolve via PATHEXT / shell), or the docs explicitly state the Windows requirement.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the stdio MCP server launch path and compare versions 0.36.0 and 0.37.2, focusing on Node child_process.spawn behavior for Windows .cmd shims. Reproduce with the provided mcp.json using bare npx and codegraph commands, then verify that bare-command servers work on Windows while absolute .exe paths remain unaffected.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.