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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.