@edjl/git-mcp
v1.0.8
Published
Git tools for MCP (Model Context Protocol)
Downloads
25
Maintainers
Readme
Git MCP
A Model Context Protocol (MCP) server providing Git version control tools for AI assistants.
Features
19 Git tools with the git_ prefix:
Repository Operations
git_status- Show working tree statusgit_diff- Show unstaged changes (ignores lock files by default)git_diff_staged- Show staged changes (ignores lock files by default)git_add- Stage files for commitgit_reset- Reset HEAD to specified stategit_stash- Stash/retrieve changesgit_clone- Clone repositoriesgit_pull- Pull changes from remotegit_push- Push changes to remotegit_fetch- Fetch changes without merginggit_remote- Manage remote repositoriesgit_tag- Create and manage tags
Commit Operations
git_log- List commits with hashes and filtering optionsgit_show- Show commit changes and detailsgit_commit- Create commits
Branch Operations
git_branch- List, create, delete branchesgit_checkout- Switch branches or restore filesgit_merge- Merge branchesgit_rebase- Rebase branches
Installation
- Clone the repository
- Install dependencies:
npm install - Build the project:
npm run build
Usage with Cursor
Add to your ~/.cursor/mcp.json:
{
"mcpServers": {
"git-mcp": {
"command": "node",
"args": [
"/path/to/git-mcp/build/index.js"
]
}
}
}Development
npm run dev- Watch mode for developmentnpm run build- Build the projectnpm start- Run the server
Tool Usage Examples
# List commits
git_log(count: 10, oneline: true)
# Show commit changes
git_show(commit: "abc123")
# Check status
git_status(short: true)
# Stage files
git_add(paths: ["src/", "README.md"])
# Commit changes
git_commit(message: "Add new feature")
# Push to remote
git_push(remote: "origin", branch: "main")Special Features
Lock File Filtering
The git_diff and git_diff_staged tools automatically ignore common lock files by default:
- package-lock.json
- yarn.lock
- pnpm-lock.yaml
- composer.lock
- Gemfile.lock
- And many more...
This can be disabled by setting ignoreLockFiles: false.
