Moth
A debugging workflow plugin for AI coding agents. Turns terminal failures into source-backed fixes via MCP and structured skills.
README
<p align="center"> <img src="https://github.com/stfade/moth/blob/main/assets/moth-logo.png?raw=true" width="120" alt="Moth Logo" /> </p>
<h1 align="center">Moth</h1>
<p align="center"> <a href="https://www.npmjs.com/package/@stfade/moth"><img src="https://badge.fury.io/js/@stfade%2Fmoth.svg" alt="npm version"></a> <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a> </p>
Moth is a lightweight MCP server for project-local bug-fix analysis and verified fix memory.
What Moth Does
Moth receives error output through MCP, redacts likely secrets, normalizes the failure, detects the likely stack, checks project-local fix memory, and returns a structured fix brief.
Moth does not edit code, run shell commands, crawl repositories, require a backend, or maintain a global bug database.
Why Moth?
Bug-fix context is often local to a project: the command that failed, the framework in use, nearby configuration, and fixes that have already worked or failed in that repo.
Moth keeps that workflow small and explicit. It analyzes provided error context, suggests a best first fix, and records only verified fix outcomes in project-local memory.
Quick Start
Requires Node.js 18+.
Run directly:
npx -y @stfade/moth moth-mcp
Or install globally:
npm install -g @stfade/moth
moth-mcp
Generic MCP config
{
"mcpServers": {
"moth": {
"command": "npx",
"args": ["-y", "@stfade/moth", "moth-mcp"]
}
}
}
Usage Example
When using Moth with a supported AI agent, you can include a simple prompt like this along with your error:
"Use Moth to analyze this error before fixing it."
Supported Clients
| Client | Status | Setup |
|---|---|---|
| Codex | Local plugin-ready | Setup |
| Claude Code | Local plugin-ready | Setup |
| Cursor | Plugin scaffold | Setup |
| Gemini CLI | Extension scaffold | Setup |
| Gemini Antigravity | MCP config-ready | Setup |
| OpenCode | MCP config-ready | Setup |
| Generic MCP | Config-ready | Setup |
“Local plugin-ready” means the integration wrapper is included and can be tested locally. Marketplace submission and approval are not included yet.
Tools
Moth exposes exactly two MCP tools.
analyze_error
Analyzes provided error output before a fix is attempted.
Input fields:
error_outputcommand?cwd?package_context?relevant_files?environment?
Output fields:
analysis_idfingerprintstacklikely_causebest_first_fixverificationprior_project_fixesavoidconfidence
remember_fix_result
Records verified project-local fix memory.
Input fields:
analysis_idfingerprintstackfix_attemptedverification_commandverification_result: "passed" | "failed"notes?
The public worked input is rejected. worked is derived from verification_result.
Verified Memory Lifecycle
analyze_error
→ apply/attempt fix
→ run verification command
→ remember_fix_result
Call remember_fix_result only when:
- a fix/change was actually attempted
- the verification command actually ran
- the result is clearly
passedorfailed
Do not call it for suggestions, skipped changes, missing verification, ambiguous results, or guesses.
Local Memory
Verified project-local fix memory is stored at:
.moth/fix-memory.jsonl
Moth keeps a small Moth-owned analysis registry outside the project so remember_fix_result can map analysis_id back to the correct project path after an MCP server restart.
Skills
Moth includes concise skills for compatible agents:
moth-debug-first-fixmoth-source-backed-researchmoth-verify-fix
The MCP server itself does not perform live web research. Compatible agents may use their own search tools, guided by Moth skills, when external sources are needed.
Safety
- read-only by default
- no source edits
- no shell execution
- no repo-wide scan
- no background watcher
- no external service required
- redacts likely secrets before analysis, responses, and memory writes
Development
pnpm install
pnpm test
pnpm build
pnpm dev
npm pack --dry-run
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。