fix(windows): add qmd.cmd launcher that invokes node/bun directly#561
Open
fix(windows): add qmd.cmd launcher that invokes node/bun directly#561
Conversation
The npm-generated qmd.cmd wrapper calls /bin/sh to run bin/qmd.
When MCP clients (e.g. Claude Code) spawn qmd as a stdio subprocess
via Node.js child_process.spawn(), /bin/sh is not reliably available
— Git for Windows is often absent from the subprocess PATH even when
present in interactive shells. This causes the MCP server to fail
silently with no error output.
Add bin/qmd.cmd: a native CMD launcher that mirrors the runtime-
detection logic in bin/qmd (bun.lock → bun, package-lock.json → node,
fallback → node) without requiring a POSIX shell. npm uses a
hand-crafted qmd.cmd over its auto-generated wrapper when both share
the same base name, so this file is picked up automatically on
"npm install -g".
Verified: Node.js spawnSync('cmd.exe', ['/c', 'qmd.cmd', 'mcp'])
returns exit 0 and correct MCP JSON-RPC response.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Windows, the npm-generated
qmd.cmdwrapper calls/bin/shto runbin/qmd. When MCP clients (e.g. Claude Code, Cursor, or any tool using Node.jschild_process.spawn()) start qmd as a stdio subprocess,/bin/shis not reliably available — Git for Windows is often absent from the subprocess PATH even when present in interactive shells.The result:
qmd mcpsilently fails to start when configured as an MCP stdio server. No error is shown to the user; the MCP client simply never sees the server.Example broken config (fails on Windows via Node.js spawn):
{ "mcpServers": { "qmd": { "command": "qmd", "args": ["mcp"] } } }Fix
Add
bin/qmd.cmd: a native CMD launcher that mirrors the runtime-detection logic already inbin/qmd(checkspackage-lock.json→node,bun.lock/bun.lockb→bun, fallback →node) without requiring a POSIX shell.npm uses a hand-crafted
qmd.cmdover its auto-generated wrapper when both share the same base name — so this file is picked up automatically onnpm install -gwith no changes topackage.json.Verification
Tested via Node.js
spawnSync(exactly how MCP clients spawn the server):MCP stdio handshake works end-to-end after this change.
Related
Similar in spirit to #555 (USERPROFILE fallback for Windows HOME resolution).