Run MCP servers in WSL

I think I have finally solved the issue for my particular situation, I hope it helps others here.

I am using WSL and nvm and I eventually worked out that when Cursor calls WSL bash, the WSL bash instance has no knowledge of the current user’s nvm install, npx nor their profile

So first you should enter which npx at a wsl prompt to find out where npx is installed

You will also need to check where your .nvm setup folder is located as well

So the solution is to manually initialise nvm and also to use the full location paths:

{
  "mcpServers": {
    "browser-tools": {
      "command": "wsl",
      "args": [
        "bash",
        "-c",
        "'source /home/hyprgk/.nvm/nvm.sh && /home/hyprgk/.nvm/versions/node/v20.18.0/bin/npx -y @agentdeskai/[email protected]'"
      ],
      "enabled": true
    }
  }
}

Obviously you should replace “/home/hyprgk/” with your own home folder

1 Like