Skip to content

fix(stdio): always set windowsHide on Windows, not just in Electron#1772

Open
felixweinberger wants to merge 1 commit intomainfrom
fweinberger/windows-hide-main
Open

fix(stdio): always set windowsHide on Windows, not just in Electron#1772
felixweinberger wants to merge 1 commit intomainfrom
fweinberger/windows-hide-main

Conversation

@felixweinberger
Copy link
Contributor

Forward-port of #1640 to main. Fixes #1638.

Motivation and Context

StdioClientTransport only sets windowsHide when 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.ts that mock spawn and assert the windowsHide option is set correctly per platform.

Breaking Changes

None. windowsHide is a no-op on non-Windows platforms.

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

Original fix by @jnMetaCode in #1640 (v1.x). Also supersedes #1104 and #1706.

Fixes #1638. Forward-port of #1640 from v1.x.

Co-authored-by: jnMetaCode <147776183+jnMetaCode@users.noreply.github.com>
@felixweinberger felixweinberger requested a review from a team as a code owner March 26, 2026 18:14
@changeset-bot
Copy link

changeset-bot bot commented Mar 26, 2026

🦋 Changeset detected

Latest commit: 8b49ceb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@modelcontextprotocol/client Patch

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 26, 2026

Open in StackBlitz

@modelcontextprotocol/client

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

@modelcontextprotocol/server

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

@modelcontextprotocol/express

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

@modelcontextprotocol/hono

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

@modelcontextprotocol/node

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

commit: 8b49ceb

Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

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

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

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.

Stdio client does not set windowsHide

1 participant