
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 分