MCP Server doesn't start in WSL Ubuntu with Error spawn ENOENT
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:
- Used this example https://www.digitalocean.com/community/tutorials/mcp-server-python
- Connected to my WSL Ubuntu
- Created Python virtual environment
- Attempted to run python3 -
Connection state: Error spawn python3 ENOENT - I am able to resolve python3 OK in Terminal
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}"
}
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.
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....
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}"
}
Excellent @MichaelKinsy that worked - thank you so much ;)
after hours gone, couldn't figure out! Thanks a ton!
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!