不离开 Claude,端到端调试生产错误
何时使用: Sentry 告警触发;你现在需要根本原因。
前置条件
- Sentry auth token — 用户设置 → Auth Tokens → 创建,赋予 'project:read'、'event:read'、'org:read'
- Token 已写入环境变量 — 设置 SENTRY_AUTH_TOKEN 和 SENTRY_HOST(sentry.io 或自托管地址)
步骤
-
找到 issueUse sentry-mcp. Find the most-firing issue in project 'web' from the last 6 hours.✓ 已复制→ Issue ID + 触发次数 + 首次/最近出现时间
-
拉取完整上下文Get the latest event for that issue — stack trace, breadcrumbs, request data.✓ 已复制→ 含堆栈帧和用户操作轨迹的完整事件载荷
-
关联部署What release was running when this first appeared? List the commits in that release.✓ 已复制→ Release 标签 + 提交列表
-
提出修复方案Looking at the stack and the commits — which commit likely caused this? Draft a fix in the relevant file.✓ 已复制→ 具体的文件 + 行号;完整的修复补丁
结果: 从告警到候选修复方案只需几分钟,且有完整证据链。
注意事项
- Source map 缺失——堆栈帧无意义 — 验证发版流程中是否上传了 source map;否则混淆后的帧对 Claude 毫无价值