Skip to main content
Glama
SamuelH98
by SamuelH98

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

  1. The agent calls report_attempt(error_signature, fix_summary) after any failed fix.

  2. 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.

  3. 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.

  4. 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.

  5. If the agent tries another fix while still blocked (i.e. it skipped the search), report_attempt calls 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: ContextEngine

Install

cd unstuck-mcp
npm install

Then wire it into whichever CLI(s) you use:

GitHub Copilot CLI

copilot mcp add
# Command: node
# Args: /absolute/path/to/unstuck-mcp/index.js

or 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

UNSTUCK_THRESHOLD

2

How many failed attempts before blocking (3rd attempt = 1st time blocked)

UNSTUCK_DIR

<cwd>/.unstuck

Where attempt history is stored

Tools exposed

  • report_attempt(error_signature, fix_summary) — log a failed attempt, get back whether you're blocked

  • confirm_search(error_signature, findings_summary) — clear a block after actually searching

  • loop_status() — see everything currently tracked as stuck, for debugging

  • reset_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 tools
loop_statusA

View all currently tracked failed-attempt histories for this project, sorted by repeat count. Useful for checking what's been stuck.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of disclosure. It explicitly says 'View', indicating a non-destructive operation, and adds context about project scope and sorting order. It does not describe output format, but this is not critical for a simple status listing.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is one efficient sentence with no filler. It front-loads the action and includes relevant details (project scope, sorting) without waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple no-parameter, read-only tool, the description adequately covers what the tool does and when to use it. It lacks an explicit output description, but since there is no output schema, this is a minor gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

This tool has zero parameters, so schema coverage is 100% and the description does not need to explain parameters. The baseline of 4 applies because there is nothing to document.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: viewing all currently tracked failed-attempt histories for the project, sorted by repeat count. This specific verb-resource combination distinguishes it from siblings like report_attempt and reset_loop.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives a clear use context ('checking what's been stuck') and implies it is for read-only status inspection. However, it does not explicitly mention alternatives or when not to use this tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
fix_summaryYesOne-line description of the fix you just attempted.
error_signatureYesThe error message, test failure, or symptom text (verbatim or close to it).

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses key behavioral aspects: the tool returns whether the exact problem has been tried before and whether web search is now required before retrying. It also implies statefulness by tracking previous attempts. This goes beyond a simple 'report' verb and gives context about consequences.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, with the first stating purpose and return values, and the second providing usage timing. Every sentence adds value, and it is appropriately front-loaded. No redundancy or filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers purpose, usage timing, and return values, which is sufficient for a simple two-parameter tool with no output schema. It lacks exact return types (e.g., booleans) but the description 'returns whether...' is clear enough. Given the tool's simplicity, it is nearly complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, and the parameter descriptions are already clear (error_signature: 'The error message, test failure, or symptom text'; fix_summary: 'One-line description of the fix you just attempted'). The tool description adds no additional meaning beyond these, matching the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Report' and the resource 'that a fix attempt for an error/bug just failed.' It also explains what the tool returns (whether the problem has been tried before and whether web search is required), which distinguishes it from sibling tools like confirm_search, loop_status, and reset_loop. The purpose is specific and unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives explicit timing: 'Call this immediately after any failed fix, before writing more code.' This provides clear context for use. However, it does not explicitly mention alternatives or when not to use it, though the context strongly implies it is only for failed fixes.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
clear_allNoIf true, wipes all tracked history.
error_signatureNoThe error text to clear history for.

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It accurately describes the two clearing modes and scopes to 'this project', but stops short of explicitly noting irreversible destruction or permission requirements. The word 'wipe' implies destructiveness, but explicit disclosure would strengthen transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with the main action and immediately explaining the parameter options. No redundant or filler content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple two-parameter tool with no output schema, the description covers the core purpose, parameter semantics, and project scope. It doesn't mention return values or side effects beyond clearing, but these are not critical given the schema richness. A small improvement would be an explicit 'cannot be undone' note.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so baseline 3 applies. The description adds slight context (clears just that one vs. wipe everything) but essentially restates the schema. Minimal extra value beyond the existing parameter descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's action with a specific verb ('Clear') and resource ('tracked attempt history'), fully distinguishing it from siblings like report_attempt and loop_status. It also explains the intended outcome (no longer flagged as a repeat).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides clear context for when to use the tool and how to choose between the two parameters (error_signature for one, clear_all=true for everything). It doesn't explicitly name alternative tools, but the usage context is unambiguous.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv1.0.0
    • First observedconfirm_search
    • First observedloop_status
    • First observedreport_attempt
    • First observedreset_loop

TDQS

A4.3/5.0

Scored across 4 tools

Disambiguation5/5

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.

Naming Consistency4/5

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.

Tool Count5/5

Four tools is well-scoped for this narrow domain of tracking and managing failed-attempt loops. No redundant tools, each earns its place.

Completeness5/5

The domain is fully covered: report failures, unblock after search, view history, and reset. No obvious gaps for the stated purpose.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Detects 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.
    4 npm
    4
    MIT