Windows: npm-shim spawnSync missing windowsHide flashes a console window on every MCP server launch
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 86/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, node.js
Research direction
Start by reading npm-shim.js and locating the spawnSync calls in the shim and extract(). Verify on Windows by launching codegraph.cmd serve --mcp from a hidden parent; done means neither launch path flashes a console and the stdio MCP server still starts normally.
Written by the indexing model from the issue text.
Description
Environment
- OS: Windows 10/11
- Install:
npm i -g @colbymchenry/codegraph(v1.0.1) - Launched as a stdio MCP server via
codegraph.cmd serve --mcp(registered in.mcp.json/ agent MCP configs)
Symptom
Every time an MCP host launches the server, a console window briefly flashes whose title is the full path to ... ode_modules\@colbymchenry\codegraph-win32-x64 ode.exe. Hosts that spawn child processes hidden (e.g. Kimi Code / Kimi Work use windowsHide: true, which maps to CREATE_NO_WINDOW) run the entire launch chain console-less, so the final spawnSync in npm-shim.js creates a brand-new visible console for the bundled node.exe. The window reappears on every launch / reconnect.
Root cause
In npm-shim.js:
var res = childProcess.spawnSync(resolved.command, resolved.args, { stdio: 'inherit' });
windowsHide defaults to false in Node. On Windows, when the parent process has no console, a spawned console-subsystem child is allocated a new visible console, titled with the child's own image path - exactly what users observe.
Everything under the platform package's lib/dist already passes windowsHide: true (daemon spawn in mcp/index.js, liveness watchdog, all git calls). Only the npm shim's spawnSync, and the tar call in extract() on the self-heal path, miss it.
Suggested fix
var res = childProcess.spawnSync(resolved.command, resolved.args, { stdio: 'inherit', windowsHide: true });
(and add windowsHide: true to the spawnSync('tar', ...) in extract().)
Verification
Reproduced by launching codegraph.cmd serve --mcp from a parent created with CREATE_NO_WINDOW and polling top-level window titles (user32.EnumWindows at 200 ms - the window is transient):
- Before the patch: a console window appears, titled exactly with the bundled node.exe path.
- After adding
windowsHide: true: no window at all; the server starts normally (proxy -> daemon -> liveness watchdog all healthy) and the stdio MCP transport is unaffected.
Notes
- This affects every Windows MCP host that hides its child consoles (Kimi Code/Work, Claude Code, ...), so the fix belongs in the shim rather than per-host workarounds.
- A local patch works, but any
npm update -g @colbymchenry/codegraphoverwrites it.
- Dominant language
- C
- Stars
- 73.2k
- Forks
- 4.7k
- Avg merge
- 3h 46m
- Merged PRs (30d)
- 510
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from colbymchenry/codegraph
-
Separate Installation Commands into Individual Code BlocksPossibly taken @andrySD claimed this 1 day ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
colbymchenry/codegraph#3241 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
colbymchenry/codegraph#3228 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
colbymchenry/codegraph#3223 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
A `../` entry in package.json `workspaces` makes a folder outside the project count as a workspace package, and a call gets linked to the wrong functionPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
colbymchenry/codegraph#3093 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
colbymchenry/codegraph#2974 ·
Maintainers usually reply within 1 day
All issues in colbymchenry/codegraph
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
ly05010419/MacNativeGames#1796 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
jniebuhr/gaggimate#1009 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Bug :bug:
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sonic-net/sonic-buildimage#30563 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
llvm/offload-test-suite#1698 ·
Maintainers usually reply within 1 day