AutoPatch MCP Server
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., "@AutoPatch MCP ServerFix the failing tests and make the suite pass"
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.
AutoPatch — Self-Healing Debugging Agent (MCP Server)
AutoPatch is a closed-loop agent: it runs a repo's tests, and if something fails, it searches that repo's own git history for how a similar bug was fixed before, generates a patch guided by that precedent, applies it, and re-runs the tests — looping until the suite passes or it gives up after a capped number of attempts. It doesn't just answer questions about code, it takes real actions (running pytest, writing files) and reacts to real feedback (test results), which is the core pattern behind current autonomous software-engineering agents (Devin, OpenHands, SWE-agent).
Everything is also exposed as an MCP server, so any MCP client (Claude
Desktop, Cursor, a LangGraph agent via langchain-mcp-adapters) can drive
the same loop through four tools instead of the Streamlit UI.
Architecture
┌─────────────┐
┌───────▶│ run_tests │◀────────────────┐
│ └──────┬──────┘ │
│ pass │ fail │
│ ▼ │
│ ┌───────────────────┐ │
__END__ │ retrieve_precedent│ ChromaDB over the repo's own
│ (ChromaDB search) │ git log (commit msgs + diffs)
└─────────┬──────────┘ │
▼ │
┌─────────────────┐ │
│ propose_patch │ Groq LLM, function-level fix,
│ (Groq + Llama) │ guided by the retrieved precedent
└─────────┬────────┘ │
▼ │
┌─────────────────┐ │
│ apply_patch │──────────────┘
└─────────────────┘Implemented as a LangGraph StateGraph with a conditional edge that routes
back into the loop on failure (capped at MAX_PATCH_ITERATIONS) and out to
END on success.
Related MCP server: knownissue
Why function-level patching, not whole-file rewrites
Early design considered asking the LLM to return the entire corrected
file. Rejected: LLMs occasionally truncate or silently drop unrelated
functions when asked to reproduce a whole file. Instead, the LLM only ever
returns the single corrected function; src/code_surgery.py splices it
back into the real file via AST-based function-boundary detection, and the
diff shown in the UI is computed with difflib against the actual bytes
that get written — what you see is guaranteed to be what's applied.
The demo repo
demo_repo/ is a tiny, real git repository (own history, own commits) with
a calculator package. Its git history contains a genuine bug-fix commit:
divide() originally divided by (b - 1) instead of b, fixed in a later
commit. demo_repo/bug_scenarios/ lets you re-inject that same class of
bug (and two others) into the working tree at will, so AutoPatch always has
something fresh to heal, and — for the average_offbyone scenario — a real
historical precedent to retrieve and learn from.
Setup
git clone <your-repo-url>
cd autopatch
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
# edit .env: set GROQ_API_KEY (and optionally GROQ_API_KEY_FALLBACK)
python scripts/seed_git_history.py # builds demo_repo's real git history, onceRunning it
Streamlit dashboard (recommended for a live demo):
streamlit run streamlit_app.pyPick a bug scenario in the sidebar, click "Inject bug," then "Run AutoPatch agent" — watch it test, retrieve, patch, and re-test live.
CLI:
python main.py --scenario average_offbyoneMCP server (stdio transport, for Claude Desktop / Cursor / any MCP client):
python -m src.mcp_serverAdd to your MCP client config, e.g. Claude Desktop's claude_desktop_config.json:
{
"mcpServers": {
"autopatch": {
"command": "python",
"args": ["-m", "src.mcp_server"],
"cwd": "/path/to/autopatch",
"env": {"GROQ_API_KEY": "..."}
}
}
}REST API (for non-MCP clients, e.g. a CI webhook):
uvicorn src.rest_api:app --reload
# POST /inject {"bug_id": "average_offbyone"}
# POST /healTests
pytest tests/ -vtest_patcher.py and test_agent_graph.py use a fake Groq client (no
API key or network needed); test_executor.py runs the real demo repo's
test suite as a subprocess.
Tech stack
Python, LangGraph (cyclic state graph with conditional routing), MCP
(FastMCP), ChromaDB (git-history vector index), Groq (Llama 3.3, with
automatic fallback to a secondary API key on rate limits), FastAPI,
Streamlit, GitPython, pytest, difflib/ast for source-level patching.
Deployment
See render.yaml / Procfile — deploys as a single Render web service
running the Streamlit dashboard (the MCP server and REST API run
in-process alongside it for the demo; run src.mcp_server separately for
real MCP-client integration).
This server cannot be installed
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
- Alicense-qualityDmaintenanceEnables agentic coding workflows in Claude Code through a multi-candidate patch evaluation loop that generates code variants, validates builds, scores results with mandatory vision testing, and automatically selects the best implementation.Last updatedMIT
- Flicense-qualityCmaintenanceShared debugging memory for AI coding agents. Agents search, report, patch, and verify bug fixes through 5 MCP tools. Verified by proof, not upvotes.Last updated1
- AlicenseBqualityCmaintenanceA debugging workflow plugin for AI coding agents. Turns terminal failures into source-backed fixes via MCP and structured skills.Last updated2272MIT
- Flicense-qualityCmaintenanceSpecForge is a Model Context Protocol (MCP) server that connects an LLM client to a fully autonomous code-fixing pipeline. Point it at a GitHub issue, and it reads the repo, plans a fix, writes the code, tests it, and opens a pull request.Last updated
Related MCP Connectors
AI code review for GitHub PRs with an MCP autofix loop for Claude Code and Cursor
Shared debugging memory for AI coding agents
User-owned memory for AI agents, Copilot, Claude, IDEs, CLIs, and chat apps over remote MCP.
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/Swastigit2005/Autopatch-MCP-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server