Skip to content

fix(mcp): resolve npm CLI shims on Windows for claude-code installs#790

Open
syf2211 wants to merge 1 commit into
smithery-ai:mainfrom
syf2211:fix/781-claude-code-windows-command
Open

fix(mcp): resolve npm CLI shims on Windows for claude-code installs#790
syf2211 wants to merge 1 commit into
smithery-ai:mainfrom
syf2211:fix/781-claude-code-windows-command

Conversation

@syf2211

@syf2211 syf2211 commented Jun 27, 2026

Copy link
Copy Markdown

Summary

Fix misleading Command 'claude' not found errors when running smithery mcp add <server> --client claude-code on Windows.

Motivation

On Windows, npm global CLIs (including Claude Code) are exposed as .cmd shims. execFileSync does not apply PATHEXT, so invoking claude fails even when claude.cmd is on PATH. Users interpreted this as an invalid --client value.

Fixes #781
Fixes #794

Changes

  • Add resolveNpmCliCommand() helper to append .cmd on win32
  • Use it for command-based npm CLIs: claude-code, gemini-cli, codex
  • Improve ENOENT errors to reference the client label (e.g. "Claude Code") instead of only the raw command name
  • Add regression tests for shim resolution and client-aware error messaging

Tests

  • pnpm test — 400 passed
  • pnpm run check — passed
  • pnpm run typecheck — passed

Notes

  • Mirrors the existing VS Code code.cmd pattern already used in this repo
  • Non-Windows behavior is unchanged

- Use claude.cmd/gemini.cmd/codex.cmd on win32 so execFileSync can find
  npm global shims when installing MCP servers via --client
- Improve missing-CLI errors to reference the client label instead of only
  the raw command name

Fixes smithery-ai#781
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant