git-mcp
git-mcp is a Model Context Protocol (MCP) server that facilitates interactions with Git repositories. It allows users to manage Git operations, view commit histories, and track file changes effectively.
git-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"
}
]