Repository navigation
docs(git): state --repository confinement in --help and validate_repo_path - #5454
Conversation
…_path The --repository option's help text read only "Git repository path", so --help never said that omitting it leaves every reachable repository in scope. The help now says the option confines operations to the repository (any path inside it selects the whole repository) and that without it every repository the server process can reach is in scope. validate_repo_path's docstring documents the allowed_repository=None behavior, and test_main_help asserts the new text. The README warning already shipped in #5225. Closes #5230 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: cliffhall <[email protected]>
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the CLI help and documentation updates clarifying repository access scope.
No open issues 🎉
What changed in this PR
Clarifies the Git server’s repository access scope in CLI help and internal documentation, complementing the README warning from #5225 and addressing the remaining work in #5230. Runtime behavior and the MCP interface are unchanged.
Changes:
- Explains that
--repositoryconfines operations to the whole enclosing repository, while omitting it permits access to any repository the process can reach. - Documents the unrestricted
allowed_repository=Nonebehavior. - Extends the help-output test with whitespace-normalized assertions.
| File | Description |
|---|---|
src/git/tests/test_entrypoints.py |
Verifies confinement and unrestricted-scope wording in CLI help. |
src/git/src/mcp_server_git/server.py |
Documents unrestricted path validation when no repository is configured. |
src/git/src/mcp_server_git/__init__.py |
Expands --repository help to explain access scope. |
Review effort: Balanced
|
Copilot round 1: clean (no comments, no suppressed findings). Loop converged on the first clean round; no further round requested. CI on e07a11e is green. |
Closes #5230
Description
mcp-server-git --helpdescribed--repositoryonly as "Git repository path", so nothing in the CLI said that leaving it out puts every reachable repository in scope. This PR:--repositoryoption's help (src/git/src/mcp_server_git/__init__.py) to say it confines operations to the repository (a path inside it selects the whole repository, matching the startup walk-up to the root) and that without it every repository the server process can reach is in scope;allowed_repository is Nonebehavior invalidate_repo_path's docstring (server.py; that docstring only);test_main_help(tests/test_entrypoints.py) to assert both sentences appear in--help, comparing with whitespace collapsed because Click wraps option help to the terminal width.The README half of the issue already shipped in #5225:
src/git/README.md→ Configuration carries the bolded "Without--repository, the server reads and writes any Git repository the server process can reach" paragraph, so the README is unchanged here rather than duplicating it.Server Details
git(mcp-server-git, Python)--repositoryCLI help text, one docstring, one test. No tool, prompt, schema or behavior change.Motivation and Context
#5230: users launching
uvx mcp-server-gitwithout--repositorymay assume the server is scoped to the workspace. The README now says otherwise (#5225); this brings--helpin line.How Has This Been Tested?
uv run --frozen mcp-server-git --helpon this branch:On
v2/mainthe same line reads-r, --repository PATH Git repository path.uv run --frozen pytest tests/test_entrypoints.py: 15 passed, including the extendedtest_main_help.npm run local:gate: exit 0 (every stage, both languages, including the git server's coverage gate and the boot smoke).No LLM client run: the change is the CLI help text and a docstring, neither of which an MCP client ever sees; the server's protocol surface is byte-for-byte unchanged.
Breaking Changes
None. The option's name, short form and behavior are unchanged.
Types of changes
Checklist
npm run changeset) if this changes what a TypeScript server publishes (not applicable: Python server)🤖 Generated with Claude Code