Workaround for Claude Desktop NPX-based MCP Servers
Solve Claude MCP server setup failures caused by Node.js version conflicts. Step-by-step workaround using NVM to fix the 'Unexpected token' error.
Setting MPC server rarely works from first time. For so long, I have resorted to advice in this blog. Today I have decided to make a slightly better workaround. I found out that adding:
{
"mcpServers": {
"version": {
"command": "node",
"args": ["--version"]
}
}
}
fails but prints the version of node used by Claude. This appears in the app error toast and in the logs.
2025-05-25T11:25:57.924Z [error] [version] Unexpected token 'v', "v15.3.0" is not valid JSON
What I have noticed is that Claude was always using the oldest node installed in my .nvm.
Now you guessed it, I kept deleting old node versions. I went as far as keeping the latest version only.