[GH-ISSUE #1066] [Bug] Setup writes bare "npx" into agent MCP configs on native Windows #392

Closed
opened 2026-10-15 18:24:42 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @vinay121314 on GitHub (Oct 8, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/1066

Before submitting

  • I searched the open and closed issues for a related report.
  • I removed credentials, tokens, private paths, and sensitive target data.

Area

Setup, packaging, or upgrade

Observed behavior

When setup is launched as documented (npx rea-agents setup) on native Windows, the MCP registration written to agent configs (e.g. ~/.claude.json, Codex config.toml) is:

{ "command": "npx", "args": ["-y", "rea-agents@5.0.0", "mcp"] }

On Windows npx is the batch shim npx.cmd. MCP clients that spawn the server without a shell cannot launch it, so the REA server fails to start after setup reports success.

Reproduction

  1. Native Windows 11 x64, Node 22/24, agent installed natively (not WSL), e.g. Claude Code.
  2. Run npx rea-agents setup and approve the agent.
  3. Restart the agent and check MCP status (/mcp in Claude Code).
  4. Observe the rea server failing to start.

Expected behavior

On win32, setup writes a registration Windows can spawn without a shell, e.g. {"command":"cmd","args":["/c","npx","-y","rea-agents@5.0.0","mcp"]} (the form Claude Code documents for native Windows). Status, re-setup and uninstall should recognize that form as REA-owned.

Impact and scope

Affects every agent registration written by setup on native Windows when started through npx (the README's primary path). Not affected: macOS/Linux, and Windows setup run from a global npm i -g install (that takes the process.execPath branch). Compatibility only; no evidence integrity or isolation impact.

REA version

5.0.0 (source revision 5ccb924)

Runtime and platform

Windows 11 x64, Node 22/24 (found by source review; see Analysis)

Target and artifact context

Not applicable

Interface

Package or setup

Earliest failure stage

Setup or provider admission

Relevant output or evidence


Typed outcome or recovery expected

No response

Analysis or suspected cause

Source-derived (not yet confirmed with a Windows run log):

  • src/application/SetupHost.ts:37-38: when npm_command === "exec", setupRegistrationCommand returns PRODUCT_IDENTITY.mcpCommand.split(" ") (src/identity.ts:13, npx -y rea-agents@<v> mcp). This branch is evaluated before the platform === "win32" branch, so Windows never gets a Windows-safe command.
  • Same bare npx in src/application/SetupClientConfiguration.ts:27-32 (defaultCommand) and src/cli.ts:50.
  • isOwnedClientRegistrationCommand (ClientRegistrationIdentity.ts) and registrationAligned (ClientRegistrationStatus.ts:131) only accept a bare npx form, so they also need to accept the wrapped one.

Additional context

Proposed fix: add an npxRegistrationCommand(platform) helper that returns ["cmd","/c","npx","-y",spec,"mcp"] on win32, use it in SetupHost and SetupClientConfiguration, and strip a leading cmd /c in the ownership/alignment checks. Regression test: setupRegistrationCommand("win32", true) starts with cmd /c npx. Happy to open a PR for this.

Originally created by @vinay121314 on GitHub (Oct 8, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/1066 ### Before submitting - [x] I searched the open and closed issues for a related report. - [x] I removed credentials, tokens, private paths, and sensitive target data. ### Area Setup, packaging, or upgrade ### Observed behavior When setup is launched as documented (`npx rea-agents setup`) on native Windows, the MCP registration written to agent configs (e.g. `~/.claude.json`, Codex `config.toml`) is: ```json { "command": "npx", "args": ["-y", "rea-agents@5.0.0", "mcp"] } ``` On Windows `npx` is the batch shim `npx.cmd`. MCP clients that spawn the server without a shell cannot launch it, so the REA server fails to start after setup reports success. ### Reproduction 1. Native Windows 11 x64, Node 22/24, agent installed natively (not WSL), e.g. Claude Code. 2. Run `npx rea-agents setup` and approve the agent. 3. Restart the agent and check MCP status (`/mcp` in Claude Code). 4. Observe the `rea` server failing to start. ### Expected behavior On win32, setup writes a registration Windows can spawn without a shell, e.g. `{"command":"cmd","args":["/c","npx","-y","rea-agents@5.0.0","mcp"]}` (the form Claude Code documents for native Windows). Status, re-setup and uninstall should recognize that form as REA-owned. ### Impact and scope Affects every agent registration written by setup on native Windows when started through npx (the README's primary path). Not affected: macOS/Linux, and Windows setup run from a global `npm i -g` install (that takes the `process.execPath` branch). Compatibility only; no evidence integrity or isolation impact. ### REA version 5.0.0 (source revision 5ccb924) ### Runtime and platform Windows 11 x64, Node 22/24 (found by source review; see Analysis) ### Target and artifact context Not applicable ### Interface Package or setup ### Earliest failure stage Setup or provider admission ### Relevant output or evidence ```text ``` ### Typed outcome or recovery expected _No response_ ### Analysis or suspected cause Source-derived (not yet confirmed with a Windows run log): - `src/application/SetupHost.ts:37-38`: when `npm_command === "exec"`, `setupRegistrationCommand` returns `PRODUCT_IDENTITY.mcpCommand.split(" ")` (`src/identity.ts:13`, `npx -y rea-agents@<v> mcp`). This branch is evaluated before the `platform === "win32"` branch, so Windows never gets a Windows-safe command. - Same bare `npx` in `src/application/SetupClientConfiguration.ts:27-32` (`defaultCommand`) and `src/cli.ts:50`. - `isOwnedClientRegistrationCommand` (`ClientRegistrationIdentity.ts`) and `registrationAligned` (`ClientRegistrationStatus.ts:131`) only accept a bare `npx` form, so they also need to accept the wrapped one. ### Additional context Proposed fix: add an `npxRegistrationCommand(platform)` helper that returns `["cmd","/c","npx","-y",spec,"mcp"]` on win32, use it in `SetupHost` and `SetupClientConfiguration`, and strip a leading `cmd /c` in the ownership/alignment checks. Regression test: `setupRegistrationCommand("win32", true)` starts with `cmd /c npx`. Happy to open a PR for this.
bsakaguchi 2026-10-15 18:24:42 +00:00
  • closed this issue
  • added the
    triage
    bug
    labels
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#392
No description provided.