Skip to content

fix(mcp): suppress Windows console window on MCP subprocess spawn - #41078

Closed
Chameleon-Chaos wants to merge 8 commits into
NousResearch:mainfrom
Chameleon-Chaos:fix/windows-mcp-no-console-window
Closed

fix(mcp): suppress Windows console window on MCP subprocess spawn#41078
Chameleon-Chaos wants to merge 8 commits into
NousResearch:mainfrom
Chameleon-Chaos:fix/windows-mcp-no-console-window

Conversation

@Chameleon-Chaos

Copy link
Copy Markdown

On Windows, npx/Node.js MCP servers pop a console window when Hermes spawns them as subprocesses. The MCP SDK already passes CREATE_NO_WINDOW to anyio.open_process, but a broad except Exception in mcp/os/win32/utilities.py falls back to creationflags=0.

This monkey-patch wraps create_windows_process so that CREATE_NO_WINDOW always survives any exception path.

Refs: PR #38100 (pythonw.exe)

Chameleon-Chaos and others added 8 commits June 3, 2026 12:59
fix(logging): best-effort rotation with cooldown for Windows file-lock contention
The file was incorrectly replaced with 'PLACEHOLDER' in commit b3c16f4.
Restoring the full 218-line implementation with browser CDP helpers.
On Windows, npx/Node.js MCP servers (and any .cmd wrapper) pop a
console window when Hermes spawns them as subprocesses.  The MCP SDK
already passes CREATE_NO_WINDOW to anyio.open_process, but a broad
except Exception in mcp/os/win32/utilities.py falls back to
creationflags=0, which lets the window appear.

This monkey-patch wraps create_windows_process so that CREATE_NO_WINDOW
always survives any exception path — either via anyio.open_process with
the flag, or via subprocess.Popen (the fallback) which also carries it.

Closes: NousResearch#38101
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have tool/mcp MCP client and OAuth area/config Config system, migrations, profiles labels Jun 7, 2026
youjunxiaji added a commit to youjunxiaji/hermes-agent that referenced this pull request Jun 16, 2026
…site

Guards against the PR NousResearch#41078 regression where create_windows_process was
patched only on mcp.os.win32.utilities, leaving the name imported into
mcp.client.stdio (the real call site) unpatched. Windows-only; skips on
other platforms.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@teknium1

Copy link
Copy Markdown
Contributor

Closing as superseded by the consolidated Windows console-flash work tracked in #54220.

The relevant pieces from this PR/cluster have now landed through the targeted follow-up PRs #54236, #53892, and #54417, or are recorded in the umbrella tracker for any remaining native-Windows verification. Keeping this separate PR open would duplicate the tracker and the merged follow-up work.

Thanks for digging into this — the reports and PRs in this cluster helped identify the remaining spawn legs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles P3 Low — cosmetic, nice to have tool/mcp MCP client and OAuth type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants