feat: add install command for one-click MCP client setup#177
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Greptile SummaryAdds a
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["codereviewbuddy install <client>"] --> B{"Client type?"}
B -->|claude-desktop| C["_get_claude_desktop_config_path()"]
B -->|windsurf / windsurf-next| D["_get_windsurf_config_path()"]
B -->|claude-code| E["_find_claude_command()"]
B -->|cursor| F["Build deeplink URL"]
B -->|mcp-json| G["Generate JSON"]
C --> H["_build_server_config()"]
D --> H
H --> I["_write_config_file()"]
I --> J["update_config_file() from FastMCP"]
E --> K{"Claude CLI found?"}
K -->|Yes| L["_build_server_config()"]
L --> M["subprocess: claude mcp add"]
K -->|No| N["Exit with error"]
F --> O["_build_server_config()"]
O --> P["base64 encode config"]
P --> Q["_open_deeplink()"]
G --> R["_build_server_config()"]
R --> S{"--copy flag?"}
S -->|Yes| T["pyperclip.copy()"]
S -->|No| U["print JSON to stdout"]
Last reviewed commit: 72bb818 |
03f4e4a to
f79a621
Compare
2f36cc7 to
336ec8f
Compare
336ec8f to
53b89c2
Compare
f79a621 to
44747e2
Compare
Merge activity
|
53b89c2 to
72bb818
Compare
|
Found 9 test failures on Blacksmith runners: Failures
|
| config_json = server_config.model_dump_json(exclude_none=True) | ||
| config_b64 = base64.urlsafe_b64encode(config_json.encode()).decode() |
There was a problem hiding this comment.
Cursor deeplink includes empty env in payload
model_dump_json(exclude_none=True) will serialize "env": {} into the base64 payload when no env vars are provided, since an empty dict is not None. The mcp-json command at line 348 explicitly omits env when empty (if server_config.env:), creating an inconsistency between the two output paths. Consider using exclude_defaults=True or filtering the dict to keep the deeplink payload clean:
| config_json = server_config.model_dump_json(exclude_none=True) | |
| config_b64 = base64.urlsafe_b64encode(config_json.encode()).decode() | |
| config_json = server_config.model_dump_json(exclude_none=True, exclude_defaults=True) |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/codereviewbuddy/install.py
Line: 264-265
Comment:
**Cursor deeplink includes empty `env` in payload**
`model_dump_json(exclude_none=True)` will serialize `"env": {}` into the base64 payload when no env vars are provided, since an empty dict is not `None`. The `mcp-json` command at line 348 explicitly omits `env` when empty (`if server_config.env:`), creating an inconsistency between the two output paths. Consider using `exclude_defaults=True` or filtering the dict to keep the deeplink payload clean:
```suggestion
config_json = server_config.model_dump_json(exclude_none=True, exclude_defaults=True)
```
How can I resolve this? If you propose a fix, please make it concise.| capture_output=True, | ||
| text=True, | ||
| ) | ||
| if "Claude Code" in result.stdout: |
There was a problem hiding this comment.
Version check only inspects stdout
Some CLI tools (including certain Node.js-based CLIs) print version info to stderr rather than stdout. Since capture_output=True already captures both streams, checking result.stderr as well would make this detection more robust:
| if "Claude Code" in result.stdout: | |
| if "Claude Code" in result.stdout or "Claude Code" in result.stderr: |
The same applies to the fallback check on line 187.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/codereviewbuddy/install.py
Line: 168
Comment:
**Version check only inspects `stdout`**
Some CLI tools (including certain Node.js-based CLIs) print version info to `stderr` rather than `stdout`. Since `capture_output=True` already captures both streams, checking `result.stderr` as well would make this detection more robust:
```suggestion
if "Claude Code" in result.stdout or "Claude Code" in result.stderr:
```
The same applies to the fallback check on line 187.
How can I resolve this? If you propose a fix, please make it concise.
Description
Adds a
codereviewbuddy install <client>CLI command for one-click MCP client registration. Instead of manually editing JSON config files, users can now run a single command.Supported clients
codereviewbuddy install claude-desktopclaude_desktop_config.jsoncodereviewbuddy install claude-codeclaude mcp addCLIcodereviewbuddy install cursorcursor://deeplinkcodereviewbuddy install windsurf~/.codeium/windsurf/mcp_config.jsoncodereviewbuddy install windsurf-next~/.codeium/windsurf-next/mcp_config.jsoncodereviewbuddy install mcp-jsonFeatures
uvx --prerelease=allow codereviewbuddy@latestas the server command--env KEY=VALUEflags for environment variables (e.g. reviewer config)--env-file .envto load env vars from a dotenv filemcp-json --copyto copy config to clipboardupdate_config_file()to safely merge into existing configsFiles
src/codereviewbuddy/install.py— new module with install subcommandssrc/codereviewbuddy/cli.py— registersinstall_appsubcommand grouptests/test_install.py— 38 tests covering all clients, env handling, error pathsREADME.md— added "Quick setup" section before manual config instructionsChecklist
poe checkpasses