Troubleshooting MCP on Windows: Paths, Permissions, and 'Client Closed' Errors
A complete developer's guide to fixing Model Context Protocol (MCP) issues on Windows, including file path escaping, configuration folder locations, and command execution problems.
Setting up the Model Context Protocol (MCP) on Windows is one of the most common sources of friction for developers. Path formatting, permission boundaries, and shell differences can lead to silent failures, disconnected tools, or the infamous Client closed error.
In this guide, we will cover the exact steps to locate your configuration files on Windows, escape paths correctly, and resolve common runtime issues.
1. Finding Your MCP Configuration Files on Windows
Unlike macOS and Linux where settings are generally standardized under home folders, Windows paths depend on how you installed your applications.
Claude Desktop Config Location
If you installed Claude Desktop, your configuration file (claude_desktop_config.json) is stored in one of two places:
-
Standard Installer (Recommended):
%APPDATA%\Claude\claude_desktop_config.jsonTypically expands to:
C:\Users\<YourUsername>\AppData\Roaming\Claude\claude_desktop_config.json -
MSIX / Windows Store Installer: If you installed Claude Desktop via the Microsoft Store or MSIX package, Windows virtualizes the folder structure:
%LOCALAPPDATA%\Packages\Anthropic.ClaudeDesktop_pc8ska8gcr5yt\LocalCache\Roaming\Claude\claude_desktop_config.json
Tip: You can quickly open this folder by pressing
Win + R, pasting%APPDATA%\Claude, and hitting Enter. If the folder doesn’t exist, create it manually.
Cursor & Windsurf Config Locations
- Cursor: Configuration is managed directly within the UI at Settings > Features > MCP. Cursor handles the background JSON configuration, but you can inspect or troubleshoot connections in the developer logs.
- Windsurf: Configuration is saved in:
Typically expands to:%USERPROFILE%\.codeium\windsurf\mcp_config.jsonC:\Users\<YourUsername>\.codeium\windsurf\mcp_config.json
2. Fixing the Windows Path Escaping Issue
A primary reason MCP servers fail to load on Windows is the backslash (\) character. In JSON, a backslash is an escape character. If you paste a standard Windows path directly into your JSON config, the parser will fail.
The Wrong Way:
{
"mcpServers": {
"my-server": {
"command": "node",
"args": ["C:\Users\Developer\my-mcp-server\dist\index.js"]
}
}
}
This results in a JSON parsing error because \U, \D, and \i are treated as invalid escape sequences.
The Correct Ways:
Option A: Escape your backslashes (Double Backslashes)
{
"mcpServers": {
"my-server": {
"command": "node",
"args": ["C:\\Users\\Developer\\my-mcp-server\\dist\\index.js"]
}
}
}
Option B: Use forward slashes (Recommended)
Node.js and Python on Windows natively support forward slashes (/). Using forward slashes is cleaner and prevents syntax errors:
{
"mcpServers": {
"my-server": {
"command": "node",
"args": ["C:/Users/Developer/my-mcp-server/dist/index.js"]
}
}
}
3. Resolving the “Client Closed” and “No Tools Found” Errors
The Client closed error indicates that the host application (like Claude Desktop) launched the command, but the process terminated immediately or sent malformed data.
Root Cause 1: Diagnostic Logs or Warnings on stdout
MCP servers communicate with the host via Standard Input/Output (stdio). When an AI client starts your server, it listens strictly on stdout for JSON-RPC messages.
If your code, a third-party library, or Node.js itself prints any regular text or warnings to stdout, the client fails to parse it as JSON-RPC and shuts down the connection.
- The Fix: Never use
console.log()for debugging or status messages in your MCP server code. Useconsole.error()instead. The client redirectsstderrto log files, keepingstdoutclean for JSON-RPC messages.
Root Cause 2: Execution Policy & Script Commands
If you configure a command like "npm" or "npx", Windows might not execute it correctly because they are batch scripts (.cmd or .ps1) under the hood.
- The Fix: Use absolute paths to run the node executable or target the script command wrappers explicitly:
{ "mcpServers": { "github": { "command": "npx.cmd", "args": ["-y", "@modelcontextprotocol/server-github"], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "your-token" } } } }
4. Troubleshooting Steps for Windows
If your MCP tools are still not showing up in Claude Desktop or Cursor, follow this step-by-step checklist:
-
Verify PATH Environment Variables: Ensure
node,npm, andpythonare added to your system’s environment variables. Open a fresh Command Prompt or PowerShell window and verify:node --version npm --version -
Test Command in CLI: Run the command configured in your JSON file directly in the terminal:
node C:/Users/Developer/my-mcp-server/dist/index.jsThe process should wait silently (listening for input). If it crashes or outputs anything other than standard JSON-RPC packets, fix the runtime errors before adding it to the client.
-
Check Client Logs: If Claude Desktop fails to connect, review its logs at:
%APPDATA%\Claude\logs\mcp.logThis log contains the exact errors thrown when trying to spawn or interact with your servers.
Conclusion
Windows environment setup is straightforward once you remember two simple rules: always escape backslashes (or use forward slashes), and keep stdout strictly reserved for JSON-RPC.
To easily create and test your configurations without syntax errors, try our Visual MCP Config Builder which automatically handles formatting and outputs valid configurations ready to copy.