webhook-crash-lab-mcp
Coding agents write webhook handlers that work for one test event and break in production on retries, duplicates and forged signatures. This package gives them a loop: run webhook-crash-lab → read each failure with concrete suggestions and the lines to change → fix → re-run.
It ships three things:
| What | Where | |
|---|---|---|
| MCP server | webhook-crash-lab-mcp (stdio, official MCP TypeScript SDK) | src/ |
| Claude Code plugin | skill + MCP server config | .claude-plugin/, skills/, .mcp.json |
| Codex / any-agent skill | same skill in the open Agent Skills format, plus an AGENTS.md snippet | .agents/skills/, docs/AGENTS-snippet.md |
Tools
| Tool | Input | Returns |
|---|---|---|
run_crash_lab | configPath, cwd?, scenarios?, reportPath?, handlerPaths?, scan? | ok, counts, failures[] in fix order (failed checks, suggestions[], why, fix), notTested[], nextSteps[], scannedFiles[] |
run_demo | mode: "broken" | "fixed" | same shape, against the built-in demo app (no config needed) |
explain_report | reportPath or report (JSON from webhook-crash-lab run --json), provider?, handlerPaths? | same shape, e.g. for a CI report |
list_scenarios | none | every scenario with what / why / fix |
Every result comes back as text for the model and structuredContent (with an outputSchema) for clients.
Errors such as a missing or invalid config come back as isError results, not crashes.
Suggestions
Each failure carries suggestions[] built from what this run observed, not only the scenario's general hint:
| Run showed | kind | Suggestion |
|---|---|---|
| a correctly signed event rejected with 4xx | raw-body | verify over the raw body before any JSON parser, same secret as the config |
| sequential duplicates deduplicated, parallel copies all applied | check-then-insert | replace the read then write with one unique insert of event.id |
| every duplicate applied | no-dedupe | record event.id with a unique constraint in the business transaction |
| failed write answered 2xx | ack-after-failure | return 5xx so the provider retries |
| failed write answered 5xx but the retry was skipped | claim-before-write | save the event id in the same transaction as the write |
| forged or unsigned event accepted, or a stale one | signature-not-enforced, timestamp-not-checked | verify first, timingSafeEqual, timestamp tolerance |
| bad signature or bad JSON answered 500 | verify-throws, json-parse-throws | catch and answer 400 |
| an older event overwrote newer state | stale-event-applied | track the last applied created or version per object |
run_crash_lab also searches the project (or handlerPaths) for files that look like webhook handlers and attaches the lines that probably need the change, for example app.use(express.json()) for raw-body or a findUnique before a create for check-then-insert. This is pattern matching, not program analysis: treat the locations as places to look first. scannedFiles lists what was searched, and scan: false turns it off. Examples follow the config's provider (Stripe, GitHub, Razorpay or Standard Webhooks).
Compared with
| webhook-crash-lab-mcp | webhook-crash-lab CLI | webhook-chaos | Stripe CLI (stripe trigger) | eslint-plugin-webhook-safety | |
|---|---|---|---|---|---|
| Called by a coding agent as a tool | ✅ MCP | through the shell | through the shell | through the shell | through ESLint |
| Duplicate, parallel and late deliveries | ✅ | ✅ | ✅ | ❌ one event per trigger | ❌ static only |
| Checks business state, not just status | ✅ | ✅ | see its docs | ❌ | ❌ |
| Suggestions tied to this run's results | ✅ with likely code locations | general fix hint per scenario | see its docs | ❌ | ✅ per lint finding |
| Real provider events | ❌ synthetic signed events | ❌ synthetic signed events | recorded Shopify and Stripe events | ✅ real test mode events | n/a |
Use the Stripe CLI to see a real event once, and this to make sure the handler survives the second, third and parallel copy.
60-second start
Claude Code
claude mcp add webhook-crash-lab -- npx -y webhook-crash-lab-mcp@0.3.0
# or the full plugin (MCP server + skill):
# /plugin marketplace add Krrishkumar125/webhook-crash-lab-mcp
# /plugin install webhook-crash-lab@webhook-crash-lab
Codex
codex mcp add webhook-crash-lab -- npx -y webhook-crash-lab-mcp@0.3.0
mkdir -p .agents/skills && cp -r node_modules/webhook-crash-lab-mcp/.agents/skills/webhook-crash-lab .agents/skills/
Cursor / other MCP clients
{
"mcpServers": {
"webhook-crash-lab": { "command": "npx", "args": ["-y", "webhook-crash-lab-mcp@0.3.0"] }
}
}
The examples pin the version so npx never silently runs a newer release. To update, check the latest with npm view webhook-crash-lab-mcp version, read the releases, then change @0.3.0 to the new version in your MCP config and restart the client.
Then ask: "Run the webhook crash lab demo", or "Make my Stripe webhook pass webhook-crash-lab".
Paste docs/AGENTS-snippet.md into AGENTS.md / CLAUDE.md to make it a standing rule.
Safety
The code scan only reads source files inside cwd (skipping node_modules, build output and dot folders) and never changes them.
run_crash_lab imports your crash-lab config (.mjs/.js/.cjs, or .ts/.mts/.cts via the bundled jiti) (it is code, like any config file) and sends requests to
its target. Point configs at a local server and a test database and secret only. The skill tells
agents never to use production URLs or live secrets.
Related
- webhook-crash-lab: the CLI/library this wraps
- eslint-plugin-webhook-safety and eslint-plugin-bullmq: the same bugs, caught statically
Sibling packages
Other tools by the same author:
- secret-blast-radius: what a malicious npm install could steal, plus a rotation plan
- zod-india: Zod schemas for GSTIN, PAN, IFSC, UPI and Aadhaar
- create-bullmq-app: scaffold a production BullMQ + TypeScript service
- webhook-crash-lab: crash-test webhook handlers against duplicates and races
- eslint-plugin-bullmq: lint rules for BullMQ production pitfalls
- eslint-plugin-webhook-safety: lint rules for unsafe Stripe webhook handlers
License
MIT © Krrish Kumar