Skip to content

Commit 605c829

Browse files
jnMetaCodefelixweinberger
authored andcommitted
fix(stdio): always set windowsHide on Windows, not just in Electron
The windowsHide spawn option was only enabled for Electron apps, causing an empty cmd.exe console window to appear when launching MCP servers from non-Electron Node.js applications on Windows. Since windowsHide is a no-op on non-Windows platforms, just set it to true unconditionally. Also removes the now-unused isElectron() helper. Fixes modelcontextprotocol#1638
1 parent ddadaa6 commit 605c829

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

‎src/client/stdio.ts‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ export class StdioClientTransport implements Transport {
125125
},
126126
stdio: ['pipe', 'pipe', this._serverParams.stderr ?? 'inherit'],
127127
shell: false,
128-
windowsHide: process.platform === 'win32' && isElectron(),
128+
// Always hide the console window on Windows, not just in Electron.
129+
// The option is a no-op on other platforms.
130+
windowsHide: true,
129131
cwd: this._serverParams.cwd
130132
});
131133

@@ -257,7 +259,3 @@ export class StdioClientTransport implements Transport {
257259
});
258260
}
259261
}
260-
261-
function isElectron() {
262-
return 'type' in process;
263-
}

0 commit comments

Comments
 (0)