triage-desk-mcp
Provides policy-grounded triage of Trust & Safety reports via MCP, with tools for triage, policy search, and operational telemetry.
README
Triage Desk
An internal Trust & Safety / CX triage tool for a live-shopping marketplace. A report comes in; the system retrieves the governing policy, classifies the report against it, and decides whether the recommended action is safe to take without a human.
Built as a work sample for Whatnot's AI Engineer role. It is small on purpose — the interesting part is not the classifier, it's everything wrapped around the classifier that makes an off-the-shelf model dependable enough to sit in front of an ops queue.
report ──▶ retrieve (BM25 over policy corpus)
│
▼
classify (Claude, structured output + prompt caching)
│
▼
guardrails ──▶ verdict + cited policy + auto-actionable?
│
▼
telemetry (latency / tokens / cost / guardrail rate)
Run it
bun install
bun start # http://localhost:3020
bun test # 20 unit tests
bun evals/run.ts # eval + regression gate
bun mcp/server.ts # same pipeline over MCP (stdio)
Runs with no API key by default: TRIAGE_MODE=mock uses a deterministic
keyword baseline that produces the identical schema. Set TRIAGE_MODE=live
(plus ANTHROPIC_API_KEY, or an ant auth login profile) to route
classification through Claude.
The mock arm is not a stub — it's the control. It keeps CI free and flake-free, and it's the baseline the model has to beat before "use an LLM here" is a justified decision.
What's actually in here
Retrieval (src/retrieval.ts) — BM25 over the policy corpus, written
directly so there's no index to stand up. Swap it for pgvector or embeddings
and nothing above it changes.
Classification (src/llm.ts) — Claude with a JSON Schema via
output_config.format, so the response is guaranteed to parse; no
regex-extraction or retry-on-parse loop. The system prompt is a stable prefix
carrying cache_control, so repeat traffic reads the cache instead of
re-billing the instructions.
Guardrails (src/triage.ts) — the model proposes; these rules decide what
may happen without a human:
| Rule | Fires when |
|---|---|
safety_screen:* |
Deterministic patterns for minor safety, threats, account compromise, self-harm — checked on the raw report, before the classifier's opinion |
no_policy_retrieved |
Retrieval came back empty |
no_policy_cited |
The model cited no policy — an ungrounded verdict is not actionable |
category_requires_human |
Payment fraud, harassment |
critical_severity |
Any critical-severity verdict |
low_confidence_high_impact |
Confidence below the floor on a suspend/remove/end-stream action |
Evals (evals/) — 14 labeled reports, graded on three axes: category
accuracy, retrieval recall@3, and escalation recall. Escalation is gated at
1.00 and cannot be tuned down: a run that classifies well but lets one
minor-safety report auto-resolve is a failing run. Category accuracy is graded
against the arm being run, because holding a keyword baseline to the model's
bar isn't a meaningful test.
Telemetry (src/telemetry.ts) — p50/p95 latency, token counts (including
cache reads), cost at list price, guardrail firing rate, and the
category/action distribution. Exposed at /api/ops and as an MCP tool.
MCP server (mcp/server.ts) — triage_report, search_policy, and
triage_ops. Any MCP client gets policy-grounded triage without
reimplementing retrieval, prompting, or the guardrails. This is the reusable
half: the web UI and an agent call the same pipeline.
Three bugs found while building this
The first two surfaced on the first eval run, before any of this had been near a real report. The third never showed up in a metric at all — every number was green — and was only visible in the rendered output. They're written up rather than quietly fixed because they're the argument for having the harness at all.
1. A retrieval miss from missing stemming. A report about "vape pens"
never matched the policy line about "vaping products" — different tokens, zero
BM25 overlap, governing policy silently absent from the context. Fixed with
conservative suffix stripping (src/retrieval.ts), covered by a test.
2. Escalation depended on the classifier being right. A report about a
15-year-old streamer was classified no_violation, so no category guardrail
fired and it would have auto-resolved. Category-based rules can't be the only
path to a human when the classifier is the thing that failed. Fixed with the
deterministic safety screen, which runs on the raw report and overrides the
verdict regardless of category or confidence.
The second one is the reason escalation recall is a separate graded axis instead of being folded into accuracy.
3. Citations that the verdict never relied on. Visible only in the UI, not
in any metric: the classifier was citing the top-2 retrieved policies rather
than the ones matching its own verdict, so a report about Zelle payments came
back tagged off_platform_transaction while citing the harassment policy.
Every number in the eval was green. Fixed by citing only retrieved policies
whose category matches the verdict.
That one is worth its own note: an ungrounded citation is the failure the
no_policy_cited guardrail exists to catch, and the system was manufacturing
it internally. Rendering the intermediate state — what was retrieved, in what
order, versus what was cited — is what surfaced it. The RETRIEVED line in the
UI still shows the harassment policy out-ranking the correct one on that query,
which is honest: BM25 precision on a 10-document corpus is mediocre, recall@3
is what the pipeline actually depends on, and that's the metric the eval grades.
Notes on what I did not do
- No fine-tuning or model training — off-the-shelf model, engineering around it.
- No vector DB. At 10 policies BM25 wins on latency and operability; the interface is the part worth getting right.
- The policy corpus is written for this prototype. It's realistic in shape (indicator lists, severity tiers, escalation carve-outs) but it isn't anyone's real policy.
Neal Rodriguez · notifyneal@gmail.com · port.ragflo.com
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。