About git-mcp
git-mcp is an MCP server for interacting with Git repositories, aimed at developers who need repository status and history. It provides queries for commits, changed files, diffs, and individual file history.
Key features
- 01View commits with author, date, and message
- 02List files changed across a commit range
- 03Inspect file differences between commits
- 04View commit history for an individual file
Use cases
- 01Review recent repository commits
- 02Find files changed within a specified range
- 03Examine file diffs and history
MCP support
Exposes Git repository management and tools for querying history, changed files, and diffs to MCP clients.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEgit-mcp
This project is a Model Context Protocol (MCP) server designed to interact with Git repositories. It provides functionality for managing and interacting with Git repositories through MCP tools.
🚀 Features
✅ Git Repository Management: Execute Git operations and manage repositories.
✅ Repository History: View commit history and file changes over time.
✅ File Tracking: Track file changes and view file history.
✅ Diff Operations: View detailed file differences between commits.
📋 Requirements
- Go 1.23.0 or later
- Git installed on your system
- Access to Git repositories
⚙️ Setup
1️⃣ Install the Package
go install github.com/wricardo/git-mcp@latest
2️⃣ Configure MCP Client Settings
Add the following configuration to your MCP settings:
"git-mcp": {
"command": "git-mcp",
"env": {
"WORKDIR": "/path/to/your/git/repository"
},
"disabled": false,
"autoApprove": []
}
▶️ Usage
Run the MCP server:
git-mcp
🛠️ Tools
🔹 git-log
Display git commit history with commit hash, author, date, and message.
📌 Parameters:
limit(optional): Number of commits to display (default: 10)
📌 Example Response:
[
{
"hash": "1234567890abcdef",
"author": "John Doe",
"date": "2024-03-20",
"message": "Initial commit"
}
]
🔹 git-changed-files
List files changed between HEAD and a specified number of commits back.
📌 Parameters:
commits_back(required): Number of commits to look back from HEAD
📌 Example Response:
[
{
"path": "README.md",
"changeType": "modified"
}
]
🔹 git-file-diff
View detailed file differences between commits.
📌 Parameters:
file_path(required): Path to the file to view differencescommits_back(required): Number of commits to look back from HEAD
📌 Example Response:
{
"path": "README.md",
"changes": [
{
"type": "add",
"content": "New line added",
"lineNumber": 42
}
]
}
🔹 git-file-history
View the commit history for a specific file.
📌 Parameters:
file_path(required): Path to the file to view historylimit(optional): Number of commits to display (default: 10)
📌 Example Response:
[
{
"hash": "1234567890abcdef",
"author": "John Doe",
"date": "2024-03-20",
"message": "Update README.md"
}
]
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.