fix: properly quote MCP server paths containing ampersands on Windows (#4933) #4939
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes #4933
This PR fixes an issue where MCP server paths containing ampersands (
&) would fail to launch on Windows. The problem occurred because the command was wrapped withcmd.exe /cwithout properly quoting the path, causingcmd.exeto interpret the ampersand as a command separator.Changes Made
src/services/mcp/McpHub.tsto quote the command path when wrapping withcmd.exeon Windowssrc/services/mcp/__tests__/McpHub.spec.tsto reflect the new quoted command formatTesting
should properly quote commands with special characters like ampersand&in their path can now be launched on WindowsVerification of Acceptance Criteria
&in their file path now connect successfully on WindowsChecklist
Technical Details
The fix works by wrapping the command in quotes when passing it to
cmd.exe:This ensures that
cmd.exetreats the entire path as a single argument, preventing special characters like&from being misinterpreted.Important
Fixes MCP server path handling on Windows by quoting commands with special characters like ampersands in
McpHub.ts.&on Windows by quoting the command path inMcpHub.ts.cmd.exetreats the entire path as a single argument, preventing misinterpretation.McpHub.spec.tsto reflect new command quoting behavior.&in path connect successfully on Windows.This description was created by
for 9a78558. You can customize this summary. It will automatically update as commits are pushed.