fix(stdio): always set windowsHide on Windows, not just in Electron#1772
fix(stdio): always set windowsHide on Windows, not just in Electron#1772felixweinberger wants to merge 1 commit intomainfrom
Conversation
🦋 Changeset detectedLatest commit: 8b49ceb The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@modelcontextprotocol/client
@modelcontextprotocol/server
@modelcontextprotocol/express
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
There was a problem hiding this comment.
LGTM — straightforward fix removing the unnecessary Electron guard from windowsHide, with good test coverage.
Extended reasoning...
Overview
This PR makes a single-line change in packages/client/src/client/stdio.ts to always set windowsHide: true on Windows when spawning stdio server processes, rather than only doing so in Electron environments. The now-unused isElectron() helper is removed. Two new unit tests in crossSpawn.test.ts verify the behavior on both Windows and non-Windows platforms. A changeset file is included.
Security risks
None. windowsHide is a cosmetic spawn option that suppresses console window creation on Windows. It has no security implications and is a no-op on non-Windows platforms.
Level of scrutiny
Low scrutiny is appropriate. This is a minimal, well-scoped bug fix that changes one boolean expression, removes dead code, and adds tests. It is a forward-port of an already-merged fix (#1640) from the v1.x branch.
Other factors
The change is non-breaking, has proper test coverage, includes a changeset, and follows the established patterns of the codebase. No outstanding reviewer comments exist. The PR cleanly addresses a known issue (#1638) with multiple prior related PRs (#1104, #1706).
Forward-port of #1640 to main. Fixes #1638.
Motivation and Context
StdioClientTransportonly setswindowsHidewhen running in Electron, causing unwanted console windows to appear in non-Electron Windows applications when spawning stdio MCP servers.How Has This Been Tested?
Added unit tests in
crossSpawn.test.tsthat mock spawn and assert thewindowsHideoption is set correctly per platform.Breaking Changes
None.
windowsHideis a no-op on non-Windows platforms.Types of changes
Checklist
Additional context
Original fix by @jnMetaCode in #1640 (v1.x). Also supersedes #1104 and #1706.