
Playwright Network Chaos Mcp
io.github.vola-trebla由 GitHub 帳號 vola-trebla 發布v0.2.1更新於 Oct 24, 2026
MCP server that gives AI agents dynamic network chaos control over Playwright browser sessions
概覽
讓 AI 助理在 Playwright 瀏覽器工作階段中注入網路故障、延遲與資源封鎖,並檢查頁面是否能妥善處理。
- 可以做什麼
- 執行 Playwright 瀏覽器工作階段,攔截符合條件的請求以強制回傳錯誤狀態碼、加入帶抖動的延遲、中止第三方資源、在請求途中斷線,或回傳作業系統層級的網路錯誤。也支援有狀態失敗(前 N 次請求失敗後恢復成功),以及協定層級的回應損毀,例如格式錯誤的 JSON。每個工具都會回報攔截請求數量、是否出現備援或載入選擇器,以及收集到的頁面與主控台錯誤;assert_chaos_handled 會回傳通過或失敗的判定。
- 適用情境
- 適合撰寫或驗證 Playwright 測試中的錯誤處理、重試邏輯、載入狀態與第三方服務中斷的容錯能力。當助理需要重現不穩定的網路條件,並斷言頁面顯示備援介面而不是崩潰時,值得加入。
- 執行需求
- 需要本機 Node.js 執行環境;此 npm 套件透過 npx 啟動或全域安裝。需為 Playwright 安裝 Chromium(npx playwright install chromium)。未宣告需要帳號、API 金鑰或環境變數。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Playwright Network Chaos Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
playwright-network-chaos-mcp 🐸💥
[npm version] [npm downloads] [CI] [License: MIT]
An MCP server that gives AI agents dynamic network chaos control over Playwright browser sessions.
Your tests run on perfect networks. Your users don't. This MCP lets AI agents simulate API outages, inject latency, drop connections mid-flight, and block third-party resources — then assert whether the app handles it gracefully.
🤔 The Problem
CI environments have flawless connectivity. APIs respond in milliseconds. CDNs never go down. So your tests pass — and then production breaks when the payment service returns a 503, the network drops mid-checkout, or Google Analytics hangs for 8 seconds and freezes the page.
AI agents writing Playwright tests have no way to introduce or reason about network instability. They can't ask:
- 🙈 Does the checkout page show an error state when the payment API fails?
- 🙈 Does the skeleton loader appear while the dashboard API is slow?
- 🙈 Does the app still work if all tracking scripts are blocked?
- 🙈 What happens if the network drops after the order is submitted but before the response arrives?
playwright-network-chaos-mcp fixes that.
🛠️ Tools
simulate_api_failure
Intercepts requests matching a pattern and forces them to return an error status code. Checks if the app shows a fallback UI.
inject_latency
Adds artificial delay to matching requests. Checks if loading states appear while the app waits.
block_resources
Aborts requests to specified URL patterns — for testing third-party outages (analytics, CDNs, tracking pixels).
simulate_network_drop
Aborts requests mid-flight after a delay — simulating connection loss between request and response.
trigger_system_network_error
Aborts requests with an OS-level error code — simulating DNS failures, firewall blocks, and connection resets.
simulate_stateful_failure
Fails the first N requests then lets subsequent ones succeed — testing retry logic and recovery flows.
inject_response_corruption
Serves malformed responses at the protocol level — unterminated JSON, content-length lies, or truncated payloads.
assert_chaos_handled
Injects a chaos HTTP status and returns a structured pass/fail verdict — chaos_survived is true only when the fallback UI appears and there are no unhandled JS exceptions.
🚀 Installation
Or install globally:
Claude Desktop config
💡 Example Agent Prompts
"Check if the checkout page shows a proper error state when the payment API returns 503"
"Simulate a 3 second API delay on the dashboard and verify the skeleton loader appears"
"Block all analytics and tracking scripts and confirm the main content still loads"
"Drop the order submission request mid-flight and check if the user sees an error message"
"Simulate DNS failure for the API and check if the error boundary renders"
"Fail the first 3 requests then succeed — does the app retry and recover automatically?"
"Inject malformed JSON and assert the app doesn't crash — return a chaos verdict"
🔗 Related Projects
- playwright-trace-decoder-mcp — root-cause analysis of CI failures from Playwright traces
- flakiness-knowledge-graph-mcp — knowledge graph of flaky test patterns
- ast-impact-mapper-mcp — find affected tests from code changes via TypeScript AST
- zod-contract-mock-forge-mcp — deterministic mock generation from Zod schemas
- playwright-spatial-layout-mcp — geometric spatial awareness of web layouts
📄 License
MIT © vola-trebla
來源:README.md,提交 dc79862
工具
0版本歷史
1- v0.2.1最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分