git-surgeon-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@git-surgeon-mcpsquash the last 3 commits into one with message 'Fix login bug'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
git-surgeon-mcp
An MCP server that gives AI agents safe, non-interactive Git history editing — squashing, rewording, and reflog rescue — without ever hanging on a Vim buffer.
Why
Agents shell out to Git fine for everyday commands, but git rebase -i and git commit --amend (without -m) open an interactive editor and hang forever waiting for input that never comes. Agents then resort to risky fallbacks like git reset --hard. git-surgeon-mcp wraps these operations in clean, programmatic tools instead.
Related MCP server: Git MCP Server
How it's safe
No shell execution — every Git call uses
execFilewith an argument array, so command injection is structurally impossible.No
-mquoting issues — messages are written to a temp file and applied viagit commit -F.Non-interactive rebase shim — rewording a non-HEAD commit normally needs two interactive editors; the server points
GIT_SEQUENCE_EDITOR/GIT_EDITORat generated scripts that do it programmatically.Clean-tree checks — every operation requires a clean
git statusand auto-aborts (git rebase --abort) on failure.
Tools
Tool | Description |
| Structured |
| Squash the last N commits with a new message. |
| Reword any commit (HEAD or buried in history). |
| Find dangling/unreachable commits via reflog + fsck. |
Setup
git clone https://github.com/mustafatekiinn/git-surgeon-mcp.git
cd git-surgeon-mcp
npm install && npm run buildAdd to your client's MCP config (Claude Desktop's claude_desktop_config.json, Cursor's .cursor/mcp.json, etc.), using the absolute path to dist/index.js:
{
"mcpServers": {
"git-surgeon": {
"command": "node",
"args": ["/absolute/path/to/git-surgeon-mcp/dist/index.js"]
}
}
}Restart the client — the four tools are now available whenever the agent works inside a Git repo.
Requirements
Node.js 18+, Git on
PATH, a local Git repository
Safety Notes
Squashing/rewording rewrites history — force-push (
--force-with-lease) if already pushed, and coordinate with collaborators first.All operations abort cleanly, leaving no partial state, if the working tree is dirty or a step fails.
License
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityDmaintenanceAn MCP server that gives coding agents instant insight into any Git repository — no guessing, no hallucination.14618MIT
- Alicense-qualityBmaintenanceA secure and scalable Git MCP server giving AI agents powerful version control for local and (soon) serverless environments.121Apache 2.0
- AlicenseAqualityDmaintenanceA filesystem-based MCP server for AI coding agents to coordinate work across git worktrees by claiming files, checking for conflicts, and logging progress without affecting the repository's git history.5MIT
- Alicense-qualityCmaintenanceAn MCP server that gives AI agents git repository access: status, log, diff, branch, commit, push, pull, tag, stash, remotes — 24 tools, zero dependencies, pure Python stdlib (subprocess).MIT
Related MCP Connectors
A MCP server built for developers enabling Git based project management with project and personal…
An MCP server that gives your AI access to the source code and docs of all public github repos
Person-owned, portable AI memory as a remote MCP server, readable and writable by any MCP client.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/mustafatekiinn/git-surgeon-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server