Casebook MCP
Enables agents to query a registry of documented AI-agent failures for debugging incidents, deployable on Cloudflare Workers.
README
Casebook MCP
A remote MCP server that turns AgentPostmortem, a public registry of documented AI-agent failures, into tools any agent can query. Deployable on Cloudflare Workers. Ships with a companion investigator agent built on the Claude Agent SDK that drafts postmortems grounded in real precedents.
Why: every team debugging an agent incident is rediscovering failure modes that are already documented. Casebook makes the registry agent-queryable, so Claude, Cursor, or any MCP client can ask "has anything like this happened before?" mid-investigation.
Tools
| Tool | Purpose |
|---|---|
search_cases(query, tag?) |
Ranked full-text search over case files, optional tag filter |
get_case(id) |
Full case detail: outcome, verified facts, unknowns, lessons |
similar_failures(description) |
Keyword-similarity match of an incident against the corpus |
list_tags() |
All failure-mode tags with descriptions |
Architecture
MCP client (Claude Code, Cursor, agent SDK)
| streamable HTTP (JSON-RPC 2.0, stateless)
v
Cloudflare Worker src/index.ts (routing, per-IP rate limit)
| src/mcp.ts (MCP protocol: initialize, tools/list, tools/call)
| src/search.ts (pure ranking and similarity logic, unit tested)
v
src/data.ts: live agentpostmortem.com public API (/api/export, /api/search,
/api/tags) with a 5 minute in-memory cache, falling back to the bundled
dataset in data/ when offline.
The MCP transport is implemented directly against the 2025-03-26 streamable HTTP spec in stateless mode: a single POST /mcp endpoint handling initialize, tools/list, and tools/call. No sessions, no Durable Objects, no auth (the data is public and read-only). A light in-memory rate limit (60 requests per minute per IP) keeps it polite.
Quickstart
npm install
npm test # vitest: search ranking, tag filter, CSV parsing
npm run typecheck # tsc --noEmit
npm run dev # wrangler dev on http://localhost:8787
Smoke test the endpoint:
curl -s http://localhost:8787/mcp -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Add it to Claude Code:
claude mcp add --transport http casebook http://localhost:8787/mcp
Investigator agent
agent/investigate.ts uses the Claude Agent SDK query() API. Given an incident description, it connects to the MCP server, finds similar documented failures, pulls the top cases, and writes postmortem-draft.md. It runs on your local Claude Code subscription auth; no API key appears in the code.
# full investigation (uses the model)
npm run investigate -- "our support bot approved hundreds of fake refunds overnight"
# keyless mode for CI: stubs the model, still exercises the MCP server
npm run investigate -- --dry-run "runaway retry loop spammed customers"
Point it at a deployed server with CASEBOOK_MCP_URL=https://casebook-mcp.<account>.workers.dev/mcp.
Example transcript
$ npm run investigate -- --dry-run "our support bot was tricked by text in a ticket into approving hundreds of refunds"
Wrote postmortem-draft.md (1091 chars)
$ head postmortem-draft.md
# Postmortem Draft (dry run)
## Incident
our support bot was tricked by text in a ticket into approving hundreds of refunds
## Similar documented failures (source: live (cached))
### APM-0003: Cursor support AI hallucinates login policy, triggering mass subscription cancellations
In full mode the agent additionally calls get_case on the top precedents and produces a structured draft with suspected failure mode, contributing factors, and remediations grounded in the documented lessons.
Data
- Live: public read-only endpoints on agentpostmortem.com (
/api/exportfor the corpus,/api/searchfor rich case detail,/api/tags). - Bundled:
data/cases.jsonholds 12 representative case files (prompt-injection refund exploit, runaway retry loop, stale-cache hallucination, tool-permission escalation, and more) used as an offline fallback and as the deterministic fixture for tests.
Deploy
npx wrangler deploy
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。