
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 分