unstuck-mcp

unstuck-mcp

Prevents coding agents from repeatedly attempting the same failed fix by tracking attempts and blocking further fixes until the agent uses its own web search tool.

Category
访问服务器

README

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.

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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选