playwright-network-chaos-mcp
Allows blocking Google Analytics requests to test app resilience when analytics scripts are unavailable.
Allows blocking Hotjar requests to test app resilience when tracking scripts are unavailable.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@playwright-network-chaos-mcp Simulate payment API failure and check error toast"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
playwright-network-chaos-mcp πΈπ₯
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.
Related MCP server: MCP Playwright Server
π οΈ 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.
{
"url": "https://your-app.com/checkout",
"intercept_pattern": "**/api/payment**",
"status_code": 503,
"fallback_selector": ".error-boundary",
"wait_ms": 2000
}{
"intercepted_count": 2,
"fallback_found": true,
"fallback_selector": ".error-boundary",
"page_state": {
"page_errors": [],
"console_errors": ["Failed to load resource: 503"]
}
}inject_latency
Adds artificial delay to matching requests. Checks if loading states appear while the app waits.
{
"url": "https://your-app.com/dashboard",
"intercept_pattern": "**/api/**",
"latency_ms": 3000,
"jitter_ms": 500,
"loading_selector": ".skeleton-loader"
}{
"intercepted_count": 4,
"intercepted_requests": [
{ "url": "https://api.your-app.com/users", "method": "GET", "delay_ms": 3241 }
],
"loading_state_found": true,
"load_time_ms": 3890
}block_resources
Aborts requests to specified URL patterns β for testing third-party outages (analytics, CDNs, tracking pixels).
{
"url": "https://your-app.com",
"block_patterns": ["**/analytics**", "*.doubleclick.net/**", "**/hotjar**"],
"core_content_selector": ".main-content",
"wait_ms": 2000
}{
"blocked_count": 7,
"blocked_urls": ["https://www.google-analytics.com/analytics.js", "..."],
"core_content_found": true,
"page_state": { "page_errors": [], "console_errors": [] }
}simulate_network_drop
Aborts requests mid-flight after a delay β simulating connection loss between request and response.
{
"url": "https://your-app.com/checkout",
"intercept_pattern": "**/api/order**",
"drop_after_ms": 800,
"fallback_selector": ".network-error-toast",
"wait_ms": 3000
}{
"intercepted_count": 1,
"fallback_found": true,
"fallback_selector": ".network-error-toast",
"page_state": { "page_errors": ["TypeError: Failed to fetch"] }
}trigger_system_network_error
Aborts requests with an OS-level error code β simulating DNS failures, firewall blocks, and connection resets.
{
"url": "https://your-app.com/dashboard",
"intercept_pattern": "**/api/**",
"error_code": "addressunreachable",
"fallback_selector": ".network-error"
}{
"error_code": "addressunreachable",
"intercepted_count": 3,
"fallback_found": true,
"page_state": { "page_errors": [], "console_errors": ["net::ERR_ADDRESS_UNREACHABLE"] }
}simulate_stateful_failure
Fails the first N requests then lets subsequent ones succeed β testing retry logic and recovery flows.
{
"url": "https://your-app.com/dashboard",
"intercept_pattern": "**/api/data**",
"http_status": 503,
"failure_count": 2,
"success_payload": "{\"data\":[]}",
"fallback_selector": ".retry-button"
}{
"failure_count": 2,
"actual_failed": 2,
"actual_succeeded": 1,
"intercepted_requests": [
{ "url": "...", "method": "GET", "status": 503, "attempt": 1, "outcome": "failed" },
{ "url": "...", "method": "GET", "status": 200, "attempt": 3, "outcome": "passed" }
],
"fallback_found": true
}inject_response_corruption
Serves malformed responses at the protocol level β unterminated JSON, content-length lies, or truncated payloads.
{
"url": "https://your-app.com/checkout",
"intercept_pattern": "**/api/order**",
"corruption_type": "malformed_json",
"fallback_selector": ".parse-error"
}{
"corruption_type": "malformed_json",
"intercepted_count": 1,
"fallback_found": false,
"page_state": { "page_errors": ["SyntaxError: Unexpected token u in JSON"] }
}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.
{
"url": "https://your-app.com/checkout",
"intercept_pattern": "**/api/**",
"http_status": 500,
"expected_fallback_selector": ".error-boundary"
}{
"http_status": 500,
"unhandled_exceptions": [],
"console_errors": ["Failed to load resource: 500"],
"fallback_ui_detected": true,
"chaos_survived": true
}π Installation
npx playwright-network-chaos-mcpOr install globally:
npm install -g playwright-network-chaos-mcp
npx playwright install chromiumClaude Desktop config
{
"mcpServers": {
"playwright-network-chaos-mcp": {
"command": "npx",
"args": ["-y", "playwright-network-chaos-mcp"]
}
}
}π‘ 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
Available Tools
8 toolsassert_chaos_handledA
Injects a chaos HTTP status into all matching requests, then returns a structured verdict: did the app show a fallback UI, were there unhandled JS exceptions, and did it survive? Use to answer: is the app chaos-resilient β does it show a recovery UI without throwing exceptions?
Inputs: url (required), intercept_pattern (required), wait_ms, viewport, +2 more.
block_resourcesA
Blocks requests to specified URL patterns β useful for simulating third-party outages (analytics, CDNs, tracking). Use to answer: does the app still load and function if Google Analytics or a CDN is down?
Inputs: url (required), block_patterns (required), wait_ms, viewport, +1 more.
inject_latencyA
Adds artificial delay to requests matching a URL pattern, simulating slow networks or overloaded APIs. Use to answer: does the app show loading states when the API takes 3 seconds? Does it time out gracefully?
Inputs: url (required), intercept_pattern (required), viewport, jitter_ms, +2 more.
inject_response_corruptionA
Intercepts requests matching a URL pattern and returns a malformed or corrupted response, simulating partial network failures at the protocol level. Use to answer: does the app handle malformed JSON, content-length lies, or truncated payloads without crashing?
Inputs: url (required), corruption_type (required), intercept_pattern (required), wait_ms, +3 more.
simulate_api_failureA
Intercepts API requests matching a URL pattern and makes them return an error status code. Navigates to the page and checks if a fallback UI element appears. Use to answer: does the app show a proper error state when the payment API returns 503?
Inputs: url (required), intercept_pattern (required), wait_ms, viewport, +3 more.
simulate_network_dropA
Aborts requests matching a pattern after a delay, simulating a mid-flight connection drop. Use to answer: what happens if the network drops after the order request is sent but before the response arrives?
Inputs: url (required), intercept_pattern (required), wait_ms, viewport, +2 more.
simulate_stateful_failureA
Intercepts requests matching a URL pattern and fails the first N requests with an error status, then lets subsequent requests succeed. Simulates transient failures and tests retry/recovery logic. Use to answer: does the app retry after a 503 and recover when the service comes back?
Inputs: url (required), intercept_pattern (required), wait_ms, viewport, +4 more.
trigger_system_network_errorA
Aborts requests matching a URL pattern with a system-level network error code, simulating OS-level failures like unreachable hosts or access denied. Use to answer: does the app recover when the DNS resolution fails or the OS rejects a connection?
Inputs: url (required), error_code (required), intercept_pattern (required), wait_ms, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 8 tools
Each tool targets a distinct failure mode: error status codes, latency, resource blocking, mid-flight drops, system-level errors, transient failures, response corruption, and a combined assertion tool. While some tools share mechanics (e.g., simulate_api_failure vs simulate_stateful_failure), the descriptions clearly differentiate the behavior and use case, leaving no ambiguity.
All tool names follow a consistent verb_noun pattern, using verbs like simulate, inject, block, trigger, and assert. The naming is predictable, readable, and uniform across the set, with no mixed conventions or vague verbs.
With 8 tools, the set is well-scoped for a network chaos testing server. Each tool covers a distinct failure scenario without redundancy or bloat, fitting comfortably within the ideal 3-15 range.
The tool set covers a comprehensive range of network failure modes: error responses, latency, resource blocking, network drops, system-level errors, transient failures, and corrupted responses. It also includes an assertion tool for validating chaos resilience. A minor gap is the lack of an explicit reset/cleanup tool, though chaos may be scoped per test and reset implicitly.
Maintenance
Related MCP Connectors
Browser-based QA for AI-built software. Test pages with real browsers via agents.
Playwright browser automation β navigate, click, fill forms, extract, screenshot β 17 agent tools.
IP intelligence, network diagnostics, and AI service availability tools for AI agents.
Synthetic checks, nightly regression replay and model-drift alerts for AI agents
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables web browser automation and inspection using structured data instead of screenshots, allowing AI agents to interact with web pages programmatically through the Playwright framework.ISC
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to control web browsers through Playwright automation, providing 50+ tools for navigation, interaction, testing, accessibility audits, and visual testing across Chromium, Firefox, and WebKit.-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to execute browser automation, perform QA tasks, and generate test code through natural language commands using Playwright.7MIT
- AlicenseNot gradedqualityDmaintenanceEnables browser automation for AI assistants via Playwright, supporting multiple browsers, sessions, and tools for web interaction and testing.MIT