Debugging MCP server not running
I have a MCP server installed globally and configure it in Cursor. It was working pretty well until today.
I've tried a few ways including restart the server/Cursor, and reinstalling it. But it is still not working.
The error log said:
2025-05-04 16:01:13.273 [info] >>>>> MCP Startup
2025-05-04 16:01:13.283 [info] ight: Handling CreateClient action
2025-05-04 16:01:13.283 [info] ight: Starting new stdio process with command: npx @playwright/mcp@latest
2025-05-04 16:01:13.654 [info] ight: Client closed for command
2025-05-04 16:01:13.654 [error] ight: Error in MCP: Client closed
2025-05-04 16:01:13.664 [info] ight: Handling ListOfferings action
2025-05-04 16:01:13.664 [error] ight: No server info found
2025-05-04 16:01:13.664 [info] ight: Handling ListOfferings action
2025-05-04 16:01:13.664 [error] ight: No server info found
And even the instructions from Claude didn't help. But after a few retries, I believe it's the node/npm version causes the issue. Not sure why my default node version was set to the very old 16
. So I used nvm to set the default Node version to 22
(which is required by codex
) with the command nvm alias default 22
. And once again reinstall the MCP server just to be safe. Now it's back to normal.
Follow up issue with Claude
Later on I had the same issue with Claude (first time trying to use MCP with Claude) while in Cursor they're working totally fine. This time ChatGPT helped by explaining that, changing the default Node version with nvm
only applies to the shell enviroment like in Terminal, but Claude still reads my default Node version from my system config which is the super old 14
. The suggested solution is to create a Shell Script Wrapper like this:
#!/bin/bash
source ~/.nvm/nvm.sh
nvm use 22 >/dev/null 2>&1
echo "Using Node version: $(node -v)" >&2
exec npx "$@"
And make it executable: chmod +x /path/to/mcp-run.sh
. Lastly, just use it as the command
in your MCP servers config like:
{
"mcpServers": {
"playwright": {
"command": "/path/to/mcp-run.sh",
"args": ["@playwright/mcp@latest"]
}
}
}
And my Claude is working fine now.