home / mcp / local git mcp server
Provides a local MCP server to manage Git repositories with standard Git operations via MCP clients.
Configuration
View docs{
"mcpServers": {
"okdshin-local-git-mcp-server": {
"command": "python",
"args": [
"git_server.py",
"--repositories-dir",
"./repositories"
]
}
}
}You are running a Python-based MCP server that manages local Git repositories. It exposes a simple, scalable way to perform common Git operations through MCP clients, making it easy to create repos, add files, commit changes, sync with remotes, and generate diffs from a single centralized service.
Start the MCP server locally to manage your repositories. The server is initiated with a repositories directory to store Git repositories.
Connect your MCP client to the local server and choose the operation you want to perform. You can create repositories, add files, commit changes, pull from or push to remotes, and generate diffs. Each operation corresponds to a specific tool exposed by the MCP server. Use the client to pass repository names, file paths, commit messages, and other Git parameters as needed.
Prerequisites and environment for a Python-based MCP server.
# Prerequisites
- Python 3.8+ (recommended)
- pip (comes with Python)
# 1) Ensure Python is available
python --version
# 2) Install required Python packages
pip install GitPython pydantic mcp-server black isort
# 3) Run the MCP server
python git_server.py --repositories-dir ./repositoriesThe server uses a local directory to store Git repositories. You can customize the repository storage path by passing a different value to --repositories-dir when starting the server. Dependency tools like Black and isort are used to keep code clean if you contribute or modify the server.
Create a new Git repository within the configured repositories directory. Initializes a bare or standard repository structure ready for initial commits.
Add one or more files to a repository's index, staging them for commit.
Create a commit with a message describing the changes made to the repository.
Fetch and integrate changes from a remote into the current branch of a repository.
Send local commits from the repository to a configured remote.
Produce a diff between working tree, index, or commits to view changes.