Fix spawn npx ENOENT for MCP servers on Windows (the cmd /c fix)
Fix "spawn npx ENOENT" for MCP servers on Windows Checked against the official docs: Oct 27, 2026 You add a local MCP server that starts with npx , it works on a Mac, and on Windows your AI client reports spawn npx ENOENT (or a vague "Connection closed" or "Failed to connect"). This is a well-known Windows quirk, and the usual fix is a three-word change to your config. This guide explains why it…
When attempting to create a local MCP server using npx on Windows, users often encounter the error "spawn npx ENOENT". This occurs because npx is a script launcher on Windows, not a standalone executable. Many MCP clients do not account for this and start server processes directly, causing the error. The recommended solution is to wrap the npx command with cmd /c, which instructs Windows to run the command and then exit.
To implement this fix, change the command in your MCP configuration from "npx" to "cmd /c npx". For example:
command: cmd
args: [ /c, npx, -y, @modelcontextprotocol/server-memory ]
This change allows cmd to execute npx correctly on Windows. It's important to note that not all clients require this fix; some, like Claude Desktop, can work with plain npx. However, if you experience the "spawn npx ENOENT" error, applying the cmd /c wrapper will resolve the issue. Additionally, ensure that you fully quit and reopen your MCP client after making the configuration change for it to take effect.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.