Repository navigation
Description
Summary
VS Code running on Windows using Remote-SSH to connect to a Linux code workspace with .mcp.json, causes MCP servers to error on start with Connection state: Error spawn /path/to/mcp-server ENOENT. Opening the same code workspace in VS Code running on Linux loads the same .mcp.json and MCP servers without issues.
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.123.0 (verified at commit
c83b87ffb27e2fe0cf7a7f358d48b2edb3e797de) - OS Version: Windows 11 client → Linux remote (Remote-SSH)
Steps to Reproduce:
-
From a Windows VS Code client, connect via Remote-SSH to a Linux host.
-
Create
.mcp.jsonat the workspace root with any stdio server using an absolute remote command path:{ "mcpServers": { "echo": { "type": "stdio", "command": "/bin/echo", "args": ["hello"] } } } -
Trust the server. Run
MCP: List Servers→echo→Show Output.
Expected: Server spawns successfully. /bin/echo is an absolute, valid Linux path.
Actual: Server fails with Connection state: Error spawn /bin/echo ENOENT.
The same definition placed in .vscode/mcp.json (top-level key "servers" instead of "mcpServers") starts cleanly. Opening the same code workspace directly in Linux also works.
Failing log
2026-06-05 12:46:22.270 [info] Starting server my-mcp-server
2026-06-05 12:46:22.270 [info] Connection state: Starting
2026-06-05 12:46:22.270 [info] Starting server from Remote extension host
2026-06-05 12:46:22.365 [info] Connection state: Starting
2026-06-05 12:46:22.365 [info] Connection state: Error spawn /path/to/mcp-server ENOENT
The path to /path/to/mcp-server is valid and can be found in the integrated terminal. The Starting server from Remote extension host line confirms the spawn happens on the Linux remote.
Identified root cause
The .mcp.json discovery adapter (claudeConfigToServerDefinition) computes cwd: cwd?.fsPath on the workbench side. On a Windows client, URI.fsPath flips forward slashes to backslashes based on the client OS, producing a string like \opt\example\workspace. That value is shipped to the Linux ext host and used as cwd in spawn(). The directory doesn't exist on Linux, the child's chdir() fails before execve, and Node reports the error as ENOENT against the command.
.vscode/mcp.json doesn't hit this because installedMcpServersDiscovery.ts propagates the workspace folder as a URI via variableReplacement.folder - fsPath is then evaluated on the Linux ext host where slashes stay forward.
Workaround
Move the contents of .mcp.json into .vscode/mcp.json and rename the top-level key from "mcpServers" to "servers".
Notes
.cursor/mcp.json(CursorWorkspaceMcpDiscoveryAdapter) uses the same adapter and is likely also affected.
Activity
sw23 commentedon Jun 25, 2026
Dmitriy Vasyura (@dmitrivMS) I created a PR with proposed fix
but wasn't able to verify that it definitively resolves the issue, as Remote-SSH doesn't support local builds. If there's a way to test a side official release, let me know and I'll try it! ThanksUpdate 6/26/26 - I was able to test this by having Copilot apply a JS bundle patch version of this PR to my live VS Code instance instead of trying to re-build from scratch with the fix (Remote-SSH doesn't allow this). With the patch applied, I confirmed that VS Code with Remote-SSH is able to connect to MCP servers in .mcp.json without generating the ENOENT error. I reviewed the JS patch line-by-line to confirm it reflects the code changes in this PR (happy to provide details if requested. thanks!
cdenney-silex commentedon Jul 9, 2026
I'm seeing a similar issue with running VSCode on Windows and attaching to a kubernetes container in OpenShift DevSpaces. Does the PR only fix Remote-SSH specifically, or would it extend to other remote sessions types like Dev Containers?
sw23 commentedon Jul 13, 2026
cdenney-silex the issue and fix should apply to Dev Containers and Kubernetes/DevSpaces as well, as long as there's a
.mcp.jsonfile on the remote side (doesn't apply to.vscode/mcp.json) and the connection is from Window to a Linux remote.