modelcontextprotocol / modelcontextprotocol/servers

Running mcp-server-git with uvx gives full disk access/--repository param is ignored

Open
#604 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
90.5k
Forks
11.7k
Avg merge
2d 2h
Merged PRs (30d)
5

Description

Describe the bug
mcp-server-git does not restrict repo paths to the repo specified.

The docs have this code block:

"mcpServers": {
  "git": {
    "command": "uvx",
    "args": ["mcp-server-git", "--repository", "path/to/git/repo"]
  }
}

Which would imply you are limiting the mcp server to that repository but in practice the only thing --repository is used for is this (link]:

if repository is not None:
	try:
		git.Repo(repository)
		logger.info(f"Using repository at {repository}")
	except git.InvalidGitRepositoryError:
		logger.error(f"{repository} is not a valid Git repository")
		return

After that codeblock it doesn't seem to be used. All the commands take a "repo_path" which can be anywhere on your machine. Coupled with "git_init" you can effectively read any file on the computer as long as you have the permissions to init a git repo.

If this is expected behavior then maybe it would be nice to add something to the docs about it.

To Reproduce
Steps to reproduce the behavior:

  1. mkdir reproduce-repo
  2. cd reproduce-repo
  3. git init
  4. npx @modelcontextprotocol/inspector uvx mcp-server-git --repository "path/to/your/repo"
  5. Open Browser and go to http://localhost:5173
  6. Select "STDIO" and click Connect
  7. List Tools
  8. Run the git_status tool and enter a path different from what you passed in to the --repository flag

Image

Expected behavior
One or more of the following:

  • Either a clear message that this tool has full access and should only be use with Docker

or

  • Allow for limiting the MCP server's access

Ideally you'd supply a base path (or paths) and it would be able to read/write to any repos in that path to allow for features like #188 (on purpose).

Logs
N/A

Additional context
N/A

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/git/src/mcp_server_git/server.py, especially the repository argument handling and the commands that accept repo_path, then compare it with the src/git/README.md example. Reproduce the behavior using the MCP inspector and a separate repository path. Done means the access limitation or its absence is explicit and the requested repository-scoping behavior is defined, including the relationship to git_init and issue #188.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, python
Domain
security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.