-
Notifications
You must be signed in to change notification settings - Fork 36.5k
Open
Description
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.106.2
- OS Version: Windows 11 Pro (Edition: Windows 11 Pro, Version: 24H2, OS build: 26100.7171)
- PowerShell Version: 7.5.4
- Node.js Version: 22.21.1
Steps to Reproduce:
<path-to-vscode>\resources\app\out\cli.js
// Added temporarily to log process.argv for debugging
+ console.log("process.argv:", process.argv);- From PowerShell, execute the following command:
$ code --add-mcp '{"name":"example","url":"http://localhost:3001"}'
- The VS Code CLI receives the JSON argument with the double quotes stripped or mangled.
Example (actual argv received):
[
'C:\\Users\\toaki\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe',
'C:\\Users\\toaki\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\out\\cli.js',
'--add-mcp',
'{name:example,url:http://localhost:3001}'
]
Invalid JSON '{name:example,url:http://localhost:3001}': SyntaxError: Expected property name or '}' in JSON at position 1 (line 1 column 2)
- Contrast this with calling the tool directly via Node:
[
'C:\\Users\\toaki\\AppData\\Local\\Volta\\tools\\image\\node\\22.21.1\\node.exe',
'C:\\Users\\toaki\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\out\\cli.js',
'--add-mcp',
'{"name":"example","url":"http://localhost:3001"}'
]
This correctly preserves the JSON quotes and works as expected.
Expected Behavior:
- The
codeCLI should preserve JSON quotes when invoked from PowerShell, without arguments being altered bycode.cmdor the underlyingcmd.exeinvocation.
Actual Behavior:
- When called from PowerShell,
code.cmdmangles or strips JSON quotation marks, causing the--add-mcpargument to become invalid JSON.
Additional Information:
- This issue was originally investigated while using
next-devtools-mcp, and the maintainers confirmed the problem originates from VS Code’s CLI wrapper (code.cmd) rather than their package. - I have checked existing issues and found a few that appear related to quoting behavior on Windows, but none match this specific scenario involving
code.cmdand PowerShell. - They recommended filing this report here.
Workaround:
- Calling the MCP CLI directly with Node (e.g.,
node cli.js …) works as expected and preserves the JSON argument.
Update:
- I have upgraded VS Code to version 1.106.2 as suggested, but the issue still persists.
Metadata
Metadata
Assignees
Labels
No labels