Skip to content

VS Code Remote-SSH Windows to Linux .mcp.json error ENOENT #320167

Closed

Description

@sw23

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:

  1. From a Windows VS Code client, connect via Remote-SSH to a Linux host.

  2. 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"] }
      }
    }
  3. 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

Activity

  1. sw23 commented on Jun 25, 2026

    @sw23
    Author

    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! Thanks

    Update 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!

  2. cdenney-silex commented on Jul 9, 2026

    @cdenney-silex

    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?

  3. sw23 commented on Jul 13, 2026

    @sw23
    Author

    cdenney-silex the issue and fix should apply to Dev Containers and Kubernetes/DevSpaces as well, as long as there's a .mcp.json file on the remote side (doesn't apply to .vscode/mcp.json) and the connection is from Window to a Linux remote.

  4. added
    unreleased
    on Aug 18, 2026
  5. added this to the 1.135.0 milestone on Aug 18, 2026
  6. added
    insiders-released
    and removed
    unreleased
    on Aug 18, 2026
  7. locked and limited conversation to collaborators on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

insiders-released

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions