Skip to main content
Glama
README.md
<div align="center">

<p>
  <a href="README.md"><strong>English</strong></a> · <a href="README.ru.md">Русский</a>
</p>

<img src="assets/hero-banner.svg" alt="flight-recorder-mcp hero banner" width="900" />

<br/><br/>

![Tests](https://img.shields.io/badge/tests-node%3Atest%20passing-248A3D?style=flat-square)
![Zero Dependencies](https://img.shields.io/badge/dependencies-0%20npm%20packages-0071E3?style=flat-square)
![Node.js >= 22.5](https://img.shields.io/badge/node-%3E%3D22.5.0-6E6E73?style=flat-square)
![License MIT](https://img.shields.io/badge/license-MIT-6E6E73?style=flat-square)

**Local dev black-box ring buffer for ANSI-stripped terminal logs, deduplicated stack traces, and redacted HTTP failure capture over MCP.**

Works with Claude Code, Cursor, Windsurf, Codex CLI, and Antigravity.

</div>

Debugging a local backend or frontend with an AI coding agent usually means copying terminal stack traces and failing network payloads into chat by hand. Raw terminal output is also noisy with ANSI color codes and repeated identical errors.

`flight-recorder-mcp` wraps any local dev command (`flight-recorder run -- npm run dev`) and optionally proxies local HTTP traffic (`flight-recorder proxy`), storing clean logs, fingerprinted stack traces, and redacted HTTP 4xx/5xx failures in a bounded `node:sqlite` WAL ring buffer so an agent can inspect `trace_incident` on demand.

## Quick start

Requires Node.js `>= 22.5.0`.

```bash
# Wrap your local dev command while keeping full terminal output
npx -y github:keenfolk1-lgtm/flight-recorder-mcp run --service api -- npm run dev

# Optional HTTP proxy capturing >=400 or >1500ms responses with secrets redacted
npx -y github:keenfolk1-lgtm/flight-recorder-mcp proxy --listen 4080 --target http://127.0.0.1:3000

# View deduplicated runtime errors from the CLI
npx -y github:keenfolk1-lgtm/flight-recorder-mcp errors
```

### MCP server registration

```bash
claude mcp add flight-recorder -- npx -y github:keenfolk1-lgtm/flight-recorder-mcp serve
```

Or add to `mcp.json`:

```json
{
  "mcpServers": {
    "flight-recorder": {
      "command": "npx",
      "args": ["-y", "github:keenfolk1-lgtm/flight-recorder-mcp", "serve"]
    }
  }
}
```

## Example `trace_incident` output

When an error occurs three times and a `POST /api/checkout` returns HTTP `500` with `Authorization: Bearer ...` and `{"password":"..."}`:

```markdown
### Latest HTTP Failures
- 500 POST /api/checkout (11ms): {"error":"db crash","secret":"[REDACTED]"}

### Recent Deduplicated Errors
- [3x] TypeError: null user id 000000
    at verifySession (src/session.mjs:14:9)

### Recent Logs
2026-11-23T10:00:01.000Z [stdout] booting dev server
2026-11-23T10:00:01.002Z [stdout] ready on port 3000
```

Sensitive headers (`authorization`, `cookie`, `set-cookie`, `x-api-key`, `x-auth-token`) and JSON fields matching `password`, `token`, `secret`, or `apiKey` are replaced with `[REDACTED]` before hitting SQLite.

## MCP tools

| Tool | Purpose |
| --- | --- |
| `trace_incident` | Returns recent HTTP failures, top deduplicated errors, and surrounding log lines together. |
| `get_recent_errors` | Lists unique error fingerprints with stack trace, occurrence count, and first/last timestamp. |
| `get_failed_requests` | Lists HTTP >= 400 or slow requests with redacted headers and truncated bodies. |
| `tail_logs` | Queries the bounded ANSI-stripped log ring buffer by service or substring. |
| `recorder_status` | Reports SQLite path and active row counts. |

## Limitations

HTTP capture records requests routed through `flight-recorder proxy` and skips successful `2xx`/`3xx` responses under `slowMs` (default `1500ms`) to keep the ring buffer compact. Stack grouping recognizes Node.js, Python, Go, and `ERROR`/`FATAL` prefixes; custom unstructured multi-line logs fall back to `tail_logs`.

## License

[MIT](LICENSE)

Related tools: [mcp-diet](https://github.com/keenfolk1-lgtm/mcp-diet) · [skill-guard](https://github.com/keenfolk1-lgtm/skill-guard) · [blast-radius-mcp](https://github.com/keenfolk1-lgtm/blast-radius-mcp) · [agent-undo](https://github.com/keenfolk1-lgtm/agent-undo) · [vibe-to-prod](https://github.com/keenfolk1-lgtm/vibe-to-prod)