MCP Server for Browser Dev Tools
npm install browser-devtools-mcp
Browser DevTools MCP
A powerful Model Context Protocol (MCP) server that provides AI coding assistants with comprehensive browser automation and debugging capabilities using Playwright. This server enables both execution-level debugging (logs, network requests) and visual debugging (screenshots, ARIA snapshots) to help AI assistants understand and interact with web pages effectively.
Browser DevTools MCP exposes a Playwright-powered browser runtime to AI agents, enabling deep, bidirectional debugging and interaction with live web pages. It supports both visual understanding and code-level inspection of browser state, making it ideal for AI-driven exploration, diagnosis, and automation.
- Visual Inspection: Screenshots, ARIA snapshots, HTML/text extraction, PDF generation
- Design Comparison: Compare live page UI against Figma designs with similarity scoring
- DOM & Code-Level Debugging: Element inspection, computed styles, accessibility data
- Browser Automation: Navigation, input, clicking, scrolling, viewport control
- Execution Monitoring: Console message capture, HTTP request/response tracking
- OpenTelemetry Integration: Automatic trace injection into web pages, UI trace collection, and backend trace correlation via trace context propagation
- JavaScript Execution: Execute code in browser page context or in Node.js VM sandbox on the server
- Session Management: Long-lived, session-based debugging with automatic cleanup
- Multiple Transport Modes: Supports both stdio and HTTP transports
Important Requirements for React Tools:
- Persistent Browser Context: React tools work best with persistent browser context enabled (BROWSER_PERSISTENT_ENABLE=true)
- React DevTools Extension: For optimal reliability, manually install the "React Developer Tools" Chrome extension in the browser profile. The MCP server does NOT automatically install the extension.
- Chrome Web Store: https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi
- The extension enables reliable root discovery and component search via __REACT_DEVTOOLS_GLOBAL_HOOK__
- Without the extension, tools fall back to scanning DOM for __reactFiber$ pointers (best-effort, less reliable)
Probe Types:
- Tracepoint: Captures call stack, local variables, and async stack traces at a code location
- Logpoint: Evaluates and logs expressions without full debug context (lightweight)
- Exceptionpoint: Captures snapshots when exceptions occur (uncaught or all)
- Dompoint: Monitors DOM mutations (subtree-modified, attribute-modified, node-removed)
- Netpoint: Monitors network requests/responses matching a URL pattern
Core Operations (per probe type):
- put-*: Create a probe at a location
- remove-*: Remove a specific probe
- list-*: List all probes of a type
- clear-*: Remove all probes of a type
- get-*-snapshots: Retrieve captured snapshots (supports fromSequence for polling)
- clear-*-snapshots: Clear captured snapshots
Additional Tools:
- Watch Expressions: Add expressions to evaluate at every tracepoint/exceptionpoint hit
- Status: Get current debugging status (enabled, probe counts, snapshot stats)
Key Features:
- Source map support for debugging bundled/minified code with original source locations
- Automatic debugging enablement on first tool use
- Configurable limits (max snapshots, call stack depth, async segments)
- Sequence numbers for efficient snapshot polling
- Node.js 18+
- An AI assistant (with MCP client) like Cursor, Claude (Desktop or Code), VS Code, Windsurf, etc.
This MCP server (using STDIO or Streamable HTTP transport) can be added to any MCP Client
like VS Code, Claude, Cursor, Windsurf, GitHub Copilot via the browser-devtools-mcp NPM package.
No manual installation required! The server can be run directly using npx, which automatically downloads and runs the package.
Browser DevTools MCP server supports the following CLI arguments for configuration:
- --transport - Configures the transport protocol (defaults to stdio).
- --port – Configures the port number to listen on when using streamable-http transport (defaults to 3000).
Install browser automation capabilities as a skill for AI coding agents (Claude Code, Cursor, Windsurf, etc.) using the skills.sh ecosystem:
``bash`
npx skills add serkan-ozal/browser-devtools-skills
This installs the CLI skill that enables AI agents to automate browsers for web testing, screenshots, form filling, accessibility audits, performance analysis, and more. See the Skills Repository for details.
#### Local Server
Add the following configuration into the claude_desktop_config.json file.
See the Claude Desktop MCP docs for more info.
`json`
{
"mcpServers": {
"browser-devtools": {
"command": "npx",
"args": ["-y", "browser-devtools-mcp"]
}
}
}
#### Remote Server (HTTP Transport)
First, start the server with HTTP transport:
`bash`
npx -y browser-devtools-mcp --transport=streamable-http --port=3000
Then, go to Settings > Connectors > Add Custom Connector in Claude Desktop and add the MCP server with:Browser DevTools
- Name: http://localhost:3000/mcp
- Remote MCP server URL: Point to where your server is hosted (e.g., if running locally, or https://your-server.com/mcp if hosted remotely)
Run the following command.
See Claude Code MCP docs for more info.
#### Local Server
`bash`
claude mcp add browser-devtools -- npx -y browser-devtools-mcp
#### Remote Server
First, start the server with HTTP transport:
`bash`
npx -y browser-devtools-mcp --transport=streamable-http --port=3000
Then add the MCP server:
`bash`
claude mcp add --transport http browser-devtools
Replace with your server URL (e.g., http://localhost:3000/mcp if running locally, or https://your-server.com/mcp if hosted remotely).
Add the following configuration into the ~/.cursor/mcp.json file (or .cursor/mcp.json in your project folder).
See the Cursor MCP docs for more info.
#### Local Server
`json`
{
"mcpServers": {
"browser-devtools": {
"command": "npx",
"args": ["-y", "browser-devtools-mcp"]
}
}
}
#### Remote Server
First, start the server with HTTP transport:
`bash`
npx -y browser-devtools-mcp --transport=streamable-http --port=3000
Then add the configuration:
`json`
{
"mcpServers": {
"browser-devtools": {
"url": "
}
}
}
Replace with your server URL (e.g., http://localhost:3000/mcp if running locally, or https://your-server.com/mcp if hosted remotely).
Add the following configuration into the .vscode/mcp.json file.
See the VS Code MCP docs for more info.
#### Local Server
`json`
{
"mcp": {
"servers": {
"browser-devtools": {
"type": "stdio",
"command": "npx",
"args": ["-y", "browser-devtools-mcp"]
}
}
}
}
#### Remote Server
First, start the server with HTTP transport:
`bash`
npx -y browser-devtools-mcp --transport=streamable-http --port=3000
Then add the configuration:
`json`
{
"mcp": {
"servers": {
"browser-devtools": {
"type": "http",
"url": "
}
}
}
}
Replace with your server URL (e.g., http://localhost:3000/mcp if running locally, or https://your-server.com/mcp if hosted remotely).
Add the following configuration into the ~/.codeium/windsurf/mcp_config.json file.
See the Windsurf MCP docs for more info.
#### Local Server
`json`
{
"mcpServers": {
"browser-devtools": {
"command": "npx",
"args": ["-y", "browser-devtools-mcp"]
}
}
}
#### Remote Server
First, start the server with HTTP transport:
`bash`
npx -y browser-devtools-mcp --transport=streamable-http --port=3000
Then add the configuration:
`json`
{
"mcpServers": {
"browser-devtools": {
"serverUrl": "
}
}
}
Replace with your server URL (e.g., http://localhost:3000/mcp if running locally, or https://your-server.com/mcp if hosted remotely).
Add the following configuration to the mcpServers section of your Copilot Coding Agent configuration through Repository > Settings > Copilot > Coding agent > MCP configuration.
See the Copilot Coding Agent MCP docs for more info.
#### Local Server
`json`
{
"mcpServers": {
"browser-devtools": {
"type": "local",
"command": "npx",
"args": ["-y", "browser-devtools-mcp"]
}
}
}
#### Remote Server
First, start the server with HTTP transport:
`bash`
npx -y browser-devtools-mcp --transport=streamable-http --port=3000
Then add the configuration:
`json`
{
"mcpServers": {
"browser-devtools": {
"type": "http",
"url": "
}
}
}
Replace with your server URL (e.g., http://localhost:3000/mcp if running locally, or https://your-server.com/mcp if hosted remotely).
Add the following configuration into the ~/.gemini/settings.json file.
See the Gemini CLI MCP docs for more info.
#### Local Server
`json`
{
"mcpServers": {
"browser-devtools": {
"command": "npx",
"args": ["-y", "browser-devtools-mcp"]
}
}
}
#### Remote Server
First, start the server with HTTP transport:
`bash`
npx -y browser-devtools-mcp --transport=streamable-http --port=3000
Then add the configuration:
`json`
{
"mcpServers": {
"browser-devtools": {
"httpUrl": "
}
}
}
Replace with your server URL (e.g., http://localhost:3000/mcp if running locally, or https://your-server.com/mcp if hosted remotely).
Run the following command.
You can find your Smithery API key here.
See the Smithery CLI docs for more info.
`bash`
npx -y @smithery/cli install serkan-ozal/browser-devtools-mcp --client
To use HTTP transport, start the server with:
`bash`
npx -y browser-devtools-mcp --transport=streamable-http --port=3000
The server exposes the following endpoints:
- GET /health - Health checkGET /ping
- - Ping endpointGET /mcp
- - MCP protocol infoPOST /mcp
- - MCP protocol messagesDELETE /mcp
- - Delete session
Important: When configuring remote MCP servers, use the actual URL where your server is hosted:
- If running locally: http://localhost:3000/mcp (or http://127.0.0.1:3000/mcp)https://your-server.com/mcp
- If hosted remotely: (replace with your actual server URL)
Test the server using the MCP Inspector:
`bashFor stdio transport
npx -y @modelcontextprotocol/inspector npx -y browser-devtools-mcp
CLI Tool
Browser DevTools MCP includes a standalone CLI tool (
browser-devtools-cli) for direct command-line access to browser automation capabilities. This is particularly useful for:- Scripting and automation: Use in shell scripts, CI/CD pipelines, or automated workflows
- Session-based testing: Maintain browser state across multiple commands with session IDs
- Skill-based workflows: Build reusable automation sequences
$3
The CLI is included with the npm package:
`bash
Run directly with npx
npx -y browser-devtools-mcp browser-devtools-cli --helpOr install globally
npm install -g browser-devtools-mcp
browser-devtools-cli --help
`$3
| Option | Description | Default |
|--------|-------------|---------|
|
--port | Daemon server port | 2020 |
| --session-id | Session ID for maintaining browser state across commands | (none) |
| --json | Output results as JSON | false |
| --quiet | Suppress log messages, only show output | false |
| --verbose | Enable verbose/debug output for troubleshooting | false |
| --timeout | Timeout for operations in milliseconds | 30000 |$3
| Option | Description | Default |
|--------|-------------|---------|
|
--headless / --no-headless | Run browser in headless (no visible window) or headful mode | true |
| --persistent / --no-persistent | Use persistent browser context (preserves cookies, localStorage) | false |
| --user-data-dir | Directory for persistent browser context user data | ./browser-devtools-mcp |
| --use-system-browser | Use system-installed Chrome instead of bundled browser | false |
| --browser-path | Custom browser executable path | (none) |Note: Browser options are applied when the daemon server starts. If the daemon is already running, stop it first (
daemon stop) then start with new options.$3
The CLI organizes tools into domain-based subcommands:
`
browser-devtools-cli
├── daemon # Manage the daemon server
│ ├── start # Start the daemon server
│ ├── stop # Stop the daemon server
│ ├── restart # Restart the daemon server (stop + start)
│ ├── status # Check daemon server status
│ └── info # Get detailed daemon info (version, uptime, sessions)
├── session # Manage browser sessions
│ ├── list # List all active sessions
│ ├── info # Get information about a session
│ └── delete # Delete a specific session
├── tools # Inspect available tools
│ ├── list # List all tools (with --domain filter)
│ ├── info # Get detailed tool info and parameters
│ └── search # Search tools by name or description
├── config # Show current configuration
├── completion # Generate shell completion scripts
│ ├── bash # Generate bash completion script
│ └── zsh # Generate zsh completion script
├── interactive (repl) # Start interactive REPL mode
├── update # Check for and install updates
├── navigation # Navigation commands
│ ├── go-to # Navigate to a URL
│ ├── go-back # Navigate backward
│ ├── go-forward # Navigate forward
│ └── reload # Reload the page
├── content # Content extraction commands
│ ├── take-screenshot # Take a screenshot
│ ├── get-as-html # Get HTML content
│ ├── get-as-text # Get text content
│ └── save-as-pdf # Save as PDF
├── interaction # Interaction commands
│ ├── click # Click an element
│ ├── fill # Fill a form field
│ ├── hover # Hover over an element
│ ├── press-key # Press a keyboard key
│ ├── select # Select from dropdown
│ ├── drag # Drag and drop
│ ├── scroll # Scroll the page
│ ├── resize-viewport # Resize viewport
│ └── resize-window # Resize browser window
├── a11y # Accessibility commands
│ └── take-aria-snapshot # Take ARIA snapshot
├── accessibility # Extended accessibility commands
│ └── take-ax-tree-snapshot # Take AX tree snapshot
├── o11y # Observability commands
│ ├── get-console-messages # Get console logs
│ ├── get-http-requests # Get HTTP requests
│ ├── get-web-vitals # Get Web Vitals metrics
│ ├── get-trace-id # Get current trace ID
│ ├── new-trace-id # Generate new trace ID
│ └── set-trace-id # Set trace ID
├── react # React debugging commands
│ ├── get-component-for-element
│ └── get-element-for-component
├── run # Script execution commands
│ ├── js-in-browser # Run JS in browser
│ └── js-in-sandbox # Run JS in sandbox
├── stub # HTTP stubbing commands
│ ├── mock-http-response # Mock HTTP responses
│ ├── intercept-http-request # Intercept requests
│ ├── list # List stubs
│ └── clear # Clear stubs
├── sync # Synchronization commands
│ └── wait-for-network-idle # Wait for network idle
├── debug # Non-blocking debugging commands
│ ├── put-tracepoint # Set a tracepoint (captures call stack)
│ ├── remove-tracepoint # Remove a tracepoint
│ ├── list-tracepoints # List all tracepoints
│ ├── clear-tracepoints # Clear all tracepoints
│ ├── put-logpoint # Set a logpoint (evaluates expression)
│ ├── remove-logpoint # Remove a logpoint
│ ├── list-logpoints # List all logpoints
│ ├── clear-logpoints # Clear all logpoints
│ ├── put-exceptionpoint # Enable exception catching
│ ├── put-dompoint # Set DOM mutation breakpoint
│ ├── remove-dompoint # Remove a DOM breakpoint
│ ├── list-dompoints # List all DOM breakpoints
│ ├── clear-dompoints # Clear all DOM breakpoints
│ ├── put-netpoint # Set network request breakpoint
│ ├── remove-netpoint # Remove a network breakpoint
│ ├── list-netpoints # List all network breakpoints
│ ├── clear-netpoints # Clear all network breakpoints
│ ├── add-watch # Add a watch expression
│ ├── remove-watch # Remove a watch expression
│ ├── list-watches # List all watch expressions
│ ├── clear-watches # Clear all watch expressions
│ ├── get-tracepoint-snapshots # Get tracepoint snapshots
│ ├── clear-tracepoint-snapshots # Clear tracepoint snapshots
│ ├── get-logpoint-snapshots # Get logpoint snapshots
│ ├── clear-logpoint-snapshots # Clear logpoint snapshots
│ ├── get-exceptionpoint-snapshots # Get exception snapshots
│ ├── clear-exceptionpoint-snapshots # Clear exception snapshots
│ ├── get-dompoint-snapshots # Get DOM mutation snapshots
│ ├── clear-dompoint-snapshots # Clear DOM snapshots
│ ├── get-netpoint-snapshots # Get network snapshots
│ ├── clear-netpoint-snapshots # Clear network snapshots
│ └── status # Get debugging status
└── figma # Figma integration commands
└── compare-page-with-design
`$3
#### Basic Navigation and Screenshot
`bash
Navigate to a URL
browser-devtools-cli navigation go-to --url "https://example.com"Take a screenshot
browser-devtools-cli content take-screenshot --name "homepage"
`#### Browser Options
Configure browser behavior when starting the daemon:
`bash
Run browser in headful mode (visible window)
browser-devtools-cli --no-headless navigation go-to --url "https://example.com"Use persistent browser context
browser-devtools-cli --persistent --user-data-dir ./my-profile navigation go-to --url "https://example.com"Use system Chrome instead of bundled Chromium
browser-devtools-cli --use-system-browser navigation go-to --url "https://example.com"Use a custom browser executable
browser-devtools-cli --browser-path /path/to/chrome navigation go-to --url "https://example.com"
`#### Session-Based Workflow
Maintain browser state across multiple commands using session IDs:
`bash
Start a session and navigate
browser-devtools-cli --session-id my-session navigation go-to --url "https://example.com"Interact with the page (same session)
browser-devtools-cli --session-id my-session interaction click --selector "button.login"Fill a form
browser-devtools-cli --session-id my-session interaction fill --selector "#username" --value "user@example.com"Take a screenshot
browser-devtools-cli --session-id my-session content take-screenshot --name "after-login"Clean up session when done
browser-devtools-cli session delete my-session
`#### JSON Output for Scripting
Use
--json and --quiet flags for machine-readable output:`bash
Get page content as JSON
browser-devtools-cli --json --quiet --session-id test navigation go-to --url "https://api.example.com"Output:
{
"url": "https://api.example.com/",
"status": 200,
"statusText": "",
"ok": true
}
`#### Daemon Management
`bash
Check daemon status
browser-devtools-cli daemon statusStart daemon manually
browser-devtools-cli daemon startStop daemon
browser-devtools-cli daemon stopRestart daemon (useful when changing browser options)
browser-devtools-cli daemon restartCheck status with JSON output
browser-devtools-cli daemon status --json
Output: {"status":"running","port":2020}
Get detailed daemon information
browser-devtools-cli daemon info
Output:
Daemon Server Information:
Version: 0.5.0
Port: 2020
Uptime: 5m 23s
Sessions: 2
`#### Session Management
`bash
List all active sessions
browser-devtools-cli session list
Output:
Active Sessions (2):
my-session
Created: 2025-01-26T10:00:00.000Z
Last Active: 2025-01-26T10:05:30.000Z
Idle: 30s
#default
Created: 2025-01-26T09:55:00.000Z
Last Active: 2025-01-26T10:04:00.000Z
Idle: 1m 30s
Get info about a specific session
browser-devtools-cli session info my-sessionDelete a session
browser-devtools-cli session delete my-session
`#### Tool Discovery
`bash
List all available tools
browser-devtools-cli tools list
Output:
Available Tools (35 total):
#
navigation:
go-to Navigate the browser to the given URL...
go-back Navigate back in browser history
...
Filter tools by domain
browser-devtools-cli tools list --domain interactionSearch for tools by keyword
browser-devtools-cli tools search click
Output:
Tools matching "click" (2 found):
#
interaction/click
Clicks an element on the page.
...
Get detailed info about a specific tool
browser-devtools-cli tools info navigation_go-to
Output:
Tool: navigation_go-to
Domain: navigation
#
Description:
Navigate the browser to the given URL...
#
Parameters:
--url (required)
The URL to navigate to
--wait-until (optional)
When to consider navigation succeeded
Default: "load"
#
Usage:
browser-devtools-cli navigation go-to [options]
`#### Configuration
`bash
Show current configuration
browser-devtools-cli config
Output:
Current Configuration:
#
Daemon:
Port: 2020
Session Idle (sec): 300
Idle Check Interval: 30
#
Browser:
Headless: true
Persistent: false
...
Show config as JSON
browser-devtools-cli config --json
`#### Verbose/Debug Mode
Enable verbose output for troubleshooting:
`bash
Run any command with --verbose for detailed debug logs
browser-devtools-cli --verbose navigation go-to --url "https://example.com"
Output:
[2025-01-26T10:00:00.000Z] [DEBUG] Verbose mode enabled
[2025-01-26T10:00:00.001Z] [DEBUG] CLI version: 0.5.0
[2025-01-26T10:00:00.001Z] [DEBUG] Node version: v20.10.0
[2025-01-26T10:00:00.001Z] [DEBUG] Platform: darwin
[2025-01-26T10:00:00.002Z] [DEBUG] Checking if daemon is running on port 2020
[2025-01-26T10:00:00.010Z] [DEBUG] Daemon health check result: running
[2025-01-26T10:00:00.011Z] [DEBUG] Calling tool: navigation_go-to
[2025-01-26T10:00:00.011Z] [DEBUG] Tool input: { url: "https://example.com" }
...
`#### Tool Search
Find tools by keyword:
`bash
Search for tools related to "screenshot"
browser-devtools-cli tools search screenshot
Output:
Tools matching "screenshot" (2 found):
#
content/take-screenshot
Takes a screenshot of the current page or a specific element.
#
figma/compare-page-with-design
Compares the CURRENT PAGE UI against a Figma design snapshot...
Search for tools related to "network"
browser-devtools-cli tools search network
`#### Shell Completions
Enable tab completion for faster command entry. Shell completions require a one-time setup:
For Bash:
`bash
Option 1: Add to ~/.bashrc (recommended)
echo 'eval "$(browser-devtools-cli completion bash)"' >> ~/.bashrc
source ~/.bashrcOption 2: Or add manually to ~/.bashrc
eval "$(browser-devtools-cli completion bash)"
`For Zsh (macOS default):
`bash
Option 1: Add to ~/.zshrc (recommended)
echo 'eval "$(browser-devtools-cli completion zsh)"' >> ~/.zshrc
source ~/.zshrcOption 2: Or add manually to ~/.zshrc
eval "$(browser-devtools-cli completion zsh)"
`Using with npx:
`bash
If using npx instead of global install:
echo 'eval "$(npx -y browser-devtools-cli completion zsh)"' >> ~/.zshrc
source ~/.zshrc
`After setup, press TAB for completions:
`bash
browser-devtools-cli dae # Completes to "daemon"
browser-devtools-cli daemon st # Shows "start", "stop", "status", "restart"
browser-devtools-cli -- # Shows all global options
`#### Interactive REPL Mode
Start an interactive session for continuous command entry:
`bash
Start in headless mode (default)
browser-devtools-cli interactiveStart with visible browser window
browser-devtools-cli --no-headless interactiveStart with persistent context (preserves cookies, localStorage)
browser-devtools-cli --no-headless --persistent interactiveAliases
browser-devtools-cli repl
browser-devtools-cli --no-headless repl
`Example session:
`
Browser DevTools CLI - Interactive Mode
Type "help" for available commands, "exit" to quitbrowser> navigation go-to --url "https://example.com"
url: https://example.com/
status: 200
ok: true
browser> content take-screenshot --name "homepage"
path: /path/to/homepage.png
browser> interaction click --ref "Login"
clicked: true
browser> interaction fill --ref "Email" --value "test@example.com"
filled: true
browser> tools search screenshot
Found 2 tools:
content_take-screenshot - Take a screenshot of the current page
content_take-pdf - Generate a PDF of the current page
browser> daemon info
Version: 0.5.0
Uptime: 5m 23s
Sessions: 1
Port: 2020
browser> session list
Active sessions: 1
#default (idle: 30s)
browser> config
Current Configuration:
port = 2020
headless = false
persistent = true
...
browser> exit
Goodbye!
`Available commands in interactive mode:
| Command | Description |
|---------|-------------|
|
help | Show available commands |
| exit, quit | Exit interactive mode |
| status | Show daemon status summary |
| config | Show current configuration |
| daemon | Daemon management (start, stop, restart, status, info) |
| session | Session management (list, info, delete) |
| tools | Tool discovery (list, search, info) |
| update | Check for CLI updates |
| | Execute a tool |#### Check for Updates
Keep your CLI up to date:
`bash
Check for updates without installing
browser-devtools-cli update --check
Output:
Checking for updates...
#
Current version: 0.5.0
Latest version: 0.5.1
#
⚠ Update available: 0.5.0 → 0.5.1
#
To update, run:
npm install -g browser-devtools-mcp@latest
Check and install updates interactively
browser-devtools-cli update
Output:
...
Do you want to update now? (y/N) y
Updating...
✓ Update complete!
`#### Shell Script Example
`bash
#!/bin/bash
SESSION="test-$(date +%s)"
CLI="browser-devtools-cli --json --quiet --session-id $SESSION"Navigate
$CLI navigation go-to --url "https://example.com"Get text content
CONTENT=$($CLI content get-as-text)
echo "Page content: $CONTENT"Take screenshot
$CLI content take-screenshot --name "test-result"Cleanup
browser-devtools-cli session delete $SESSION
`$3
The CLI uses a daemon server architecture for efficient browser management:
1. Auto-start: The daemon starts automatically when you run any tool command
2. Shared browser: Multiple CLI invocations share the same browser instance
3. Session isolation: Each session ID gets its own isolated browser context
4. Auto-cleanup: Idle sessions are automatically cleaned up after inactivity
The daemon listens on port 2020 by default. Use
--port to specify a different port.$3
Comprehensive documentation for AI agents and automation is available in the browser-devtools-skills repository.
Install as an AI agent skill:
`bash
npx skills add serkan-ozal/browser-devtools-skills
`For the full list of available skills and documentation, see the browser-devtools-skills repository.
Configuration
The server can be configured using environment variables:
| Variable | Description | Default |
|----------|-------------|---------|
|
PORT | Port for HTTP transport | 3000 |
| SESSION_IDLE_SECONDS | Idle session timeout (seconds) | 300 |
| SESSION_IDLE_CHECK_SECONDS | Interval for checking idle sessions (seconds) | 30 |
| SESSION_CLOSE_ON_SOCKET_CLOSE | Close session when socket closes | false |
| CONSOLE_MESSAGES_BUFFER_SIZE | Maximum console messages to buffer | 1000 |
| HTTP_REQUESTS_BUFFER_SIZE | Maximum HTTP requests to buffer | 1000 |
| BROWSER_HEADLESS_ENABLE | Run browser in headless mode | true |
| BROWSER_PERSISTENT_ENABLE | Use persistent browser context (preserves cookies, localStorage, etc.). Required for React tools to work optimally. | false |
| BROWSER_PERSISTENT_USER_DATA_DIR | Directory for persistent browser context user data | ./browser-devtools-mcp |
| BROWSER_USE_INSTALLED_ON_SYSTEM | Use system-installed Chrome browser instead of Playwright's bundled browser | false |
| BROWSER_EXECUTABLE_PATH | Custom browser executable path | (uses Playwright default) |
| OTEL_ENABLE | Enable OpenTelemetry integration | false |
| OTEL_SERVICE_NAME | OpenTelemetry service name | frontend |
| OTEL_SERVICE_VERSION | OpenTelemetry service version | (none) |
| OTEL_ASSETS_DIR | Directory containing OpenTelemetry bundle files | (uses default) |
| OTEL_EXPORTER_TYPE | OpenTelemetry exporter type: "otlp/http", "console", or "none" | none |
| OTEL_EXPORTER_HTTP_URL | OpenTelemetry collector base URL (e.g., "http://localhost:4318") | (none) |
| OTEL_EXPORTER_HTTP_HEADERS | OpenTelemetry exporter HTTP headers (comma-separated key=value pairs) | (none) |
| OTEL_INSTRUMENTATION_USER_INTERACTION_EVENTS | User interaction events to instrument (comma-separated, e.g., "click,submit") | click |
| FIGMA_ACCESS_TOKEN | Figma API access token for design comparison | (none) |
| FIGMA_API_BASE_URL | Figma API base URL | https://api.figma.com/v1 |Available Tools
$3
content_take-screenshot - Takes a screenshot of the current page or a specific element.
Parameters:
-
outputPath (string, optional): Directory path where screenshot will be saved (default: OS temp directory)
- name (string, optional): Screenshot name (default: "screenshot")
- selector (string, optional): CSS selector for element to capture
- fullPage (boolean, optional): Capture full scrollable page (default: false)
- type (enum, optional): Image format - "png" or "jpeg" (default: "png")
- quality (number, optional): The quality of the image, between 0-100. Not applicable to PNG images, only used for JPEG format (default: 100)
- includeBase64 (boolean, optional): Include base64-encoded image data in the response (default: false)Returns:
-
filePath (string): Full path of the saved screenshot file
- image (object, optional): Screenshot image data with mimeType (only included when includeBase64 is true)Notes:
- The screenshot is always saved to the file system and the file path is returned
- By default, image data is NOT included in the response to reduce payload size
- Set
includeBase64 to true when the AI assistant cannot access the MCP server's file system (e.g., remote server, containerized environment, or different machine)
- The quality parameter only applies to JPEG images. PNG images are always saved at full quality
- Lower quality values (e.g., 50-70) result in smaller file sizes but reduced image quality
content_get-as-html - Retrieves the HTML content of the current page or a specific element.
Parameters:
-
selector (string, optional): CSS selector to limit the HTML content to a specific container
- removeScripts (boolean, optional): Remove all script tags from the HTML (default: true)
- removeComments (boolean, optional): Remove all HTML comments (default: false)
- removeStyles (boolean, optional): Remove all style tags from the HTML (default: false)
- removeMeta (boolean, optional): Remove all meta tags from the HTML (default: false)
- cleanHtml (boolean, optional): Perform comprehensive HTML cleaning (default: false)
- minify (boolean, optional): Minify the HTML output (default: false)
- maxLength (number, optional): Maximum number of characters to return (default: 50000)Returns:
-
output (string): The requested HTML content of the page
content_get-as-text - Retrieves the visible text content of the current page or a specific element.
Parameters:
-
selector (string, optional): CSS selector to limit the text content to a specific container
- maxLength (number, optional): Maximum number of characters to return (default: 50000)Returns:
-
output (string): The requested text content of the page
content_save-as-pdf - Saves the current page as a PDF document.
Parameters:
-
outputPath (string, optional): Directory path where PDF will be saved (default: OS temp directory)
- name (string, optional): PDF name (default: "page")
- format (enum, optional): Page format - "Letter", "Legal", "Tabloid", "Ledger", "A0" through "A6" (default: "A4")
- printBackground (boolean, optional): Whether to print background graphics (default: false)
- margin (object, optional): Page margins with top, right, bottom, left (default: "1cm" for each)Returns:
-
filePath (string): Full path of the saved PDF file
$3
interaction_click - Clicks an element on the page.
Parameters:
-
selector (string, required): CSS selector for the element to click
interaction_fill - Fills a form input field.
Parameters:
-
selector (string, required): CSS selector for the input field
- value (string, required): Value to fill
interaction_hover - Hovers over an element.
Parameters:
-
selector (string, required): CSS selector for the element to hover
interaction_press-key - Simulates keyboard input.
Parameters:
-
key (string, required): Key to press (e.g., "Enter", "Escape", "Tab")
- selector (string, optional): CSS selector to focus before sending the key
- holdMs (number, optional): Duration in milliseconds to hold the key (repeat duration if repeat is true)
- repeat (boolean, optional, default: false): If true, simulates key auto-repeat by pressing repeatedly during holdMs
- repeatIntervalMs (number, optional, default: 50, min: 10): Interval between repeated key presses in ms (only when repeat is true)
interaction_select - Selects an option from a dropdown.
Parameters:
-
selector (string, required): CSS selector for the select element
- value (string, required): Value to select
interaction_drag - Performs drag and drop operation.
Parameters:
-
sourceSelector (string, required): CSS selector for the source element
- targetSelector (string, required): CSS selector for the target element
interaction_scroll - Scrolls the page viewport or a specific scrollable element.
Parameters:
-
mode (enum, optional): Scroll mode - "by" (relative delta), "to" (absolute position), "top", "bottom", "left", "right" (default: "by")
- selector (string, optional): CSS selector for a scrollable container. If omitted, scrolls the document viewport
- dx (number, optional): Horizontal scroll delta in pixels (used when mode="by", default: 0)
- dy (number, optional): Vertical scroll delta in pixels (used when mode="by", default: 0)
- x (number, optional): Absolute horizontal scroll position in pixels (used when mode="to")
- y (number, optional): Absolute vertical scroll position in pixels (used when mode="to")
- behavior (enum, optional): Native scroll behavior - "auto" or "smooth" (default: "auto")Returns:
-
mode (string): The scroll mode used
- selector (string | null): The selector of the scroll container if provided; otherwise null (document viewport)
- behavior (string): The scroll behavior used
- before (object): Scroll metrics before the scroll action (x, y, scrollWidth, scrollHeight, clientWidth, clientHeight)
- after (object): Scroll metrics after the scroll action (x, y, scrollWidth, scrollHeight, clientWidth, clientHeight)
- canScrollX (boolean): Whether horizontal scrolling is possible
- canScrollY (boolean): Whether vertical scrolling is possible
- maxScrollX (number): Maximum horizontal scrollLeft
- maxScrollY (number): Maximum vertical scrollTop
- isAtLeft (boolean): Whether the scroll position is at the far left
- isAtRight (boolean): Whether the scroll position is at the far right
- isAtTop (boolean): Whether the scroll position is at the very top
- isAtBottom (boolean): Whether the scroll position is at the very bottomUsage:
- Reveal content below the fold
- Jump to the top/bottom without knowing exact positions
- Bring elements into view before clicking
- Inspect lazy-loaded content that appears on scroll
interaction_resize-viewport - Resizes the page viewport using Playwright viewport emulation.
Parameters:
-
width (number, required): Target viewport width in CSS pixels (minimum: 200)
- height (number, required): Target viewport height in CSS pixels (minimum: 200)Returns:
-
requested (object): Requested viewport configuration (width, height)
- viewport (object): Viewport metrics observed inside the page after resizing:
- innerWidth, innerHeight: window.innerWidth/innerHeight
- outerWidth, outerHeight: window.outerWidth/outerHeight
- devicePixelRatio: window.devicePixelRatioNotes:
- This affects
window.innerWidth/innerHeight, CSS media queries, layout, rendering, and screenshots
- This does NOT resize the OS-level browser window
- Runtime switching to viewport=null (binding to real window size) is not supported by Playwright
- If you need real window-driven responsive behavior, start the BrowserContext with viewport: null and use the window resize tool instead
interaction_resize-window - Resizes the real browser window (OS-level window) for the current page using Chrome DevTools Protocol (CDP).
Parameters:
-
width (number, optional): Target window width in pixels (required when state="normal", minimum: 200)
- height (number, optional): Target window height in pixels (required when state="normal", minimum: 200)
- state (enum, optional): Target window state - "normal", "maximized", "minimized", or "fullscreen" (default: "normal")Returns:
-
requested (object): Requested window change parameters (width, height, state)
- before (object): Window bounds before resizing (windowId, state, left, top, width, height)
- after (object): Window bounds after resizing (windowId, state, left, top, width, height)
- viewport (object): Page viewport metrics after resizing (innerWidth, innerHeight, outerWidth, outerHeight, devicePixelRatio)Notes:
- Works best on Chromium-based browsers (Chromium/Chrome/Edge)
- Especially useful in headful sessions when running with viewport emulation disabled (viewport: null)
- If Playwright viewport emulation is enabled (viewport is NOT null), resizing the OS window may not change page layout
- On non-Chromium browsers (Firefox/WebKit), CDP is not available and this tool will fail
$3
navigation_go-to - Navigates to a URL.
Parameters:
-
url (string, required): URL to navigate to (must include scheme)
- timeout (number, optional): Maximum operation time in milliseconds (default: 0 - no timeout)
- waitUntil (enum, optional): When to consider navigation succeeded - "load", "domcontentloaded", "networkidle", or "commit" (default: "load")Returns:
-
url (string): Final URL after navigation
- status (number): HTTP status code
- statusText (string): HTTP status text
- ok (boolean): Whether navigation was successful (2xx status)
navigation_go-back - Navigates backward in browser history.
navigation_go-forward - Navigates forward in browser history.
navigation_reload - Reloads the current page.
Parameters:
-
timeout (number, optional): Maximum operation time in milliseconds (default: 0 - no timeout)
- waitUntil (enum, optional): When to consider navigation succeeded - "load", "domcontentloaded", "networkidle", or "commit" (default: "load")Returns:
-
url (string): Final URL after reload
- status (number): HTTP status code
- statusText (string): HTTP status text
- ok (boolean): Whether reload was successful (2xx status)
$3
run_js-in-browser - Runs custom JavaScript INSIDE the active browser page using Playwright's "page.evaluate()".
Parameters:
-
script (string, required): JavaScript code to executeReturns:
-
result (any): Result of the evaluation. This value can be of any type, including primitives, arrays, or objects. It represents the direct return value of the JavaScript expression executed in the page context.Notes:
- The code executes in the PAGE CONTEXT (real browser environment):
- Has access to window, document, DOM, Web APIs
- Can read/modify the page state
- Runs with the same permissions as the loaded web page
- The code runs in an isolated execution context, but within the page
- No direct access to Node.js APIs
- Return value must be serializable
Typical use cases:
- Inspect or mutate DOM state
- Read client-side variables or framework internals
- Trigger browser-side logic
- Extract computed values directly from the page
run_js-in-sandbox - Runs custom JavaScript inside a Node.js VM sandbox on the MCP server (NOT in the browser).
Parameters:
-
code (string, required): JavaScript code to run on the MCP server in a VM sandbox. The code is wrapped in an async IIFE, so await is allowed. Use return ... to return a value
- timeoutMs (number, optional): Max VM CPU time for synchronous execution in milliseconds (default: 5000, max: 30000)Returns:
-
result (any): Return value of the sandboxed code (best-effort JSON-safe). If user returns undefined but logs exist, returns { logs }. If error occurs, returns { error, logs }Available bindings:
-
page: Playwright Page (main interaction surface)
- console: captured logs (log/warn/error)
- sleep(ms): async helperSafe built-ins:
- Math, JSON, Number, String, Boolean, Array, Object, Date, RegExp
- isFinite, isNaN, parseInt, parseFloat
- URL, URLSearchParams
- TextEncoder, TextDecoder
- structuredClone
- crypto.randomUUID()
- AbortController
- setTimeout / clearTimeout
NOT available:
- require, process, fs, Buffer
- globalThis
Notes:
- This runs on the MCP SERVER (not in the browser)
- This is NOT a security boundary. Intended for trusted automation logic
- The timeoutMs parameter limits synchronous execution time, but does not automatically time out awaited Promises
$3
o11y_get-console-messages - Retrieves console messages/logs from the browser with advanced filtering.
Parameters:
-
type (enum, optional): Filter by message level - "ERROR", "WARNING", "INFO", "DEBUG"
- search (string, optional): Text to search for in messages
- timestamp (number, optional): Start time filter (Unix epoch milliseconds)
- sequenceNumber (number, optional): Only return messages after this sequence number
- limit (object, optional): Limit results
- count (number): Maximum number of messages
- from (enum): "start" or "end" (default: "end")Returns:
-
messages (array): Array of console messages with type, text, location, timestamp, and sequence number
o11y_get-http-requests - Retrieves HTTP requests from the browser with detailed filtering.
Parameters:
-
resourceType (enum, optional): Filter by resource type (e.g., "document", "script", "stylesheet")
- status (object, optional): Filter by status code range
- min (number): Minimum status code
- max (number): Maximum status code
- ok (boolean, optional): Filter by success/failure (2xx = success)
- timestamp (number, optional): Start time filter (Unix epoch milliseconds)
- sequenceNumber (number, optional): Only return requests after this sequence number
- limit (object, optional): Limit results
- count (number): Maximum number of requests
- from (enum): "start" or "end" (default: "end")Returns:
-
requests (array): Array of HTTP requests with URL, method, headers, body, response, timing, and metadata
o11y_get-web-vitals - Collects Web Vitals-style performance metrics and provides recommendations based on Google's thresholds.
Parameters:
-
waitMs (number, optional): Optional wait duration in milliseconds before reading metrics (default: 0, max: 30000). Useful to allow LCP/INP/CLS to settle after interactions
- includeDebug (boolean, optional): If true, returns additional debug details such as entry counts and LCP element hint (default: false)Returns:
-
url (string): Current page URL
- title (string): Current page title
- timestampMs (number): Unix epoch timestamp (ms) when the metrics were captured
- metrics (object): Raw metric values (null if unavailable):
- lcpMs (number | null): Largest Contentful Paint in milliseconds
- inpMs (number | null): Interaction to Next Paint in milliseconds (best-effort approximation)
- cls (number | null): Cumulative Layout Shift score
- ttfbMs (number | null): Time to First Byte in milliseconds
- fcpMs (number | null): First Contentful Paint in milliseconds
- ratings (object): Ratings computed from Google thresholds for each metric:
- lcp, inp, cls, ttfb, fcp: Each contains:
- rating (enum): "good", "needs_improvement", "poor", or "not_available"
- value (number | null): Metric value
- unit (enum): "ms" or "score"
- thresholds (object): Thresholds used for rating (good, poor)
- recommendations (object): Recommendations based on measured values:
- coreWebVitalsPassed (boolean): True if all Core Web Vitals are rated "good"
- summary (array): High-level summary and prioritization guidance
- lcp, inp, cls, ttfb, fcp (array): Specific recommendations for each metric
- general (array): General measurement and debugging notes
- notes (array): Notes about metric availability, browser limitations, and interpretation
- debug (object, optional): Optional debug details (when includeDebug=true):
- waitMs (number): Actual wait duration used
- entries (object): Counts of PerformanceEntry types used to compute metrics
- lastLcpSelectorHint (string | null): Best-effort selector hint for the last LCP element
- lastLcpTagName (string | null): Tag name of the last LCP elementCore Web Vitals Thresholds:
- LCP (Largest Contentful Paint): good <= 2500ms, poor > 4000ms
- INP (Interaction to Next Paint): good <= 200ms, poor > 500ms
- CLS (Cumulative Layout Shift): good <= 0.1, poor > 0.25
Supporting Metrics Thresholds:
- TTFB (Time to First Byte): good <= 800ms, poor > 1800ms
- FCP (First Contentful Paint): good <= 1800ms, poor > 3000ms
Usage:
- Call after navigation and after user actions
- If you need more stable LCP/CLS/INP, pass waitMs (e.g., 1000-3000ms)
- Some metrics may be unavailable depending on browser support and whether interactions occurred
o11y_get-trace-id - Gets the OpenTelemetry compatible trace id of the current session.
Parameters:
- No input parameters
Returns:
-
traceId (string, optional): The OpenTelemetry compatible trace id of the current session if availableNote: Requires OpenTelemetry to be enabled (
OTEL_ENABLE=true).
o11y_new-trace-id - Generates a new OpenTelemetry compatible trace id and sets it to the current session.
Parameters:
- No input parameters
Returns:
-
traceId (string): The generated new OpenTelemetry compatible trace idNote: Requires OpenTelemetry to be enabled (
OTEL_ENABLE=true). The new trace ID is automatically set and will be used for all subsequent traces in the session.
o11y_set-trace-id - Sets the OpenTelemetry compatible trace id of the current session.
Parameters:
-
traceId (string, optional): The OpenTelemetry compatible trace id to be set. Leave it empty to clear the session trace id, so no OpenTelemetry trace header will be propagated from browser throughout the API callsReturns:
- No return value
Note: Requires OpenTelemetry to be enabled (
OTEL_ENABLE=true). When a trace ID is set, it will be propagated in HTTP headers (traceparent) for all API calls, enabling correlation with backend traces.
$3
sync_wait-for-network-idle - Waits until the page reaches a network-idle condition based on the session's tracked in-flight request count.
Parameters:
-
timeoutMs (number, optional): Maximum time to wait before failing (milliseconds, default: 30000)
- idleTimeMs (number, optional): How long the network must stay idle continuously before resolving (milliseconds, default: 500)
- maxConnections (number, optional): Idle threshold - network is considered idle when in-flight requests <= maxConnections (default: 0)
- pollIntervalMs (number, optional): Polling interval used to sample the in-flight request count (milliseconds, default: 50)Returns:
-
waitedMs (number): Total time waited until the network became idle or the tool timed out
- idleTimeMs (number): Idle duration required for success
- timeoutMs (number): Maximum allowed wait time
- maxConnections (number): Idle threshold used
- pollIntervalMs (number): Polling interval used
- finalInFlightRequests (number): The last observed number of in-flight requests
- observedIdleMs (number): How long the in-flight request count stayed <= maxConnectionsUsage:
- Use before interacting with SPA pages that load data asynchronously
- Use before taking screenshots or AX tree snapshots for more stable results
- Use after actions that trigger background fetch/XHR activity
Note: This tool uses server-side tracking, so it works reliably even with strict CSP. It does NOT rely on window globals or page-injected counters.
$3
a11y_take-aria-snapshot - Captures an ARIA (accessibility) snapshot of the current page or a specific element.
Parameters:
-
selector (string, optional): CSS selector for element to snapshotReturns:
-
output (string): Includes the page URL, title, and a YAML-formatted accessibility treeUsage:
- Use in combination with
accessibility_take-ax-tree-snapshot for comprehensive UI analysis
- Provides semantic structure and accessibility roles
- Helps identify accessibility issues and page hierarchy problems
accessibility_take-ax-tree-snapshot - Captures a UI-focused snapshot by combining Chromium's Accessibility (AX) tree with runtime visual diagnostics.
Parameters:
-
roles (array, optional): Optional role allowlist (button, link, textbox, checkbox, radio, combobox, switch, tab, menuitem, dialog, heading, listbox, listitem, option). If omitted, a built-in set of interactive roles is used
- includeStyles (boolean, optional): Whether to include computed CSS styles for each node (default: true)
- includeRuntimeVisual (boolean, optional): Whether to compute runtime visual information (bounding box, visibility, viewport) (default: true)
- checkOcclusion (boolean, optional): If true, checks whether each element is visually occluded by another element using elementFromPoint() sampled at multiple points (default: false)
- onlyVisible (boolean, optional): If true, only visually visible nodes are returned (default: false)
- onlyInViewport (boolean, optional): If true, only nodes intersecting the viewport are returned (default: false)
- textPreviewMaxLength (number, optional): Maximum length of the text preview extracted from each element (default: 80)
- styleProperties (array, optional): List of CSS computed style properties to extract (default: includes display, visibility, opacity, position, z-index, colors, fonts, etc.)Returns:
-
url (string): The current page URL at the time the AX snapshot was captured
- title (string): The document title of the page at the time of the snapshot
- axNodeCount (number): Total number of nodes returned by Chromium Accessibility.getFullAXTree before filtering
- candidateCount (number): Number of DOM-backed AX nodes that passed role filtering before enrichment
- enrichedCount (number): Number of nodes included in the final enriched snapshot output
- truncatedBySafetyCap (boolean): Indicates whether the result set was truncated by an internal safety cap
- nodes (array): List of enriched DOM-backed AX nodes combining accessibility metadata with visual diagnostics, including:
- axNodeId, parentAxNodeId, childAxNodeIds: Tree structure
- role, name, ignored: Accessibility properties
- backendDOMNodeId, domNodeId, frameId: DOM references
- localName, id, className, selectorHint: Element identification
- textPreview: Short preview of rendered text content
- styles: Computed CSS styles (if includeStyles is true)
- runtime: Visual diagnostics including boundingBox, isVisible, isInViewport, and optional occlusion dataUsage:
- Use to detect UI issues like elements that exist semantically but are visually hidden or off-screen
- Identify wrong layout/geometry, styling issues, and overlap/stacking/occlusion problems
- ALWAYS use
checkOcclusion: true when investigating UI/layout problems
- Use alongside a11y_take-aria-snapshot tool for complete UI analysis
$3
stub_intercept-http-request - Installs a request interceptor stub that can modify outgoing requests before they are sent.
Parameters:
-
pattern (string, required): Glob pattern matched against the full request URL (picomatch)
- modifications (object, optional): Request modifications to apply
- headers (object, optional): Headers to merge into the outgoing request headers
- body (string | object, optional): Override request body. If object/array, it will be JSON-stringified
- method (string, optional): Override HTTP method (e.g., POST, PUT)
- delayMs (number, optional): Artificial delay in milliseconds before continuing the request (default: 0)
- times (number, optional): Apply only N times, then let through. Omit for infiniteReturns:
-
stubId (string): Unique id of the installed stub
- kind (string): Stub kind (always "intercept_http_request")
- pattern (string): Glob pattern used
- enabled (boolean): Whether the stub is enabled
- delayMs (number): Applied artificial delay in milliseconds
- times (number): Max applications (-1 means infinite)Use cases:
- A/B testing / feature flags (inject headers)
- Security testing (inject malformed headers / payload)
- Edge cases (special characters, large payload)
- Auth simulation (add API keys / tokens in headers)
Notes:
- Pattern is a glob matched against the full request URL (picomatch)
- This modifies requests; it does not change responses
- Times limits how many times the interceptor applies (-1 means infinite)
stub_mock-http-response - Installs a response stub for matching requests using glob patterns (picomatch).
Parameters:
-
pattern (string, required): Glob pattern matched against the full request URL (picomatch)
- response (object, required): Mock response configuration
- action (enum, optional): "fulfill" or "abort" (default: "fulfill")
- status (number, optional): HTTP status code (used when action="fulfill", range: 100-599)
- headers (object, optional): HTTP headers for the mocked response
- body (string | object, optional): Response body. If object/array, it will be JSON-stringified
- abortErrorCode (string, optional): Playwright abort error code (used when action="abort"), e.g., "timedout"
- delayMs (number, optional): Artificial delay in milliseconds before applying the stub (default: 0)
- times (number, optional): Apply only N times, then let through. Omit for infinite
- chance (number, optional): Probability (0..1) to apply the stub per request (flaky testing)Returns:
-
stubId (string): Unique id of the installed stub (use it to clear later)
- kind (string): Stub kind (always "mock_http_response")
- pattern (string): Glob pattern used
- enabled (boolean): Whether the stub is enabled
- delayMs (number): Applied artificial delay in milliseconds
- times (number): Max applications (-1 means infinite)
- chance (number, optional): Apply probability (omit means always)
- action (string): Applied action ("fulfill" or "abort")
- status (number, optional): HTTP status (present when action="fulfill")Use cases:
- Offline testing (return 200 with local JSON)
- Error scenarios (force 500/404 or abort with timedout)
- Edge cases (empty data / huge payload / special characters)
- Flaky API testing (chance < 1.0)
- Performance testing (delayMs)
Notes:
- Pattern is a glob matched against the full request URL
- Stubs are evaluated in insertion order; first match wins
- Times limits how many times the stub applies (-1 means infinite)
stub_list - Lists currently installed stubs for the active browser context/session.
Parameters:
- No input parameters
Returns:
-
stubs (array): Array of installed stubs, each containing:
- id (string): Stub id
- kind (string): Stub kind ("intercept_http_request" or "mock_http_response")
- enabled` (boolean): Whether stub is en