
Flakiness Knowledge Graph Mcp
io.github.vola-trebla由 GitHub 账号 vola-trebla 发布v0.2.2更新于 Oct 24, 2026
MCP server + Playwright reporter that builds a flakiness knowledge graph from test run history
概览
本地 MCP 服务器兼 Playwright 报告器,把测试运行历史存入 SQLite,让助手查询不稳定测试、失败模式与趋势。
- 可以做什么
- 按不稳定率和平均耗时对测试排序,可按运行次数或最近天数筛选(get_flaky_tests、get_slow_tests)。获取单个测试的完整运行历史,含状态、耗时、错误、重试、浏览器与操作系统(get_test_history)。按浏览器与操作系统组合拆分失败率(get_failure_patterns)。按原始错误前缀聚类失败,或先归一化动态值再做模糊合并(get_error_groups、cluster_semantic_error_trees)。查看某测试逐日不稳定率变化,并找出由稳定转为不稳定的提交及其分支与作者(get_flakiness_trend、correlate_git_commit_flakiness)。
- 适用场景
- 适用于 Playwright 测试套件已积累足够运行历史,希望助手指出哪些测试不可靠、在哪个浏览器或操作系统上失败、是否在恶化,以及哪个提交引入了不稳定。
- 运行要求
- 以本地 stdio 进程运行,从 npm 安装 flakiness-knowledge-graph-mcp,需要 Node.js。必须存在 SQLite 数据库文件:通过在 playwright.config.ts 中加入自带的 Playwright 报告器生成,或用种子脚本生成演示数据。每次工具调用需传入数据库路径。未声明认证、API 密钥或环境变量。
安装
在 SourceWeft 中
- 打开 控制台中的 Flakiness Knowledge Graph Mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
📊 flakiness-knowledge-graph-mcp
[npm version] [npm downloads] [CI] [License: MIT]
A Playwright custom reporter + MCP server that builds a local flakiness knowledge graph from your test run history. Ask your AI agent which tests are unreliable, on which browser, and whether they're getting worse.
🤔 The Problem
A single Playwright trace tells you what failed right now. It doesn't tell you whether this test has been silently flaking for two weeks, or only fails on Firefox in CI, or is getting slower with every release.
This tool fixes that by accumulating run history into a SQLite database and exposing it to AI agents via MCP.
🛠️ Tools
🚀 Setup
1. Install
Or build from source:
2. Add the reporter to your Playwright project
Run your tests normally — the reporter writes every result to flakiness.db automatically.
3. Add the MCP server to your editor
Cursor / VS Code (.cursor/mcp.json or .vscode/mcp.json)
Claude Code
4. Try it with demo data
No Playwright project yet? Generate 30 days of realistic sample data:
Then point your AI agent at ./demo.db to explore all 8 tools.
💬 Example usage
Grouping errors that look different but aren't
get_error_groups clusters by raw string prefix — if the error contains a UUID or element ID it creates separate groups for what is really one root cause. cluster_semantic_error_trees strips dynamic values first:
Finding the commit that broke a test
correlate_git_commit_flakiness uses a state machine — it looks for runs where a test was stable for ≥3 consecutive passes, then failed. The transition record includes the SHA from the CI environment:
The reporter reads GITHUB_SHA / CI_COMMIT_SHA / CIRCLE_SHA1 / GIT_COMMIT automatically — no reporter config changes needed beyond upgrading to v0.2.0.
🔗 Works great with playwright-trace-decoder-mcp
These two MCP servers are designed to complement each other:
- flakiness-knowledge-graph-mcp answers "is this test flaky historically, and which commit caused it?"
- playwright-trace-decoder-mcp answers "what exactly failed in this specific run?"
Combined, an AI agent can diagnose whether a CI failure is a known flaky test or a new regression — without you opening a single file.
⚖️ Parallel Execution & CI Sharding
flakiness-knowledge-graph-mcp uses an in-process write queue to ensure that parallel Playwright workers within a single Node process do not corrupt the database.
However, if you run tests across multiple independent processes (e.g., parallel CI shards or separate machine runners) writing to the same shared network file:
- Race Conditions: Standard file systems do not guarantee atomic writes for SQLite files across processes without OS-level locking.
- Recommended Approach: Each CI shard should write to its own database file (e.g.,
flakiness-shard-1.db,flakiness-shard-2.db). - Merging: At the end of the CI pipeline, you can merge these files into a single master database using standard SQLite tools or by running a script that reads from one and inserts into the other.
For local development or single-machine CI runs, the default configuration is safe.
🏗️ Architecture
sql.js is used instead of better-sqlite3 — pure JavaScript SQLite compiled to WebAssembly, no native compilation needed. The git columns are added via ALTER TABLE migration on first use — existing databases upgrade automatically.
📋 Scripts
📄 License
MIT
来源:README.md,提交 096ace2
工具
0版本历史
1- v0.2.2最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分