Socket
Book a DemoInstallSign in
Socket

git-mcp

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-mcp

MCP server for interacting with Git using natural language

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

git-mcp

MCP (Model Context Protocol) server for interacting with Git using natural language. This tool allows you to perform common Git operations through simple commands, and it will figure out the right Git commands to execute.

Installation

pnpm install
pnpm build

Usage

Add to Claude Code

pnpm run mcp:add

Available Tools

Undo Operations

ToolDescriptionUse CaseGit Command
git_undo_commitUndo the last commit while keeping changes"How do I undo my last commit?"git reset --soft HEAD~1
git_revertRevert commits by creating new commits"How do I revert the last 3 commits?"git revert HEAD~3..HEAD
git_discard_changesDiscard local changes"How do I discard all my local changes?"git clean -fd && git checkout -- .
git_unstageUnstage files from staging area"How do I unstage a file I accidentally added?"git reset HEAD <file>
git_undo_mergeAbort an in-progress merge"How do I undo a merge?"git merge --abort
git_resetReset to a specific commit"How do I reset to a previous commit?"git reset --<mode> <commit>

Commit Editing

ToolDescriptionUse CaseGit Command
git_squashSquash multiple commits into one"How do I squash my last N commits into one?"git reset --soft HEAD~N && git commit
git_amendAmend the last commit"How do I edit an old commit message?"git commit --amend
git_stageStage files for commit"How do I add files to staging?"git add <files>
git_commitCreate a new commit"How do I commit my changes?"git commit -m "<message>"

Branching & Merging

ToolDescriptionUse CaseGit Command
git_create_branchCreate a new branch"How do I create a branch from an old commit?"git checkout -b <branch> <ref>
git_list_branchesList all branches"What branches exist?"git branch -a -vv
git_checkoutSwitch to a branch"How do I switch branches?"git checkout <branch>
git_delete_branchDelete a branch"How do I delete a branch?"git branch -d <branch>
git_move_changesMove changes to new branch"How do I move my changes to a different branch?"git stash && git checkout -b <branch> && git stash pop
git_cherry_pickApply commits from another branch"How do I cherry-pick a commit?"git cherry-pick <commit>
git_mergeMerge a branch"How do I merge without a merge commit?"git merge [--no-ff/--squash] <branch>
git_rebaseRebase current branch"How do I reorder my commits?"git rebase <target>

Syncing & Remote

ToolDescriptionUse CaseGit Command
git_pullPull changes from remote"How do I pull without creating a merge commit?"git pull --rebase
git_pushPush commits to remote"How do I force push safely?"git push --force-with-lease
git_fetchFetch from all remotes"How do I update remote refs?"git fetch --all --prune
git_update_branchUpdate branch with main"How do I update my branch with latest from main?"git fetch && git rebase origin/main
git_stashStash/restore changes"How do I save my work temporarily?"git stash [pop/list/drop]
git_remoteManage remotes"How do I add a remote?"git remote add/remove

History Inspection

ToolDescriptionUse CaseGit Command
git_logShow commit history"Show me recent commits"git log
git_showShow commit details"How do I see what changed in a commit?"git show <commit>
git_blameShow who changed each line"How do I find who changed a specific line?"git blame <file>
git_diffShow differences"Show me the changes"git diff [--staged]
git_searchSearch commits"How do I find a commit by its message?"git log --grep/S/author
git_file_historyShow file history"How do I see the history of a specific file?"git log --follow -- <file>
git_statusShow working tree status"What's my current status?"git status

Recovery

ToolDescriptionUse CaseGit Command
git_reflogShow reference log"How do I find lost commits?"git reflog
git_recover_commitRecover a lost commit"How do I get back a commit I reset?"git cherry-pick/checkout <commit>
git_recover_branchRecover deleted branch"How do I recover a deleted branch?"git checkout -b <branch> <reflog-commit>
git_find_lostFind dangling commits"Find unreachable commits"git fsck --unreachable
git_reset_to_reflogReset to reflog entry"Restore to previous state"git reset HEAD@{n}

Example Queries

Here are some natural language queries and the tools that handle them:

  • "Undo my last commit" → git_undo_commit
  • "Revert the last 3 commits" → git_revert with count=3
  • "Discard all my local changes" → git_discard_changes
  • "Unstage the file I just added" → git_unstage
  • "Squash my last 5 commits" → git_squash with count=5
  • "Create a branch from commit abc123" → git_create_branch with fromRef="abc123"
  • "Move my uncommitted changes to a new branch" → git_move_changes
  • "Cherry-pick commit xyz789" → git_cherry_pick
  • "Update my branch with the latest from main" → git_update_branch
  • "Who changed line 42 in app.js?" → git_blame with file and line range
  • "Find the commit that added 'TODO'" → git_search with type="content"
  • "Recover my deleted feature branch" → git_recover_branch

License

MIT

Keywords

git

FAQs

Package last updated on 17 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts