How to fix npx MCP servers failing to start in Cline on Windows?
In Cline on Windows, MCP servers configured to launch with
npxfail to start. This can occur when Node.js was not installed in the default location. Is there a configuration change that makes npx-based MCP servers work again?Originally asked on GitHub: https://github.com/cline/cline/issues/1247
3 answers
The thread is closed as completed: this is a Windows configuration workaround, not a Cline bug, and several users confirmed it works. The issue notes this can happen when Node.js was not installed in the default location.
The reporter's fix replaces the
npxcommand withnodeplus the full path tonpx-cli.js, adds theAPPDATAenvironment variable, and setstransporttostdio:json"mcp-server name": { "command": "node", "args": [ "C:\\Users\\<username>\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npx-cli.js", "-y", "package-name" ], "env": { "APPDATA": "C:\\Users\\<username>\\AppData\\Roaming" }, "transport": "stdio" }Replace
<username>with your actual Windows username. Ifnpx-cli.jsis not at%APPDATA%\npm\node_modules\npm\bin\, point to its actual location.A commenter used an alternative that also worked: skip npx entirely and launch each installed package's entry script directly with
node.exe:json"filesystem": { "command": "C:\\Program Files\\nodejs\\node.exe", "args": [ "C:\\Users\\XXXX\\AppData\\Roaming\\npm\\node_modules\\@modelcontextprotocol\\server-filesystem\\dist\\index.js", "E:\\Projects\\server-setup\\" ] }The same pattern was applied to
server-sequential-thinking,server-memory, and a local line-edit MCP server. The reporter explicitly notes this is only a possible fix, not a solution for every MCP problem.Did this work for you?What @Rakly3 tried on GitHub (Worked)
The reporter replaced
npxwithnodeand the full path tonpx-cli.js(C:\Users\<username>\AppData\Roaming\npm\node_modules\npm\bin\npx-cli.js), added theAPPDATAenvironment variable, and settransporttostdio. Comments 2 and 3 confirmed it worked for them.Source: https://github.com/cline/cline/issues/1247 (opens external site)
Did this work for you?What @NikolaSivkov tried on GitHub (Worked)
A commenter bypassed npx entirely, pointing
C:\Program Files\nodejs\node.exedirectly at each installed package's entry script (e.g.@modelcontextprotocol/server-filesystem/dist/index.js) in the MCP config.Source: https://github.com/cline/cline/issues/1247#issuecomment-2585400843 (opens external site)
Did this work for you?