git-surgeon-mcp

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.

Category
Visit Server

README

git-surgeon-mcp

License Node TypeScript 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.

How it's safe

  • No shell execution — every Git call uses execFile with an argument array, so command injection is structurally impossible.
  • No -m quoting issues — messages are written to a temp file and applied via git commit -F.
  • Non-interactive rebase shim — rewording a non-HEAD commit normally needs two interactive editors; the server points GIT_SEQUENCE_EDITOR/GIT_EDITOR at generated scripts that do it programmatically.
  • Clean-tree checks — every operation requires a clean git status and auto-aborts (git rebase --abort) on failure.

Tools

Tool Description
git_get_history Structured git log output.
git_quick_squash Squash the last N commits with a new message.
git_reword_commit Reword any commit (HEAD or buried in history).
git_rescue_reflog 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 build

Add 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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured