unstuck-mcp
Prevents GitHub Copilot CLI coding agents from repeatedly attempting the same failed fix by tracking attempts and blocking further fixes until a web search is performed.
Prevents OpenAI Codex CLI coding agents from repeatedly attempting the same failed fix by tracking attempts and blocking further fixes until a web search is performed.
Click on "Deploy 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., "@unstuck-mcp report a failed fix attempt for the login error"
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.
unstuck-mcp
Stops coding agents from looping on the same failed fix. Tracks failed attempts per-problem, and once the same error has been "fixed" a couple of times without success, it blocks further fixes until the agent actually uses its own web search tool — instead of guessing again from stale memory.
Works with GitHub Copilot CLI, OpenAI Codex CLI, and OpenCode, because
all three speak MCP, all three read AGENTS.md, and all three already ship a
web search tool of their own. This server doesn't duplicate that search — it
just gates on whether it happened.
How it works
The agent calls
report_attempt(error_signature, fix_summary)after any failed fix.The server normalizes the error text (strips line numbers, file paths, quoted values) and hashes it, so near-identical failures are recognized as "the same problem" even if the wording drifts slightly.
On the 3rd attempt at the same normalized problem (configurable), the tool response tells the agent it's blocked: it must use its own web search tool before trying anything else.
Once it has searched, the agent calls
confirm_search(error_signature, findings_summary). This clears the block and resets the attempt count for that problem, informed by what it just found.If the agent tries another fix while still blocked (i.e. it skipped the search),
report_attemptcalls it out explicitly instead of quietly logging it.
This is enforced through instructions, not a hard runtime block — MCP servers
can't intercept an agent's other tool calls the way an editor plugin can. It
works because the tool descriptions and the bundled AGENTS.md rule make
calling it the obvious, expected thing to do, the same pattern that made
docs-lookup MCP servers like Context7 stick. confirm_search closes the loop:
the agent can't just claim it's unblocked without a tool call that says so.
Related MCP server: Fix Memory MCP
Install
cd unstuck-mcp
npm installThen wire it into whichever CLI(s) you use:
GitHub Copilot CLI
copilot mcp add
# Command: node
# Args: /absolute/path/to/unstuck-mcp/index.jsor edit ~/.copilot/mcp-config.json directly:
{
"mcpServers": {
"unstuck": {
"command": "node",
"args": ["/absolute/path/to/unstuck-mcp/index.js"]
}
}
}OpenAI Codex CLI
Add to your Codex config (~/.codex/config.toml):
[mcp_servers.unstuck]
command = "node"
args = ["/absolute/path/to/unstuck-mcp/index.js"]OpenCode
Add to opencode.json (project or global):
{
"mcp": {
"unstuck": {
"type": "local",
"command": ["node", "/absolute/path/to/unstuck-mcp/index.js"],
"enabled": true
}
}
}Enable the enforcement rule
Copy the contents of AGENTS.snippet.md into your project's AGENTS.md
(all three tools read this file). Without it, the agent still can call these
tools, but won't reliably choose to on its own.
Configuration
Environment variables (set them in the MCP server config's env block):
Variable | Default | Purpose |
|
| How many failed attempts before blocking (3rd attempt = 1st time blocked) |
|
| Where attempt history is stored |
Tools exposed
report_attempt(error_signature, fix_summary)— log a failed attempt, get back whether you're blockedconfirm_search(error_signature, findings_summary)— clear a block after actually searchingloop_status()— see everything currently tracked as stuck, for debuggingreset_loop(error_signature?, clear_all?)— clear history manually
Known limitation
This relies on the agent following its instructions honestly — calling
report_attempt after failures, and not calling confirm_search without
actually searching. It's not a hard sandbox-level block like an OpenCode
plugin hook could be. In exchange, it works identically across every
MCP-compatible agent instead of being locked to one tool's plugin architecture,
and it doesn't duplicate a search tool the agent already has.
Available Tools
4 toolsconfirm_searchA
Call this after using your own web search tool to look up an error that report_attempt flagged as blocked. Clears the block and lets you resume fixing, now informed by current information instead of a repeated guess.
Inputs: error_signature (required), findings_summary (required).
loop_statusA
View all currently tracked failed-attempt histories for this project, sorted by repeat count. Useful for checking what's been stuck.
Inputs: no named parameters.
report_attemptA
Report that a fix attempt for an error/bug just failed. Returns whether this exact problem has been tried before and whether you're now required to use your web search tool before retrying. Call this immediately after any failed fix, before writing more code.
Inputs: fix_summary (required), error_signature (required).
reset_loopA
Clear tracked attempt history so a problem is no longer flagged as a repeat. Pass an error_signature to clear just that one, or clear_all=true to wipe everything for this project.
Inputs: clear_all, error_signature.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose: reporting a failed attempt, confirming a search, viewing status, and resetting state. No overlap or ambiguity between them.
Three tools follow the verb_noun pattern (report_attempt, confirm_search, reset_loop), while loop_status is noun_noun but still reads as a status query. Minor deviation but overall predictable.
Four tools is well-scoped for this narrow domain of tracking and managing failed-attempt loops. No redundant tools, each earns its place.
The domain is fully covered: report failures, unblock after search, view history, and reset. No obvious gaps for the stated purpose.
Maintenance
Related MCP Connectors
Shared fix library for coding agents: search fixes other agents found, report what worked.
Catch AI agent loops: halt runs that repeat the same failing step or tool call.
Shared debugging wiki for AI agents: search by exact error, read verified fixes, report outcomes.
Check what other agents hit the same tool failure — and what recovery worked. Ask before retrying.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceDetects and breaks repetitive fix loops in AI coding assistants by tracking attempts and providing escalating intervention strategies. It utilizes error fingerprinting and similarity analysis to redirect the AI toward new approaches when it gets stuck on the same error.10 npm4MIT
- AlicenseCqualityCmaintenanceLocal-first error memory for AI coding agents, enabling them to search past fixes before attempting new repairs and save verified cases as Markdown.3MIT
- AlicenseAqualityBmaintenanceHelps AI agents avoid repeating known failures by providing deterministic lookup of dead ends for coding errors and country-specific real-world rules.1151 PyPIMIT
- AlicenseNot gradedqualityDmaintenanceProvides coding agents with durable, cross-session lessons-learned memory, enforcing that success or failure verdicts can only come from human approval, human correction, or objective metrics—never from the agent itself.Apache 2.0