fix(client): Support specifying windowsHide for STDIO servers#1104
fix(client): Support specifying windowsHide for STDIO servers#1104erran wants to merge 2 commits intomodelcontextprotocol:mainfrom
Conversation
commit: |
| shell: false, | ||
| signal: this._abortController.signal, | ||
| windowsHide: process.platform === 'win32' && isElectron(), | ||
| windowsHide: this._serverParams.windowsHide ?? isElectron(), |
There was a problem hiding this comment.
Honestly I was debating whether hard coding true here or removing the electron check was sufficient due to how it’ll behave on non-Windows systems but I didn’t get around to testing different platforms since I’m usually developing on Mac or Linux so validating the changes in windows took most of my day.
I decided against true or win32 platform check as the following code could break someone else’s assumptions in a way I’m not thinking of right now (although in my experience the terminal window for each stdio MCP server is always blank).
| windowsHide: this._serverParams.windowsHide ?? isElectron(), | |
| windowsHide: process.platform === 'win32', |
|
I have a single test failing on main locally but it is in a different area of the codebase. I can paste details here if there aren’t any known intermittent failures relating to sse transport on an ARM Mac and receiving too many events. |
Previously windowsHide was only available when running inside of an Electron process by default. If this library is run through a single application executable the NodeJS runtime will cause windowsHide to be set to false thus spawning terminals for each spawned STDIO MCP server.
dad92a6 to
fc1b5c5
Compare
Motivation and Context
Previously windowsHide was only available when running inside of an Electron process by default. If this library is run through a single application executable the NodeJS runtime will cause windowsHide to be set to false thus spawning terminals for each spawned STDIO MCP server.
This is obtrusive and in the foreground of the user’s IDE in my experience with little benefit due to the STDOUT/STDERR being hidden from the terminal window as it is captured by the NodeJS process.
How Has This Been Tested?
patch-packagepost install script in the GitLab Language Server which is used as a standalone binary outside of electron.Breaking Changes
n/a — the stdio transport will behave as it does today without explicitly setting the windowHide option.
Types of changes
Checklist
Additional context
Usage of these changes at GitLab to avoid opening terminal windows when running under Windows environments: