home / mcp / local git mcp server

Local Git MCP Server

Provides a local MCP server to manage Git repositories with standard Git operations via MCP clients.

Installation
Add the following to your MCP client configuration file.

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.

How to use

Start the MCP server locally to manage your repositories. The server is initiated with a repositories directory to store Git repositories.

How to use with an MCP client

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.

How to install

Prerequisites and environment for a Python-based MCP server.

How to install

# 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 ./repositories

Additional notes

The 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.

Available tools

create_repo

Create a new Git repository within the configured repositories directory. Initializes a bare or standard repository structure ready for initial commits.

add_files

Add one or more files to a repository's index, staging them for commit.

commit_changes

Create a commit with a message describing the changes made to the repository.

pull_repository

Fetch and integrate changes from a remote into the current branch of a repository.

push_repository

Send local commits from the repository to a configured remote.

generate_diff

Produce a diff between working tree, index, or commits to view changes.