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.json at 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
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 withConnection state: Error spawn /path/to/mcp-server ENOENT. Opening the same code workspace in VS Code running on Linux loads the same.mcp.jsonand MCP servers without issues.Does this issue occur when all extensions are disabled?: Yes
c83b87ffb27e2fe0cf7a7f358d48b2edb3e797de)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/echois 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
The path to
/path/to/mcp-serveris valid and can be found in the integrated terminal. TheStarting server from Remote extension hostline confirms the spawn happens on the Linux remote.Identified root cause
The
.mcp.jsondiscovery adapter (claudeConfigToServerDefinition) computescwd: cwd?.fsPathon the workbench side. On a Windows client,URI.fsPathflips 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 ascwdinspawn(). The directory doesn't exist on Linux, the child'schdir()fails beforeexecve, and Node reports the error asENOENTagainst the command..vscode/mcp.jsondoesn't hit this becauseinstalledMcpServersDiscovery.tspropagates the workspace folder as aURIviavariableReplacement.folder-fsPathis then evaluated on the Linux ext host where slashes stay forward.Workaround
Move the contents of
.mcp.jsoninto.vscode/mcp.jsonand rename the top-level key from"mcpServers"to"servers".Notes
.cursor/mcp.json(CursorWorkspaceMcpDiscoveryAdapter) uses the same adapter and is likely also affected.