diff --git a/.changeset/fix-stdio-windows-hide.md b/.changeset/fix-stdio-windows-hide.md new file mode 100644 index 000000000..250e0a45d --- /dev/null +++ b/.changeset/fix-stdio-windows-hide.md @@ -0,0 +1,5 @@ +--- +'@modelcontextprotocol/sdk': patch +--- + +Always set windowsHide to true when spawning stdio server processes on Windows, not just in Electron environments. diff --git a/src/client/stdio.ts b/src/client/stdio.ts index e488dcd24..43a2abb55 100644 --- a/src/client/stdio.ts +++ b/src/client/stdio.ts @@ -125,7 +125,9 @@ export class StdioClientTransport implements Transport { }, stdio: ['pipe', 'pipe', this._serverParams.stderr ?? 'inherit'], shell: false, - windowsHide: process.platform === 'win32' && isElectron(), + // Always hide the console window on Windows, not just in Electron. + // The option is a no-op on other platforms. + windowsHide: true, cwd: this._serverParams.cwd }); @@ -257,7 +259,3 @@ export class StdioClientTransport implements Transport { }); } } - -function isElectron() { - return 'type' in process; -}