How to use any MCP servers in WSL with NVM?

What I’ve tried:

C:\Windows\System32\wsl.exe -e bash -ic "cd /home/myname/mcp-servers/supabase-mcp && /home/myname/.nvm/versions/node/v20.18.0/bin/node build/index.js"

Results in the Cursor Settings > MCP Servers screen showing:
NO TOOLS FOUND

Repeating that command in wsl bash works fine though

   bash -ic "cd /home/myname/mcp-servers/supabase-mcp && /home/myname/.nvm/versions/node/v20.18.0/bin/node build/index.js"
**Supabase MCP server running on stdio**

So this isn’t an mcp server specific issue.

Has anyone got MCP servers up and running in WSL, using NVM?

2 Likes

Dear developers.

I have the same problem. I went into WSL hoping to fix a problem with MCP servers on Windows, but if I open Cursor in WSL with npx installed, Cursor still can’t process tools properly and gives the same error

1 Like

I would not be suprised if MCP servers are not yet supported over WSL or SSH fully yet.

I’ll throw this to the team to make sure we try to get this sorted in the future!

2 Likes

Hi @salsr
This seems to work for me:

    "filesystem_cursor_test": {
      "command": ["wsl.exe"],
      "args": [
        "bash -c 'source /home/myname/.nvm/nvm.sh; npx -y @modelcontextprotocol/server-filesystem /home/myname/projects/myapp'"
      ]
    }

Unfortunately it seems to open a cmd window. I will look into this later.

1 Like

Thanks for the response @mikaelh but with the new Cursor Settings > MCP Servers (0.46.6)

How are you structuring that config within the MCP Servers +Add new MCP Server, for example I want to run this:

Name: browser-tools
Type: command
Command: npx @agentdeskai/browser-tools-mcp

I’ve tried changing the command to:

cmd /c npx @agentdeskai/browser-tools-mcp

or to:

"wsl.exe 'npx @agentdeskai/browser-tools-mcp'"

I keep on getting “Failed to create client”

1 Like

I encountered the same issue.

Whilst we wait for the Cursor team to work out a better solution here, I now

Install NodeJS in Windows, install MCP globally within Windows and then within MCP Servers run the package like:

node C:\\Users\\<yourname>\\AppData\\Roaming\\npm\\node_modules\\@agentdeskai\\browser-tools-mcp\\dist\\mcp-server.js

It’s less than ideal.

As i was in the same boat,
to by-pass the current restriction (cursor try to run the MCP on the host),
i launch a MCP server from the wsl side, and then use MCP over sse in cursor.

To be clear are you installing the mcp or running npx?

it depends of the mcp, but for the moment you need to have a MCP that can be installed in WSL and runnning as a server with SSE, with that you can choose in cursor the server mode for your MCP instead of the command one.
But your MCP must have a server mode. for my need i have made one myself with bunjs, and creating some tool. here a gist of the server if you like living on the edge :wink:

bun MCP sse server starting point

^ This is how I managed to resolve my similar issue when using WSL with nvm. Hopefully it helps you fix your problems too!

1 Like

Thank you so much, this also worked for me. Specifically, I was using the convex MCP. I have been pulling my hair out over this one for a few days.

2 Likes

After hours and hours of trying different methods to get MCP to work on WSL2 this actually did it. You rock dude

1 Like