Fixes › Claude Desktop, Cursor, VS Code

MCP servers fail on Windows with npx (use cmd /c)

Claude DesktopCursorVS Code

The error

spawn npx ENOENT • 'npx' is not recognized • Connection closed (Windows only)

Why it happens

On Windows, npx is a npx.cmd batch script, which cannot be spawned directly without a shell. Clients that spawn the command directly fail.

How to fix it

  1. Wrap npx with cmd /c
    Make cmd the command and pass /c npx … as args.
    {
      "mcpServers": {
        "github": {
          "command": "cmd",
          "args": ["/c", "npx", "-y", "@modelcontextprotocol/server-filesystem", "C:\\Users\\you\\Desktop"]
        }
      }
    }
  2. Escape backslashes
    In JSON every Windows path backslash must be doubled: C:\\Users\\you.
  3. Add APPDATA if npm cannot find its cache
    Some setups need APPDATA passed through.
    "env": { "APPDATA": "C:\\Users\\you\\AppData\\Roaming\\" }

Related servers

Sources