Cursor 0.40.x – 0.42.xMCP / 插件
Cursor "MCP server failed to start — spawn npx ENOENT"
Error: MCP server failed to start (code -32000): spawn npx ENOENT
- 受影响版本
- 0.40.x – 0.42.x
- 修复版本
- —
- 最近验证
- Cursor 0.42.3
根因
Cursor 用 mcp.json 里的命令启动 MCP stdio 服务,但编辑器进程继承的 PATH 里没有 `npx`(macOS 图形启动、Windows 按用户安装 Node 时常见)。
复现步骤
在 mcp.json 用 `npx -y some-mcp` 添加 MCP 服务,重载后服务显示红色 failed to start。
解决方案 (3)
按社区投票排序。应用前请先确认验证版本。
84
#1适用版本 0.42.x
用 `npx` 的绝对路径替代裸 `npx`。用 `which npx`(macOS/Linux)或 `where npx`(Windows)找到路径,在 mcp.json 中设为 `"command": "/full/path/to/npx"`。
最近验证: Cursor 0.42.3 · community
41
#2适用版本 0.42.x
Windows 上设 `"command": "cmd"`,`"args": ["/c", "npx", "-y", "some-mcp"]`,让 shell 解析 npx。
最近验证: Cursor 0.42.1 · community
23
#3适用版本 0.41.x – 0.42.x
从终端启动 Cursor(`open -a Cursor` / `cursor .`),让它继承包含 nvm 的 shell PATH。
最近验证: Cursor 0.42.0 · community