Token导航 LogoToken导航TokenDH.com
MCP Server Wtf logo
数据服务未说明官方级别未说明来源级核验

MCP Server Wtf

MCP Server

WTF是一个用于Claude Code内部的故障记录分析工具,通过捕获工具调用和手动观察记录到SQLite数据库,并通过后台分类器生成提炼的时间线。

工具数

4

提示词数

0

GitHub Stars

0

资源数

0
TypeScriptClaude数据分析Claude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

Wave-Engineering

提供方

Wave-Engineering

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

WTF(为什么失败)

克劳德代码中用于事故排除的飞行记录器。WTF捕获 将每次工具调用和手动观察都保存到一个持久的SQLite数据库中 在上下文压缩中幸存下来,然后通过背景丰富原始条目 分类器被提取到一个精炼的时间轴中。

先决条件

  • 克劳德代码 CLI(claude)
  • jq (JSON处理器)
  • curlwget
  • Bedrock的AWS证书(可选——启用背景分类器)

安装

curl -fsSL https://raw.githubusercontent.com/Wave-Engineering/mcp-server-wtf/main/scripts/install-remote.sh | bash

这将为您的平台下载预编译的二进制文件,并安装 PostTool使用钩子,并注册MCP服务器。无需克隆或运行时。 技能(/wtf, /wtf now, /wtf happened, /wtf imout)由以下人员交付 claudecode工作流.

验证安装:

curl -fsSL https://raw.githubusercontent.com/Wave-Engineering/mcp-server-wtf/main/scripts/install-remote.sh | bash -s -- --check

安装特定版本:

curl -fsSL https://raw.githubusercontent.com/Wave-Engineering/mcp-server-wtf/main/scripts/install-remote.sh | bash -s -- --version v1.0.0

开发安装

如果你在WTF服务器上工作,克隆仓库并使用本地 安装程序(需要 包子):

git clone https://github.com/Wave-Engineering/mcp-server-wtf.git
cd mcp-server-wtf
./scripts/install.sh

快速开始

# Start troubleshooting
/wtf

# Investigate the issue... Claude records tool calls automatically

# Get the distilled timeline
wtf_happened

# Add your own observations
/wtf now "DNS resolver returning stale records"

架构概述

WTF是一个三层系统:

  /wtf, /wtf now          Skills (user-facing entry points)
        |
        v
  wtf_now, wtf_happened   MCP Server (journal storage, retrieval,
  wtf_freshell             background classification)
        ^
        |
  PostToolUse hook         Auto-capture (every tool call -> JSONL queue)

第1层——技能: /wtf 启动故障排除会话并激活 飞行记录器模式。 /wtf now 添加手动日记账条目。

第2层——MCP服务器: Bun+TypeScript服务器公开了四种工具 stdio传输。管理SQLite数据库,接收钩子队列,并运行 背景分类器(Claude Haiku通过AWS Bedrock)将条目分类为 行动、面包屑、理论或噪音。

第3层——PostToolUse钩子: 一个在每个Claude代码上启动的shell脚本 工具调用,提取相关字段,截断大值,并附加JSON 排队 .wtf/hook-queue.jsonl 用于摄入。

用法

开始会话

/wtf

将之前的事件存档,并创建一个新的事件。提示选择 标题,然后将克劳德置于飞行记录器模式,在该模式下进行重要观测 自动记录。

记录观察结果

/wtf now the health endpoint is returning 503s
/wtf now "theory: connection pool exhaustion under load"
/wtf now checked nginx logs — 502s started at 14:32

在日记账中添加手动条目。分类由后台处理 分类器。

获取时间线

打电话给 wtf_happened MCP工具(Claude可以直接调用它,或者你可以问 对于它):

wtf_happened                  # summary (max 50 lines)
wtf_happened { detail: "full" }  # all entries

返回一个经过提炼的Markdown时间线:

## WTF Summary -- DNS Resolution Failure
**Duration:** 45 min | **Entries:** 127 raw, 34 distilled | **Status:** active

1. [12:03] BREADCRUMB -- Health endpoint returning 503s intermittently
2. [12:05] THEORY -- Connection pool exhaustion, idle timeout set to 0
3. [12:08] ACTION -- Set DB_POOL_IDLE_TIMEOUT=30s in .env

暂停录制

/wtf imout

暂停飞行记录器而不丢失数据。切换到时有用 非故障排除工作。钩子仍然会发出声音,但条目会被过滤。

生成Runbook

wtf_happened 还将runbook骨架写入 .wtf/runbook.md 这可能是 提炼成可重复使用的剧本。

清理/重新开始

wtf_freshell

将当前事件存档并开始新的事件。以前的条目是 保存在数据库中。

配置

数据目录

所有运行时数据都存在于 .wtf/ 相对于项目根(gitignored):

.wtf/
  wtf.db              SQLite database (WAL mode)
  hook-queue.jsonl    Hook queue (consumed by MCP server)
  runbook.md          Generated runbook skeleton

可调值

参数默认值位置
队列轮询间隔2000毫秒queue.ts
分类器轮询间隔5000毫秒classifier/worker.ts
分类器速率限制2000msclassifier/worker.ts
钩子截断限制4096字节scripts/hooks/wtf-post-tool-use.sh
汇总行上限50行tools/happened.ts

MCP服务器注册

远程安装程序注册已编译的二进制文件:

claude mcp add --scope user --transport stdio wtf-server -- ~/.local/bin/wtf-server

开发安装程序直接注册Bun源代码:

claude mcp add --scope user --transport stdio wtf-server -- bun /path/to/mcp-server-wtf/index.ts

吊钩配置

PostToolUse钩子在中配置 ~/.claude/settings.json:

{
  "hooks": {
    "PostToolUse": [
      {
        "type": "command",
        "command": "/absolute/path/to/scripts/hooks/wtf-post-tool-use.sh"
      }
    ]
  }
}

卸载

如果通过远程安装程序安装:

curl -fsSL https://raw.githubusercontent.com/Wave-Engineering/mcp-server-wtf/main/scripts/install-remote.sh | bash -s -- --uninstall

如果从本地克隆安装:

./scripts/install.sh --uninstall

两者都删除了MCP服务器注册和挂钩配置。这 每个项目 .wtf/ 数据目录被保留(它们包含事件 历史)。要删除它们,请执行以下操作:

rm -rf .wtf/

许可证

麻省理工学院——见 许可证.

目录标签

目录标签

TypeScriptClaude数据分析故障记录本地部署SQLite数据库时间线分析ClaudeCode

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

4

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP