vscode icon indicating copy to clipboard operation
vscode copied to clipboard

MCP Server doesn't start in WSL Ubuntu with Error spawn ENOENT

Open neilmcalister opened this issue 6 months ago • 6 comments

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.101.0
  • OS Version: Windows_NT x64 10.0.26100

Steps to Reproduce:

  1. Used this example https://www.digitalocean.com/community/tutorials/mcp-server-python
  2. Connected to my WSL Ubuntu
  3. Created Python virtual environment
  4. Attempted to run python3 - Connection state: Error spawn python3 ENOENT
  5. I am able to resolve python3 OK in Terminal

Image

Image

neilmcalister avatar Jun 14 '25 20:06 neilmcalister

Just wanted to put this out there for any other unfortunate souls that run into this, as of now the easiest and only fix I've been able to find is adding "cwd": "${workspaceFolder}" to your server definition.

e.g.

"Context7": {
    "type": "stdio",
    "command": "npx",
    "args": [
        "-y",
        "@upstash/context7-mcp@latest"
    ],
    "cwd": "${workspaceFolder}"
}

MichaelKinsy avatar Jun 15 '25 16:06 MichaelKinsy

Data point for any triager out there, in my experience this bug persists on WSL, Windows native, remote ssh instances, and even across devices so seems to be tied to the v1.101.0 release.

MichaelKinsy avatar Jun 15 '25 17:06 MichaelKinsy

Just wanted to put this out there for any other unfortunate souls that run into this, as of now the easiest and only fix I've been able to find is adding "cwd": "${workspaceFolder}" to your server definition.

e.g.

"Context7": {
    "type": "stdio",
    "command": "npx",
    "args": [
        "-y",
        "@upstash/context7-mcp@latest"
    ],
    "cwd": "${workspaceFolder}"
}

Thanks @MichaelKinsy - that cwd certainly fixed the ENOENT error - but get another one - seems that it ignores Python environments that I'm using - mcp is installed there via pip....

Image

Image

neilmcalister avatar Jun 15 '25 17:06 neilmcalister

No problem @neilmcalister, then in this case it looks like maybe you have it installed in a venv not on your system python path?

If so you could instead modify your command to be bash then use -c as the args to activate your mcpserver01 environment and run the bash scrip all in one such as -

"mcp-with-venv": {
    "type": "stdio",
    "command": "bash",
    "args": [
        "-c",
        "source path/to/mcpserver01 && python3 sqlit-server.py"
    ],
    "cwd": "${workspaceFolder}"
}

MichaelKinsy avatar Jun 15 '25 18:06 MichaelKinsy

Excellent @MichaelKinsy that worked - thank you so much ;)

neilmcalister avatar Jun 15 '25 18:06 neilmcalister

after hours gone, couldn't figure out! Thanks a ton!

dee1984in avatar Jun 16 '25 01:06 dee1984in

Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for similar existing issues. See also our issue reporting guidelines.

Happy Coding!