Skip to content

fix: skip remote URIs when resolving MCP server cwd#10844

Open
shanevcantwell wants to merge 1 commit intocontinuedev:mainfrom
shanevcantwell:fix/mcp-remote-cwd
Open

fix: skip remote URIs when resolving MCP server cwd#10844
shanevcantwell wants to merge 1 commit intocontinuedev:mainfrom
shanevcantwell:fix/mcp-remote-cwd

Conversation

@shanevcantwell
Copy link
Contributor

@shanevcantwell shanevcantwell commented Feb 26, 2026

Summary

  • MCP stdio servers fail with spawn cmd.exe ENOENT when VS Code is connected to a remote workspace (SSH, Dev Container, etc.) from a Windows host
  • Root cause: resolveWorkspaceCwd() passes vscode-remote:// URIs directly as cwd to child_process.spawn(), which can't resolve them as local filesystem paths
  • Fix: detect non-file:// URI schemes and return undefined so the spawn uses its default cwd, allowing MCP servers to start on the local host

Test plan

  • Added unit test for vscode-remote:// URI returning undefined
  • Manual: Configure stdio MCP server on Windows + SSH remote, verify it connects
  • Manual: Verify MCP servers still work on local Windows workspace (no regression)
  • Verify pre-existing test failure (should resolve relative cwd using IDE workspace) is unchanged — it fails on main due to fileURLToPath rejecting non-Windows paths

Fixes #10842

🤖 Generated with Claude Code


Continue Tasks: ❌ 7 failed — View all


Summary by cubic

Fix Windows startup failures for stdio MCP servers when VS Code is connected to a remote workspace by detecting remote URIs and using the user's home directory as the cwd. Ensures spawn has a valid local cwd so MCP servers start. Fixes #10842.

  • Bug Fixes
    • Detect non-file URIs (e.g., vscode-remote://) in resolveCwd and return os.homedir() for spawn’s cwd.
    • Added a unit test verifying remote URIs resolve to homedir().

Written for commit a3d6f96. Summary will update on new commits.

@shanevcantwell shanevcantwell requested a review from a team as a code owner February 26, 2026 06:00
@shanevcantwell shanevcantwell requested review from RomneyDa and removed request for a team February 26, 2026 06:00
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Feb 26, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

When the extension runs in the Local Extension Host on Windows while
connected to a remote workspace (SSH, Dev Container, etc.),
getWorkspaceDirs() returns vscode-remote:// URIs. These cannot be used
as a cwd for child_process.spawn(), causing "spawn cmd.exe ENOENT"
when starting MCP stdio servers.

Fall back to the user's home directory for non-file:// URIs so the
spawn has a valid local working directory.

Fixes continuedev#10842

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

MCP servers fail on SSH/remote: cmd.exe spawned locally instead of on remote

1 participant