Originally published on LinkedIn, 27 November 2024. Republished here with light editing.
Background#
This solution is inspired by and builds upon the workaround discussed in Issue #64. While the original solution was for macOS, this implementation is specifically for Windows systems using NVM (Node Version Manager).
Problem#
When using NVM or standard Node.js installation, the default configuration using npx commands fails to connect MCP servers in Claude Desktop.
Solution Overview#
The solution involves:
1. Installing MCP server packages globally instead of using npx
2. Using absolute paths to both the Node executable and server scripts
3. Modifying the configuration file to use these absolute paths
Step-by-Step Guide#
1. Locate Node.js and npm paths#
Open Command Prompt (CMD) as administrator and run:
where node
This will show your Node.js executable path. Example output:
D:\Program\nvm\node.exe
Then find your global npm packages location:
npm root -g
Example output:
D:\Program\nvm\node_modules
2. Install Required Packages Globally#
Run these commands in CMD:
npm install -g @modelcontextprotocol/server-filesystem
npm install -g @modelcontextprotocol/server-github
npm install -g @modelcontextprotocol/server-memory
npm install -g @modelcontextprotocol/server-puppeteer
npm install -g @modelcontextprotocol/server-brave-search
npm install -g @modelcontextprotocol/server-google-maps
npm install -g @modelcontextprotocol/server-postgres3. Verify Installations#
Check each package installation:
npm list -g @modelcontextprotocol/server-filesystem
npm list -g @modelcontextprotocol/server-github
npm list -g @modelcontextprotocol/server-memory
npm list -g @modelcontextprotocol/server-puppeteer
npm list -g @modelcontextprotocol/server-brave-search
npm list -g @modelcontextprotocol/server-google-maps
npm list -g @modelcontextprotocol/server-postgresExpected output format:
D:\Program\nvm -> .\
`-- @modelcontextprotocol/server-[package-name]@0.5.1
4. Update Configuration File#
Modify your claude_desktop_config.json with the following content (adjust paths according to your system):
{
"mcpServers": {
"sqlite": {
"command": "uvx",
"args": [
"mcp-server-sqlite",
"--db-path",
"D:\\github_repository\\test.db"
]
},
"filesystem": {
"command": "D:\\Program\\nvm\\node.exe",
"args": [
"D:\\Program\\nvm\\node_modules\\@modelcontextprotocol\\server-filesystem\\dist\\index.js",
"D:\\github_repository",
"D:\\github_repository\\image-generator"
]
},
"github": {
"command": "D:\\Program\\nvm\\node.exe",
"args": [
"D:\\Program\\nvm\\node_modules\\@modelcontextprotocol\\server-github\\dist\\index.js"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": ""
}
},
"postgres": {
"command": "D:\\Program\\nvm\\node.exe",
"args": [
"D:\\Program\\nvm\\node_modules\\@modelcontextprotocol\\server-postgres\\dist\\index.js",
"postgresql://localhost/mydb"
]
},
"memory": {
"command": "D:\\Program\\nvm\\node.exe",
"args": [
"D:\\Program\\nvm\\node_modules\\@modelcontextprotocol\\server-memory\\dist\\index.js"
]
},
"puppeteer": {
"command": "D:\\Program\\nvm\\node.exe",
"args": [
"D:\\Program\\nvm\\node_modules\\@modelcontextprotocol\\server-puppeteer\\dist\\index.js"
]
},
"brave-search": {
"command": "D:\\Program\\nvm\\node.exe",
"args": [
"D:\\Program\\nvm\\node_modules\\@modelcontextprotocol\\server-brave-search\\dist\\index.js"
],
"env": {
"BRAVE_API_KEY": ""
}
},
"google-maps": {
"command": "D:\\Program\\nvm\\node.exe",
"args": [
"D:\\Program\\nvm\\node_modules\\@modelcontextprotocol\\server-google-maps\\dist\\index.js"
],
"env": {
"GOOGLE_MAPS_API_KEY": ""
}
},
"fetch": {
"command": "uvx",
"args": [
"mcp-server-fetch"
]
}
},
"globalShortcut": "Ctrl+Q"
}5. Important Notes#
1. Replace all path references with your actual Node.js and npm paths
2. Use double backslashes (`\\`) in all Windows paths
3. Keep uvx commands unchanged
4. Make sure to add your API keys in the corresponding env sections if needed
6. Apply Changes#
1. Save the modified configuration file
2. Close Claude Desktop completely
3. Restart Claude Desktop as administrator
Verification#
After restart, all MCP servers should connect successfully. The uvx-based servers will continue to work as before, and the npm-based servers should now connect properly with the new configuration.
Troubleshooting#
If you encounter issues:
1. Verify all paths exist using dir command
2. Check global package installations using npm list -g
3. Ensure Claude Desktop is running with administrator privileges
4. Double-check all backslashes in paths
This solution has been tested on Windows 11 (Build 22631.4460) with Node.js managed by NVM.