From 8589a9dc97625a14a394961ac24f031a1a26e89b Mon Sep 17 00:00:00 2001 From: Vellure Lohith <135720439+Lohith2005@users.noreply.github.com> Date: Mon, 3 Aug 2026 17:01:36 +0530 Subject: [PATCH] fix(mcp-server): use platform default shell for execShell to support Windows --- apps/mcp-server/src/tools/kit.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/mcp-server/src/tools/kit.ts b/apps/mcp-server/src/tools/kit.ts index 6df641f..04cc706 100644 --- a/apps/mcp-server/src/tools/kit.ts +++ b/apps/mcp-server/src/tools/kit.ts @@ -13,6 +13,7 @@ import { spawn } from 'node:child_process'; import { mkdirSync } from 'node:fs'; import { readdir } from 'node:fs/promises'; import { join, relative, sep } from 'node:path'; +import process from 'node:process'; import { DatabaseSync } from 'node:sqlite'; import type { ServerConfig } from '../config/index.js'; import { ToolError } from '../errors/index.js'; @@ -136,7 +137,10 @@ export async function execShell( options: ExecOptions = {} ): Promise { const screened = security.commands.check(commandLine); - return execFile('/bin/sh', ['-c', screened], options); + const isWin = process.platform === 'win32'; + const shell = isWin ? process.env.COMSPEC || process.env.ComSpec || 'cmd.exe' : '/bin/sh'; + const shellArgs = isWin ? ['/c', screened] : ['-c', screened]; + return execFile(shell, shellArgs, options); } /**