GitRescue MCP server
Commit Nov 8, 2026Fixes git mistakes from plain-language requests using a sandboxed agent with automated backups and safety guardrails.
Also known as imaketech1/gitrescue
- Stars
- 0
- Tools
- —
- Downloads, 30 days
- —
- Latest version
- —
- Last commit
- Nov 8, 2026
- License
- MIT
What is GitRescue MCP?
GitRescue fixes git mistakes from plain-language requests using a sandboxed agent with automated backups and safety guardrails.
Summary generated from the project's README
About GitRescue MCP server
Correcting accidental git commits or branch mistakes through natural language commands is the primary function of this tool. Developers use it to resolve common errors like committing to the main branch instead of a feature branch. It operates as a sandboxed agent that inspects your repository, creates a plan, and executes fixes using a specific set of 21 tools categorized into three risk tiers.
Users can run it as a command line interface or connect it to an AI client via an MCP server using the stdio transport. The system defaults to working on a temporary copy of your repository to ensure safety, requiring human approval before any destructive tools like reset, rebase, or push_force_with_lease are executed. It requires an API key for Groq or any OpenAI-compatible endpoint to function.
Safety is maintained through a policy engine that prevents shell access and blocks dangerous actions like force-pushing to protected branches or deleting remote branches. Every change triggers an automated backup of the HEAD, branches, stash, index, and working tree under refs/gitrescue/backups to allow for easy restoration.
What you can do with it
- 1Fixing accidental commitsA developer can ask the agent to move a commit from the main branch to a feature branch.
- 2Safe repository experimentationYou can run git repairs on a temporary copy of your code to prevent accidental data loss.
- 3Auditing agent actionsDevelopers can review the exact steps and JSONL traces taken during a previous repair session.
- 4Testing agent reliabilityYou can run the agent through a series of predefined scenarios to verify its performance.
Written from the project's README. Every use case is checked against a quote from it.
Configuration
GITRESCUE_API_KEY
| Name | Description | |
|---|---|---|
| GITRESCUE_API_KEY | — |
README
View on GitHubGitRescue
An LLM agent that fixes git mistakes from plain-language requests, safely.
pip install gitrescue
export GITRESCUE_API_KEY=... # Groq by default
gitrescue "I committed to main instead of my feature branch"
The agent inspects the repository, plans, runs fixes step by step through a fixed set of tools, verifies the end state and reports what it did. By default it works on a temporary copy of your repository and applies the result only after you approve the final plan.
Safety model
Every tool call passes through a policy engine that the model cannot change:
- Allowlist: 21 tools in three risk tiers (READ, LOCAL_REVERSIBLE, DESTRUCTIVE). No shell.
- Hard blocks: force-pushing
main/master, the remote default branch or another author's branch; deleting remote branches;git clean; config and credential changes; paths outside the repository. Repository hooks never run. - Backups: before every change, HEAD, all branches, the stash, the index and the full working tree are
pinned under
refs/gitrescue/backups/<id>.restore_backupundoes anything. - Approval: DESTRUCTIVE tools (
reset,rebase,resolve_conflict,push_force_with_lease) show a preview and need a human yes. - Invariant: after each change, no previously reachable commit or uncommitted work may be lost without a backup; on violation the step is rolled back automatically.
- Untrusted content: commit messages, file contents and branch names reach the model only as
escaped data inside
<tool_result untrusted="true">blocks.
Commands
| command | |
|---|---|
gitrescue "<request>" |
fix something (--no-sandbox to work in place) |
gitrescue replay [run_id] |
print a recorded run (JSONL traces) |
gitrescue eval [--reference] |
run the 15 eval scenarios |
gitrescue mcp -C <repo> |
MCP server (stdio) with the same tools and policy |
gitrescue tools |
list tools and risk tiers |
Configuration
GITRESCUE_API_KEY, GITRESCUE_BASE_URL (default https://api.groq.com/openai/v1), GITRESCUE_MODEL,
GITRESCUE_MAX_STEPS (15), GITRESCUE_MAX_TOKENS (200000), GITRESCUE_MAX_COST_USD with
GITRESCUE_COST_PER_MTOK_IN/_OUT, GITRESCUE_PROTECTED_BRANCHES, GITRESCUE_TRACE_DIR.
Any OpenAI-compatible endpoint with tool calling works.
GitRescue MCP questions
How does GitRescue ensure safety when fixing mistakes?
It uses a policy engine with an allowlist of 21 tools, hard blocks on destructive actions like force-pushing main, and requires human approval for destructive tools.
Can I undo changes made by the agent?
Yes, the system creates backups of the HEAD, branches, stash, index, and working tree before every change, which can be undone using the restore_backup tool.
Does it work directly on my repository?
By default, it works on a temporary copy of your repository and only applies the result after you approve the final plan.