Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/services/mcp/McpHub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -579,9 +579,25 @@ export class McpHub {
})) as typeof config

if (configInjected.type === "stdio") {
// On Windows, wrap commands with cmd.exe to handle non-exe executables like npx.ps1
// This is necessary for node version managers (fnm, nvm-windows, volta) that implement
// commands as PowerShell scripts rather than executables.
// Note: This adds a small overhead as commands go through an additional shell layer.
const isWindows = process.platform === "win32"

// Check if command is already cmd.exe to avoid double-wrapping
const isAlreadyWrapped =
configInjected.command.toLowerCase() === "cmd.exe" || configInjected.command.toLowerCase() === "cmd"

const command = isWindows && !isAlreadyWrapped ? "cmd.exe" : configInjected.command
const args =
isWindows && !isAlreadyWrapped
? ["/c", configInjected.command, ...(configInjected.args || [])]
: configInjected.args

transport = new StdioClientTransport({
command: configInjected.command,
args: configInjected.args,
command,
args,
cwd: configInjected.cwd,
env: {
...getDefaultEnvironment(),
Expand Down
Loading
Loading