local-git
MCP server from okdshin/local-git-mcp-server
claude mcp add --transport stdio okdshin-local-git-mcp-server python git_server.py \ --env REPOSITORIES_DIR="Directory to store repositories (default ./repositories)"
How to use
This MCP server provides a Python-based API for managing local Git repositories. It uses the MCP server framework to expose operations like creating repositories, adding files, committing changes, pulling/pushing, and generating diffs. With this server running, clients can interact with local Git repositories through the MCP protocol, enabling programmatic repository management and automation. To start, ensure Python is installed and run the server script as shown in the README; the server will listen for MCP requests and perform Git operations on the configured repositories directory. The available capabilities include: creating a new repository, adding and staging files, committing with messages, pulling and pushing changes (to configured remotes), and generating diffs between commits or working tree states. The server validates repository names to prevent invalid or conflicting entries and abstracts Git operations behind MCP messages for smooth integration with other services.
How to install
Prerequisites:
- Python 3.8 or newer
- Git installed and available on your PATH
- Internet access to install Python packages
Step 1: Prepare environment
- Option A: Use a virtual environment (recommended)
- python -m venv venv
- source venv/bin/activate # on Unix or macOS
- .\venv\Scripts\activate # on Windows
Step 2: Install dependencies
- pip install GitPython pydantic mcp-server black isort (If you have a requirements file, you can install with: pip install -r requirements.txt)
Step 3: Run the server
- Place your repository storage in the default location or configure a custom one with the repositories-dir argument
- Run:
- python git_server.py --repositories-dir ./repositories
Step 4: Verify the server is running
- Check the console output for a readiness message
- Use your MCP client to send requests to the server's endpoint as defined by your MCP setup
Additional notes
Tips and common issues:
- Ensure Git is installed and accessible in the environment where the server runs; the server relies on Git for repository operations.
- If you encounter permission errors, verify that the user running the server has read/write access to the repositories directory.
- Repositories are stored under the configured REPOSITORIES_DIR. Use a descriptive, valid repository name to avoid validation errors.
- The server uses Black and isort for code formatting during development; ensure these tools are installed if you are modifying the server code.
- If you need to adjust where repositories are stored, pass --repositories-dir to the startup command or set the REPOSITORIES_DIR environment variable in your deployment environment.
- For debugging, inspect logs produced by the server for MCP message handling and Git operation results.
Related MCP Servers
mcp-vegalite
MCP server from isaacwasserman/mcp-vegalite-server
github-chat
A Model Context Protocol (MCP) for analyzing and querying GitHub repositories using the GitHub Chat API.
nautex
MCP server for guiding Coding Agents via end-to-end requirements to implementation plan pipeline
pagerduty
PagerDuty's official local MCP (Model Context Protocol) server which provides tools to interact with your PagerDuty account directly from your MCP-enabled client.
futu-stock
mcp server for futuniuniu stock
mcp -boilerplate
Boilerplate using one of the 'better' ways to build MCP Servers. Written using FastMCP