MCP Config: Windows Path Handling
How to escape backslashes in Windows paths inside JSON, why %APPDATA% works in some places but not others, and which tools need PATH adjustments.
Detailed Explanation
JSON + Windows Paths = Backslash Soup
JSON requires literal backslashes to be doubled (\\). Windows paths are full of backslashes. The combination is a famous source of "why won't this server start?" headaches.
Escaping correctly
Wrong (single backslash):
"args": ["-y", "@modelcontextprotocol/server-filesystem", "C:\Users\me\Documents"]
This produces invalid JSON.
Right (escaped backslash):
"args": ["-y", "@modelcontextprotocol/server-filesystem", "C:\\Users\\me\\Documents"]
Even better — use forward slashes, which Node and Python both handle on Windows:
"args": ["-y", "@modelcontextprotocol/server-filesystem", "C:/Users/me/Documents"]
Where to save the config on Windows
Claude Desktop expects:
%APPDATA%\Claude\claude_desktop_config.json
The shell variable %APPDATA% resolves to C:\Users\<you>\AppData\Roaming for most installs. Note this is the save path, not a value you embed inside the JSON — when you reference paths in args, write them out fully.
npx and PATH
The Claude Desktop process inherits a minimal environment. If you installed Node via fnm, nvm-windows, or another version manager, the GUI app may not see npx on PATH and will log:
[error] Failed to spawn server: 'npx' is not recognized
Fixes:
- Install Node.js from nodejs.org (the system installer adds itself to user PATH that GUI apps see).
- Or, replace
"command": "npx"with the absolute path:"command": "C:\\Program Files\\nodejs\\npx.cmd".
uvx on Windows
The fetch server uses uvx. After installing uv with the PowerShell one-liner, restart your terminal and verify with uvx --version. Same PATH caveat applies — for Claude Desktop, you may need to use the absolute path: "command": "C:\\Users\\me\\.local\\bin\\uvx.exe".
Line endings in the config file
Use LF (not CRLF) inside the JSON file. Notepad++, VS Code, and Cursor all default to LF; only old Windows Notepad still inserts CRLF. CRLF inside JSON string values can cause parser oddities in some clients.
Use Case
Rolling out MCP across a mixed-OS team where the macOS folks have a working config and the Windows folks copy-paste it and immediately hit "can't find npx" or "invalid JSON" errors.