Windows: npm-shim spawnSync missing windowsHide flashes a console window on every MCP server launch
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 86/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, node.js
調査の方向性
まず npm-shim.js を読み、shim と extract() 内の spawnSync 呼び出しを見つけてください。Windows で、非表示の親プロセスから codegraph.cmd serve --mcp を起動して確認してください。どちらの起動経路でもコンソールが一瞬も表示されず、stdio MCP サーバーが引き続き正常に起動すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- C
- スター
- 73.2k
- フォーク
- 4.7k
- 平均マージ
- 3時間 31分
- マージ済み PR(30日)
- 546
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
colbymchenry/codegraph のほかの issue
-
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 function対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
colbymchenry/codegraph#3093 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
colbymchenry/codegraph#2974 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
colbymchenry/codegraph#2959 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
colbymchenry/codegraph#1900 · コメント 2 件 · リアクション 5 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
colbymchenry/codegraph#1700 ·
メンテナーはふだん 1 日以内に返信
colbymchenry/codegraph の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
elf_loader: Xtensa ignores the addend of R_XTENSA_GLOB_DAT / R_XTENSA_JMP_SLOT (C++ vtables)対応中かも @diplfranzhoepfinger が今日担当しました。 オープンelf_loader
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
espressif/esp-iot-solution#813 ·
メンテナーはふだん 1 日以内に返信
-
Status: Opened Type: Bug
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信