modelcontextprotocol / modelcontextprotocol/servers
Enforce current roots on every git tool call
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 90.5k
- Forks
- 11.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 5
Description
Problem
The git server refreshes client roots when listing repositories, but tool execution validates repo_path only against the optional command-line repository restriction. If roots change at runtime, a repo path that used to be reachable can still be used in later tool calls.
Why now
The git server is a reference implementation for safe repository access. Root changes need to revoke access deterministically instead of relying on an undefined reconnect/restart boundary.
Version under test
- Commit:
b60eca1b3bfcd12e2afe7000882db363a1b89f6e(origin/mainon 2026-03-17) - Runtime: Python
3.14.0, macOSdarwin/arm64
Minimal repro
- Start the git MCP server with roots support enabled and no fixed
--repositoryargument. - Expose repo
Athrough roots and successfully call a git tool against it. - Update the client roots so repo
Ais no longer allowed. - Reuse the old
repo_pathin another git tool call.
Expected behavior
The second call should be rejected based on the current roots.
Actual behavior
call_tool() only validates against the command-line repository restriction, so root-based access is not re-enforced during tool execution.
Code paths
src/git/src/mcp_server_git/server.pysrc/git/tests/test_server.pysrc/filesystem/roots-utils.tssrc/git/README.md
Validation target
Changing roots at runtime should revoke access to repositories that are no longer within the allowed set without requiring a restart.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/git/src/mcp_server_git/server.py by tracing call_tool() and the current roots-related access checks. Review src/git/tests/test_server.py for server tool tests, and consult src/filesystem/roots-utils.ts and src/git/README.md for roots behavior. Done means a runtime roots change causes later calls for removed repositories to be rejected without a restart.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, python, typescript
- Domain
- backend, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100