Skip to content

Comments

docs: fix claude mcp add command syntax and remove unsupported flags#59

Open
petems wants to merge 1 commit intomasterfrom
docs/add-local-studio-config-specifics
Open

docs: fix claude mcp add command syntax and remove unsupported flags#59
petems wants to merge 1 commit intomasterfrom
docs/add-local-studio-config-specifics

Conversation

@petems
Copy link
Owner

@petems petems commented Jan 29, 2026

Summary

  • Fixed claude mcp add command syntax: server name must come before options
  • Removed unsupported --log-level flag from all documentation examples
  • Updated CLI reference to document only actual supported flags
  • Added comprehensive configuration examples for multiple MCP hosts

Problem

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-review

This 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:

# ✅ CORRECT - server name comes first
claude mcp add github-pr-review --env GITHUB_TOKEN="${GITHUB_TOKEN}" -- mcp-github-pr-review

Changes

Documentation Updates

  • README.md: Updated Claude Code CLI examples with correct syntax
  • docs/getting-started/quickstart.md: Added proper registration section
  • docs/guides/local-stdio.md: Comprehensive rewrite with CLI-based and manual configuration examples for multiple hosts
  • docs/reference/cli.md: Complete rewrite to document only supported flags

Flag Corrections

Removed (unsupported):

  • --log-level
  • --log-file
  • --json-logs

Documented (actually supported):

  • --env-file PATH
  • --max-pages N
  • --max-comments N
  • --per-page N
  • --max-retries N

Test Plan

  • Quality checks pass (ruff format, ruff check, mypy, compile-check, pytest)
  • Verified command syntax matches actual CLI implementation
  • Tested uv tool install workflow
  • Confirmed MCP server registration with corrected syntax

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Expanded CLI usage and registration flow with explicit command-structure rules and an “Important” usage guide
    • Added new options: --per-page, --max-retries, and --env-file; clarified environment-variable setups
    • Broadened host configuration examples across multiple integrations and added command examples
    • Improved connection verification (health check) guidance, examples, and troubleshooting notes

✏️ Tip: You can customize this high-level summary in your review settings.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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 mcp-github-pr-review server. It addresses critical issues with incorrect command syntax and outdated flag references, ensuring users can successfully register and configure their MCP servers. The changes provide a more robust and user-friendly experience by offering extensive, up-to-date configuration guidance across different environments.

Highlights

  • Corrected claude mcp add command syntax: The command syntax for claude mcp add has been fixed to ensure the server name comes before any options, resolving previous registration failures.
  • Removed unsupported flags from documentation: Documentation examples have been updated to remove references to unsupported flags such as --log-level, --log-file, and --json-logs.
  • Updated CLI reference for mcp-github-pr-review: The CLI reference now accurately documents only the currently supported flags, including --env-file, --max-pages, --max-comments, --per-page, and --max-retries.
  • Added comprehensive configuration examples: New, detailed configuration examples have been added for various MCP hosts, covering both CLI-based and manual JSON setups, to improve user guidance.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 29, 2026

📝 Walkthrough

Walkthrough

Documentation 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

Cohort / File(s) Summary
README Updates
README.md
Replaced minimal Claude Code CLI example with environment-variable (GITHUB_TOKEN) approach, added transport/stdio and scope usage, introduced an "Important" usage guide covering syntax, server-name positioning, option ordering, and supported MCP server flags plus multiple CLI variants.
Getting Started
docs/getting-started/quickstart.md
Added "Register with Claude Code CLI" section with install and registration steps, explicit command-structure rules (server name first, options before --, command after), and updated "Verify a Connection" to use the CLI health command with example and expected response.
Local Stdio Guide
docs/guides/local-stdio.md
Expanded installation options (allow uv tool install), simplified launch command, replaced --log-file with --env-file, added --per-page and --max-retries flags, broadened Host Configuration Examples across multiple hosts and CLIs, clarified env-file usage and security notes, and augmented troubleshooting.
CLI Reference
docs/reference/cli.md
Replaced minimal options text with a tabular Options section (types/defaults), added Examples and extended Environment Variables notes referencing precedence and environment reference.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through docs with nimble paws,
Tweaked flags and examples without pause,
A register step here, a health check near,
Env files and hosts now crystal clear,
Hop on — the CLI path is ours!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: correcting command syntax and removing unsupported flags from documentation across multiple files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link

codecov bot commented Jan 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@petems petems force-pushed the docs/add-local-studio-config-specifics branch from caafa3f to 6b235e0 Compare January 29, 2026 08:42
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +30 to +49
## 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).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

Comment on lines +35 to +65
#### 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)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant