[BUG] Windows: MCP servers launched via `npx` flash a visible console window (missing windowsHide/CREATE_NO_WINDOW)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Title: Windows: MCP servers launched via npx flash a visible console window (missing windowsHide/CREATE_NO_WINDOW)
Environment
- Claude Code (desktop app): 2.1.281, Windows
- OS: Windows 11 Enterprise 10.0.26200
- MCP servers configured in project
.mcp.jsonas"command": "npx", "args": ["@playwright/mcp@latest", "--cdp-endpoint", "..."](stdio transport)
Description
Every time one of these npx-launched MCP servers starts (e.g. reconnecting a project MCP server, or opening a new session that wires up several of them), a visible, empty cmd.exe console window briefly (or persistently, for long-lived servers) appears on screen with a blinking cursor and no output. With several such servers configured (in our case 16 pool instances + 1 managed instance), starting/reconnecting a session can produce a burst of ~15-17 of these windows at once.
Root cause (as far as I could trace it)
Process-tree inspection (Get-CimInstance Win32_Process) shows the chain:
On Windows, npx (and the resolved package's bin script) can only be invoked through their .cmd shims, which requires a cmd.exe host process. Since claude.exe itself has no console, any console-subsystem child process (cmd.exe, and ultimately node.exe) that Windows creates without an explicit CREATE_NO_WINDOW / windowsHide: true spawn flag gets a brand-new, visible console window allocated for it. That flag doesn't currently appear to be set when the MCP host spawns these child processes.
Impact
Purely cosmetic/distracting — the MCP servers function correctly, but the flashing empty console windows are confusing (easy to mistake for something else launching unexpectedly) and, with many project MCP servers configured, can produce a visible burst of windows on session start/reconnect.
Workaround attempted
Wrapping the command in .mcp.json with a hidden-window launcher (e.g. Start-Process -WindowStyle Hidden, or a VBScript WScript.Shell.Run hide trick) was considered but rejected, since those launch methods don't reliably preserve the inherited stdin/stdout pipe handles the MCP host needs for stdio transport, which would break the server's communication with the host.
What Should Happen?
Expected behavior
Since these are stdio-transport MCP servers (all I/O happens over pipes, not the console), no console window should ever need to be visible. The underlying Node child_process.spawn call should include windowsHide: true (which internally maps to CREATE_NO_WINDOW) for MCP server processes launched on Windows, regardless of whether a shell/.cmd shim is involved.
Error Messages/Logs
Steps to Reproduce
Description
Every time one of these npx-launched MCP servers starts (e.g. reconnecting a project MCP server, or opening a new session that wires up several of them), a visible, empty cmd.exe console window briefly (or persistently, for long-lived servers) appears on screen with a blinking cursor and no output. With several such servers configured (in our case 16 pool instances + 1 managed instance), starting/reconnecting a session can produce a burst of ~15-17 of these windows at once.
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.281
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗