Skip to content

MCP server is broken on Windows: spawn npx ENOENT (+ empty reports on absolute paths, dropped array options) #17

@danscMax

Description

@danscMax

Summary

The detect_code_duplication MCP server fails on Windows. Every call returns immediately:

{ "status": "error", "message": "spawn npx ENOENT" }

There are three Windows / cross-platform issues — the first is fatal, the other two silently produce wrong results.

Environment: Windows 11 · Node v24.16.0 · npm 11.13.0 · drywall 0.2.3

1. spawn npx ENOENT (fatal)

runJscpd in src/lib.js calls execFile("npx", fullArgs). On Windows npx is npx.cmd; execFile doesn't resolve it via PATHEXT, so it throws ENOENT. (execFile("npx.cmd", …) would also throw EINVAL on patched Node — CVE-2024-27980 — unless a shell is used.)

2. Empty report on absolute scan paths

When an absolute Windows path is passed, jscpd's fast-glob treats \ as an escape character (on every platform), so the pattern matches nothing and the server errors with ENOENT … jscpd-report.json. The default . happens to dodge this.

3. Array options keep only the last value

buildArgs expands array options (e.g. ignore: ["a", "b", "c"]) into repeated --ignore a --ignore b --ignore c. jscpd keeps only the last --ignore, so the other patterns are silently dropped (e.g. a vendored directory you tried to ignore still gets scanned).


I have a fix for all three ready as a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions