[GH-ISSUE #2187] [Feature] Let setup register Claude Code for one project (--scope local) #731

Open
opened 2026-10-15 18:27:46 +00:00 by bsakaguchi · 2 comments
Owner

Originally created by @williamblair333 on GitHub (Oct 12, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/2187

Before submitting

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

Area

Setup, packaging, or upgrade

Current limitation

rea setup --client claude_code always registers REA for every project. It writes REA into the top-level mcpServers in ~/.claude.json and installs the skill into ~/.claude/skills. There is no setup option to register REA for just one project.

You can do it by hand with claude mcp add --scope local. But then rea doctor and rea uninstall can't see the entry, because they only read the top-level table. Nothing in src/application reads Claude Code's per-project projects[<path>].mcpServers.

Use cases

  • Clean-room reimplementation (#2120). One agent studies the target with REA. A second agent writes the new code and must not be able to reach REA. The separation should be easy to show afterward.
  • Sandboxed analysis. A team allows binary analysis in one locked-down repository, but not in every project on a workstation.
  • Less clutter. REA's tool list stays out of unrelated projects.

Desired outcome and success criteria

  • rea setup --client claude_code --scope local registers REA for the current directory only. An option like --project DIR could pick a different directory. The setup plan shows which path it will write to.
  • rea doctor recognizes a project-level registration for the current directory and says which scope it found.
  • rea uninstall removes REA-owned project-level entries, with the same backup, readback, and restore steps it uses today.
  • The default stays the same, so current users see no change.

Authority boundaries and non-goals

  • This isn't a "copyright-conscious mode" and makes no legal claims. It only narrows where REA is registered.
  • No --scope project. That writes .mcp.json into the repository, where it usually gets committed.
  • Other clients are unchanged, unless you'd like the option to work for them too.

Alternatives considered

  • Documentation only (#2188). It covers a separate profile through CLAUDE_CONFIG_DIR, which setup already supports, and registering by hand at local scope. With the second option, doctor and uninstall still can't see the entry.
  • A separate Claude Code profile. This works today and also keeps skills, history, and login apart. But it needs a second login and its own settings, which is more than some users need.

Possible direction

Let the Claude Code server path depend on scope: ["projects", <abs dir>, "mcpServers"] instead of ["mcpServers"]. Then pass that through these places:

  • ClientConfigurationDocument.ts: the server path (clientServerPath, withClientServers)
  • SetupClientConfiguration.ts: inspect, write, and read back
  • ClientRegistrationStatus.ts and Doctor: report which scope was found
  • Uninstall.ts (removeClient): find REA-owned project-level entries
  • SetupPlan.ts: show the target path
  • The CLI flag, docs/installation.md, and tests in the existing setup fixtures

Three questions for you:

  1. Should --scope apply only to Claude Code, or be a general option that other clients could use later?
  2. At local scope, should setup skip the skill (my suggestion), or install it into <project>/.claude/skills, which usually gets committed?
  3. Should uninstall remove every REA-owned project-level entry, or only the one for the current directory?

I'm happy to build this if you like the direction.

References

Originally created by @williamblair333 on GitHub (Oct 12, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/2187 ### Before submitting - [x] I searched the open and closed issues and pull requests for a related proposal. - [x] I removed credentials, tokens, private paths, and sensitive target data. ### Area Setup, packaging, or upgrade ### Current limitation `rea setup --client claude_code` always registers REA for every project. It writes REA into the top-level `mcpServers` in `~/.claude.json` and installs the skill into `~/.claude/skills`. There is no setup option to register REA for just one project. You can do it by hand with `claude mcp add --scope local`. But then `rea doctor` and `rea uninstall` can't see the entry, because they only read the top-level table. Nothing in `src/application` reads Claude Code's per-project `projects[<path>].mcpServers`. ### Use cases - **Clean-room reimplementation (#2120).** One agent studies the target with REA. A second agent writes the new code and must not be able to reach REA. The separation should be easy to show afterward. - **Sandboxed analysis.** A team allows binary analysis in one locked-down repository, but not in every project on a workstation. - **Less clutter.** REA's tool list stays out of unrelated projects. ### Desired outcome and success criteria - `rea setup --client claude_code --scope local` registers REA for the current directory only. An option like `--project DIR` could pick a different directory. The setup plan shows which path it will write to. - `rea doctor` recognizes a project-level registration for the current directory and says which scope it found. - `rea uninstall` removes REA-owned project-level entries, with the same backup, readback, and restore steps it uses today. - The default stays the same, so current users see no change. ### Authority boundaries and non-goals - This isn't a "copyright-conscious mode" and makes no legal claims. It only narrows where REA is registered. - No `--scope project`. That writes `.mcp.json` into the repository, where it usually gets committed. - Other clients are unchanged, unless you'd like the option to work for them too. ### Alternatives considered - **Documentation only (#2188).** It covers a separate profile through `CLAUDE_CONFIG_DIR`, which setup already supports, and registering by hand at local scope. With the second option, doctor and uninstall still can't see the entry. - **A separate Claude Code profile.** This works today and also keeps skills, history, and login apart. But it needs a second login and its own settings, which is more than some users need. ### Possible direction Let the Claude Code server path depend on scope: `["projects", <abs dir>, "mcpServers"]` instead of `["mcpServers"]`. Then pass that through these places: - `ClientConfigurationDocument.ts`: the server path (`clientServerPath`, `withClientServers`) - `SetupClientConfiguration.ts`: inspect, write, and read back - `ClientRegistrationStatus.ts` and Doctor: report which scope was found - `Uninstall.ts` (`removeClient`): find REA-owned project-level entries - `SetupPlan.ts`: show the target path - The CLI flag, `docs/installation.md`, and tests in the existing setup fixtures Three questions for you: 1. Should `--scope` apply only to Claude Code, or be a general option that other clients could use later? 2. At local scope, should setup skip the skill (my suggestion), or install it into `<project>/.claude/skills`, which usually gets committed? 3. Should uninstall remove every REA-owned project-level entry, or only the one for the current directory? I'm happy to build this if you like the direction. ### References - #2120 (clean-room separation) - #1337 (Claude Code skill path under `CLAUDE_CONFIG_DIR`) - Claude Code MCP scopes: https://code.claude.com/docs/en/mcp
Author
Owner

@matbrgz commented on GitHub (Oct 12, 2026):

Design & Setup Scope Review

Supporting project-local MCP registration for Claude Code (--scope local) is an important addition for clean-room reverse engineering setups (#2120) and bounded analysis workflows:

  • Config Contract: Claude Code stores project-scoped servers under projects[resolvedProjectPath].mcpServers in ~/.claude.json (or local project config).
  • Symmetry with Doctor & Uninstall:
    • rea setup --client claude_code --scope local must register the MCP entry specifically under the cwd/target project key.
    • rea doctor and rea uninstall must be updated to accept an optional project path or check the current working directory's project record in ~/.claude.json so local registrations are discoverable and cleanable.
<!-- gh-comment-id:6134391177 --> @matbrgz commented on GitHub (Oct 12, 2026): ### Design & Setup Scope Review Supporting project-local MCP registration for Claude Code (`--scope local`) is an important addition for clean-room reverse engineering setups (#2120) and bounded analysis workflows: - **Config Contract:** Claude Code stores project-scoped servers under `projects[resolvedProjectPath].mcpServers` in `~/.claude.json` (or local project config). - **Symmetry with Doctor & Uninstall:** - `rea setup --client claude_code --scope local` must register the MCP entry specifically under the cwd/target project key. - `rea doctor` and `rea uninstall` must be updated to accept an optional project path or check the current working directory's project record in `~/.claude.json` so local registrations are discoverable and cleanable.
Author
Owner

@charlinbr-create commented on GitHub (Oct 17, 2026):

Until --scope local lands, the manual "One project" route in docs/installation.md is the workaround. On native Windows, the documented command fails in both common shells:

claude mcp add --scope local rea -- cmd.exe /d /c npx -y rea-agents@6.5.0 mcp

In Windows PowerShell 5.1 (the default powershell.exe), the unquoted -- never reaches claude, so -y is parsed as a claude mcp add option:

error: unknown option '-y'

Quoting it works (tested on 5.1.26100):

claude mcp add --scope local rea '--' cmd.exe /d /c npx -y rea-agents@6.5.0 mcp

In Git Bash (MSYS2, which Claude Code and Codex often use as their shell on Windows), path conversion rewrites /d /c into drive paths. The command reports success and stores a broken entry:

Added stdio MCP server rea with command: cmd.exe D:/ C:/ npx -y rea-agents@6.5.0 mcp to local config

Nothing fails until the server is launched, which makes this one easy to miss. Turning the conversion off for that command fixes it:

MSYS_NO_PATHCONV=1 claude mcp add --scope local rea -- cmd.exe /d /c npx -y rea-agents@6.5.0 mcp

With either fix, claude mcp get rea shows Args: /d /c npx -y rea-agents@6.5.0 mcp and Status: Connected, and REA stays out of other projects.

It would help to show both variants next to the Windows example in "Limit REA to one project or agent profile". If setup --scope local ships, having setup write the entry itself would avoid shell quoting entirely.

Environment: Windows 11 (build 26300), Claude Code 2.1.295, rea-agents 6.5.0, Git for Windows 2.49.0 (MINGW64 3.5.7).

<!-- gh-comment-id:6234591436 --> @charlinbr-create commented on GitHub (Oct 17, 2026): Until `--scope local` lands, the manual "One project" route in docs/installation.md is the workaround. On native Windows, the documented command fails in both common shells: claude mcp add --scope local rea -- cmd.exe /d /c npx -y rea-agents@6.5.0 mcp In Windows PowerShell 5.1 (the default `powershell.exe`), the unquoted `--` never reaches `claude`, so `-y` is parsed as a `claude mcp add` option: error: unknown option '-y' Quoting it works (tested on 5.1.26100): claude mcp add --scope local rea '--' cmd.exe /d /c npx -y rea-agents@6.5.0 mcp In Git Bash (MSYS2, which Claude Code and Codex often use as their shell on Windows), path conversion rewrites `/d /c` into drive paths. The command reports success and stores a broken entry: Added stdio MCP server rea with command: cmd.exe D:/ C:/ npx -y rea-agents@6.5.0 mcp to local config Nothing fails until the server is launched, which makes this one easy to miss. Turning the conversion off for that command fixes it: MSYS_NO_PATHCONV=1 claude mcp add --scope local rea -- cmd.exe /d /c npx -y rea-agents@6.5.0 mcp With either fix, `claude mcp get rea` shows `Args: /d /c npx -y rea-agents@6.5.0 mcp` and `Status: Connected`, and REA stays out of other projects. It would help to show both variants next to the Windows example in "Limit REA to one project or agent profile". If `setup --scope local` ships, having setup write the entry itself would avoid shell quoting entirely. Environment: Windows 11 (build 26300), Claude Code 2.1.295, rea-agents 6.5.0, Git for Windows 2.49.0 (MINGW64 3.5.7).
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#731
No description provided.