docs: fix claude mcp add command syntax and remove unsupported flags#59
docs: fix claude mcp add command syntax and remove unsupported flags#59
Conversation
Summary of ChangesHello @petems, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the clarity and accuracy of the documentation for the Claude Code CLI and the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
📝 WalkthroughWalkthroughDocumentation updates add expanded Claude Code CLI guidance, registration and verification steps, new CLI flags (--env-file, --per-page, --max-retries), broader host integration examples, and a restructured CLI reference with tabular options and examples. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request provides a comprehensive update to the documentation, primarily fixing the command syntax for claude mcp add and removing unsupported flags from examples. The changes are clear and significantly improve the accuracy and usefulness of the documentation. I've found one minor inconsistency where the unsupported --log-level flag remains in several manual configuration examples in docs/guides/local-stdio.md. I've left a comment with a suggestion to remove it. Overall, this is a great documentation enhancement.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@docs/guides/local-stdio.md`:
- Around line 142-151: The JSON examples under mcpServers (e.g., the
github-pr-review entry with "command": "uvx" and "args":
["mcp-github-pr-review", "--log-level", "info"]) include the unsupported
"--log-level" flag; remove any occurrences of "--log-level" and its value from
the args arrays in these examples (and similar entries) so the args become
["mcp-github-pr-review"] (and likewise for the other examples mentioned) to
ensure the configs match the documented supported flags.
- Corrected command format: SERVER_NAME must come before options - Removed unsupported --log-level flag from all examples - Updated CLI reference with actual supported flags - Added clear examples showing proper syntax in all docs - Fixed quickstart and README installation instructions The previous docs showed incorrect syntax that caused the server name to be parsed as part of the command, resulting in failed MCP server registration. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
caafa3f to
6b235e0
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@docs/getting-started/quickstart.md`:
- Around line 30-49: Update the "Register with Claude Code CLI" section to
clarify how GITHUB_TOKEN is sourced when the CLI runs from a different working
directory: mention that writing a .env in the repo root does not guarantee the
token is loaded by the claude mcp add pr-review command, and instruct users to
either export GITHUB_TOKEN in their shell beforehand (e.g., export
GITHUB_TOKEN=...) or use the claude flag --env-file with an absolute path to the
.env file (e.g., --env-file /absolute/path/to/.env) instead of relying on a
relative .env; reference the exact command and flags (claude mcp add pr-review,
--env, --env-file, --) so readers know where to apply the change.
In `@docs/guides/local-stdio.md`:
- Around line 35-65: Add a brief note to the "Claude Code CLI" section near the
examples for `claude mcp add` explaining that when the CLI or host launches the
command from a different working directory, automatic `.env` loading can be
missed and recommending using `--env-file /abs/path/to/.env` as a reliable
alternative to exporting GITHUB_TOKEN in the shell; mention this alongside the
supported MCP server flags and reference the `--env-file` option and
`GITHUB_TOKEN` env usage so readers see where to apply it.
| ## Register with Claude Code CLI | ||
|
|
||
| After installing, register the server with Claude Code: | ||
|
|
||
| ```bash | ||
| # Install as a tool first | ||
| uv tool install mcp-github-pr-review | ||
|
|
||
| # Register with Claude Code CLI | ||
| claude mcp add pr-review --scope user --transport stdio --env GITHUB_TOKEN="${GITHUB_TOKEN}" -- \ | ||
| mcp-github-pr-review | ||
| ``` | ||
|
|
||
| **Command structure:** | ||
| - Server name (`pr-review`) comes FIRST | ||
| - All options (`--scope`, `--transport`, `--env`) come after server name but before `--` | ||
| - The `--` separator divides configuration from the command | ||
| - Command and arguments come after `--` | ||
|
|
||
| For other hosts (Cursor, VS Code, etc.), visit [Editor Integrations](../guides/editor-integrations.md). |
There was a problem hiding this comment.
Clarify token sourcing when running via Claude CLI.
Line 22 writes .env in the repo root, but claude mcp add may execute from a different working directory, so auto-loading that .env may not apply. Consider adding a note to either export GITHUB_TOKEN in the shell or use --env-file /absolute/path/to/.env to avoid confusion.
✏️ Suggested doc tweak
# Register with Claude Code CLI
@@
# Register with Claude Code CLI
claude mcp add pr-review --scope user --transport stdio --env GITHUB_TOKEN="${GITHUB_TOKEN}" -- \
mcp-github-pr-review
+
+# If you rely on a .env file, pass an absolute path:
+# claude mcp add pr-review --scope user --transport stdio --env-file /abs/path/to/.env -- \
+# mcp-github-pr-review🤖 Prompt for AI Agents
In `@docs/getting-started/quickstart.md` around lines 30 - 49, Update the
"Register with Claude Code CLI" section to clarify how GITHUB_TOKEN is sourced
when the CLI runs from a different working directory: mention that writing a
.env in the repo root does not guarantee the token is loaded by the claude mcp
add pr-review command, and instruct users to either export GITHUB_TOKEN in their
shell beforehand (e.g., export GITHUB_TOKEN=...) or use the claude flag
--env-file with an absolute path to the .env file (e.g., --env-file
/absolute/path/to/.env) instead of relying on a relative .env; reference the
exact command and flags (claude mcp add pr-review, --env, --env-file, --) so
readers know where to apply the change.
| #### Claude Code CLI | ||
|
|
||
| Add the server using the `claude mcp add` command: | ||
|
|
||
| ```bash | ||
| # Basic setup (inherits GITHUB_TOKEN from shell environment) | ||
| claude mcp add github-pr-review --scope user --transport stdio --env GITHUB_TOKEN="${GITHUB_TOKEN}" -- mcp-github-pr-review | ||
|
|
||
| # With explicit environment variable (not recommended - use shell env instead) | ||
| claude mcp add github-pr-review --scope user --transport stdio --env GITHUB_TOKEN=your_token_here -- mcp-github-pr-review | ||
|
|
||
| # With additional flags for pagination limits | ||
| claude mcp add github-pr-review --scope user --transport stdio --env GITHUB_TOKEN="${GITHUB_TOKEN}" -- mcp-github-pr-review --max-comments 500 --max-pages 20 | ||
|
|
||
| # Using uvx (if not installed as a tool) | ||
| claude mcp add github-pr-review --scope user --transport stdio --env GITHUB_TOKEN="${GITHUB_TOKEN}" -- uvx mcp-github-pr-review | ||
|
|
||
| # Using short flags | ||
| claude mcp add github-pr-review -s user -t stdio -e GITHUB_TOKEN="${GITHUB_TOKEN}" -- mcp-github-pr-review | ||
| ``` | ||
|
|
||
| **Key points:** | ||
| - Format: `claude mcp add SERVER_NAME [OPTIONS] -- COMMAND [ARGS]` | ||
| - The server name comes FIRST, before any options | ||
| - All options (`--scope`, `--transport`, `--env`) come after the server name but before `--` | ||
| - The `--` separator divides configuration from the command to execute | ||
| - Use `--scope user` (or `-s user`) for global availability (recommended) | ||
| - Use `--transport stdio` (or `-t stdio`) to specify stdio transport (default) | ||
| - Supported MCP server flags: `--max-comments`, `--max-pages`, `--per-page`, `--max-retries`, `--env-file` | ||
| - The `--log-level` flag is NOT supported (it was shown in error in previous versions) | ||
|
|
There was a problem hiding this comment.
Add a note for .env when the working directory isn’t the repo root.
Some hosts (or Claude CLI) may launch the command from a different working directory, so .env auto-loading can be missed. Consider mentioning --env-file /abs/path/to/.env as a reliable alternative when not exporting GITHUB_TOKEN in the shell.
✏️ Suggested doc tweak
# With additional flags for pagination limits
claude mcp add github-pr-review --scope user --transport stdio --env GITHUB_TOKEN="${GITHUB_TOKEN}" -- mcp-github-pr-review --max-comments 500 --max-pages 20
+
+# If relying on a .env file outside the working directory:
+# claude mcp add github-pr-review --scope user --transport stdio --env-file /abs/path/to/.env -- \
+# mcp-github-pr-review🤖 Prompt for AI Agents
In `@docs/guides/local-stdio.md` around lines 35 - 65, Add a brief note to the
"Claude Code CLI" section near the examples for `claude mcp add` explaining that
when the CLI or host launches the command from a different working directory,
automatic `.env` loading can be missed and recommending using `--env-file
/abs/path/to/.env` as a reliable alternative to exporting GITHUB_TOKEN in the
shell; mention this alongside the supported MCP server flags and reference the
`--env-file` option and `GITHUB_TOKEN` env usage so readers see where to apply
it.
Summary
claude mcp addcommand syntax: server name must come before options--log-levelflag from all documentation examplesProblem
The previous documentation showed incorrect command syntax that caused MCP server registration to fail:
# ❌ WRONG - server name after -- claude mcp add --env GITHUB_TOKEN=... -- github-pr-review -- mcp-github-pr-reviewThis resulted in the server name being parsed as part of the command instead of as the server identifier.
Solution
Corrected the command format throughout all documentation:
Changes
Documentation Updates
Flag Corrections
Removed (unsupported):
--log-level--log-file--json-logsDocumented (actually supported):
--env-file PATH--max-pages N--max-comments N--per-page N--max-retries NTest Plan
uv tool installworkflow🤖 Generated with Claude Code
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.