Git
- python
0
GitHub Stars
python
Language
4 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
You can manage Git repositories through a dedicated MCP server that exposes Git operations over FastMCP/HTTP transport. This server enables you to clone, read, write, and list files, inspect status and diffs, create branches, commit changes, and push to remotes, all with strict workspace isolation and security checks to keep your workflows safe.
How to use
Use an MCP client to call the available tools exposed by the server. You send requests that specify the tool name and the necessary arguments, and you receive structured responses with success status, resulting paths, and relevant metadata like the current branch and commit. You can perform common Git operations and file operations in sequence to automate repository management from your tooling.
How to install
Prerequisites you need before starting are Docker and Docker Compose to run the service, Git installed inside the container, and Python 3.11 or newer for development and testing.
# Build the Docker image
cd tools/tool-git-mcp
docker-compose build
# Start the service
docker-compose up -d
# Check health
curl http://localhost:8000/health
Configuration and usage notes
Key configuration and usage notes you should be aware of include the following security and operational practices implemented in this MCP server: workspace isolation confines all operations to the /app/workspace directory inside the container, with layered path validation to prevent traversal. Only HTTPS and git:// URLs are accepted for Git operations, and branch names are restricted to safe characters and patterns. The server runs as a non-root user and uses a named volume to avoid host binds, with explicit resource limits and periodic health checks.
Security model overview
Workspace isolation ensures every operation executes inside the designated workspace directory. Path traversal and command injection are mitigated through strict validation. The server operates with non-root privileges, uses a named volume, and enforces resource limits to prevent overconsumption. You should always provide secure URLs and follow the allowed Git references and file path rules.
Troubleshooting
If the container won’t start or health checks fail, inspect logs and health status. Make sure the workspace directory has correct permissions and the MCP service is reachable at the expected endpoint.
Notes on testing and development
Development and testing flow includes installing dependencies, validating configurations, and running tests. You can validate the configuration, build the tooling, sync compose files for App Garden, and run the test suite for the Git MCP server.
Available tools
clone_repository
Clone a repository into an isolated workspace, placing the repository contents under a specified path and optional branch.
read_file
Read and return the contents of a file from a repository at a given path.
write_file
Write content to a file within a repository, creating any missing directories automatically.
list_files
List files and directories within a repository, with an option to recurse into subdirectories.
git_status
Provide the current working tree status, including the active branch, modified files, staged changes, and untracked files.
git_diff_unstaged
Show unstaged changes with contextual information for review.
git_diff_staged
Show staged changes with contextual information for review.
git_log
Return commit history with a configurable depth and formatting.
git_add
Stage specific files in preparation for a commit.
create_branch
Create a new branch from a specified base branch.
commit_changes
Stage and commit changes with a provided commit message.
git_checkout
Switch to a different branch within a repository.
push_changes
Push committed changes to a remote repository.