Skip to content

Conversation

@erran
Copy link

@erran erran commented Nov 12, 2025

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?

  1. New unit test coverage.
  2. Tested stdio MCP servers before and after these changes were applied by a patch-package post 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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Usage of these changes at GitLab to avoid opening terminal windows when running under Windows environments:

  1. https://gitlab.com/gitlab-org/editor-extensions/gitlab-lsp/-/merge_requests/2533

@erran erran requested a review from a team as a code owner November 12, 2025 19:49
@erran erran changed the title fix(client): Support specifying windowsHide for STDIO servers processes fix(client): Support specifying windowsHide for STDIO servers Nov 12, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 12, 2025

Open in StackBlitz

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/sdk@1104

commit: 98f7842

shell: false,
signal: this._abortController.signal,
windowsHide: process.platform === 'win32' && isElectron(),
windowsHide: this._serverParams.windowsHide ?? isElectron(),
Copy link
Author

@erran erran Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
windowsHide: this._serverParams.windowsHide ?? isElectron(),
windowsHide: process.platform === 'win32',

@erran
Copy link
Author

erran commented Nov 12, 2025

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.
@erran erran force-pushed the erran/support-windows-hide-outside-of-electron branch from dad92a6 to fc1b5c5 Compare November 13, 2025 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant