Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

browser-automation Plugin

Browser automation and debugging MCP servers: Chrome DevTools and Playwright.

Prerequisites

  • Node.js (for npx)
  • Chrome browser (for chrome-devtools)
  • Playwright browsers are installed automatically via the browser_install MCP tool (see Browser Types)

Installation

/plugin install browser-automation@claude-code-plugins

MCP Servers

Server Capabilities
chrome-devtools Chrome DevTools Protocol - debugging, console access, network inspection, screenshots
playwright Cross-browser automation - navigation, interaction, testing, screenshots

chrome-devtools

The Chrome DevTools MCP server provides:

  • Console message reading and filtering
  • Accessibility tree snapshots (not pixel screenshots - use Playwright for visual captures)
  • Network request inspection
  • JavaScript execution
  • DOM manipulation

The server auto-launches Chrome if no instance is found on the configured CDP port. To connect to an existing Chrome, start it with chrome --remote-debugging-port=9222. See Chrome DevTools MCP documentation for details.

playwright

The Playwright MCP server provides:

  • Cross-browser automation (Chromium, Firefox, WebKit)
  • Page navigation and interaction
  • Element selection and manipulation
  • Screenshot and PDF generation
  • Network interception

Environment Variables

Chrome DevTools

Variable Default Description
CHROME_CHANNEL stable Chrome channel: stable, canary, beta, dev
CHROME_CDP_PORT 9222 Chrome DevTools Protocol debugging port

Playwright

Variable Default Description
PLAYWRIGHT_BROWSER chromium Browser: chromium, firefox, webkit, msedge
PLAYWRIGHT_VIEWPORT 1280,720 Viewport dimensions (width,height)

Configuration Options

Both servers support boolean flags that are present when enabled, absent when disabled. These cannot be configured via environment variables - you must edit the .mcp.json file directly.

Default Config (Headed Mode)

The plugin defaults to headed mode with a persistent profile - ideal for development:

{
  "mcpServers": {
    "playwright": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@playwright/mcp@latest", "--browser", "chromium", "--viewport-size", "1280,720"]
    }
  }
}

Headless Mode (Containers, WSL, CI)

Add --headless for environments without a display:

{
  "mcpServers": {
    "playwright": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@playwright/mcp@latest", "--headless", "--browser", "chromium"]
    }
  }
}

Isolated Mode (No Persistent Profile)

Add --isolated to use a temporary profile that's deleted on close:

{
  "mcpServers": {
    "playwright": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@playwright/mcp@latest", "--isolated", "--browser", "chromium"]
    }
  }
}

Docker/Container Mode

For Docker or sandboxed environments, combine --headless, --isolated, and --no-sandbox:

{
  "mcpServers": {
    "playwright": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@playwright/mcp@latest", "--headless", "--isolated", "--no-sandbox"]
    }
  }
}

Available Flags

Flag Description
--headless Run without visible browser UI
--isolated Use temporary profile (deleted on close)
--no-sandbox Disable browser sandbox (required in some containers)
--browser=<name> Browser: chromium, firefox, webkit, msedge
--channel=<name> Chrome channel: stable, canary, beta, dev
--viewport-size=<W,H> Viewport size (e.g., 1920,1080)
--caps=<list> Enable capabilities: vision, pdf, testing

See npx @playwright/mcp@latest --help for full options.

Browser Types

Playwright supports two categories of browsers:

Playwright-Managed Browsers (require download)

These browsers are downloaded and managed by Playwright. You must install them before use:

npx playwright install chromium   # Default browser
npx playwright install firefox
npx playwright install webkit
Browser Install Required Notes
chromium Yes Default. Open-source Chromium build managed by Playwright
firefox Yes Firefox build managed by Playwright
webkit Yes WebKit build managed by Playwright

System Browsers (no download needed)

These use browsers already installed on your system:

# No install needed - just set the env var
PLAYWRIGHT_BROWSER=msedge   # Microsoft Edge
PLAYWRIGHT_BROWSER=chrome   # Google Chrome
Browser Install Required Notes
msedge No Uses system Microsoft Edge
chrome No Uses system Google Chrome

To override the default browser, set PLAYWRIGHT_BROWSER in your settings.local.json:

{
  "env": {
    "PLAYWRIGHT_BROWSER": "msedge"
  }
}

Startup Hook

The plugin includes a SessionStart hook that checks whether the configured Playwright browser is installed. If missing, it injects context instructing Claude to call the Playwright MCP server's built-in browser_install tool for automatic self-recovery.

  • Self-recovering — Claude will call browser_install automatically when the browser is missing
  • The hook never blocks session startup
  • Disable it by setting CLAUDE_HOOK_BROWSER_PREREQ_CHECK_ENABLED=0 in your settings

Browser Installation

The Playwright MCP server includes a built-in browser_install tool that downloads and installs the configured browser. Claude calls this automatically when the startup hook detects a missing browser.

Manual alternative: npx playwright install chromium

Troubleshooting

"Browser 'chromium' is not installed"

This error means Playwright's managed browser binaries have not been downloaded. The startup hook should trigger automatic installation via the browser_install MCP tool. If it doesn't:

  1. Call the browser_install tool directly via MCP
  2. Or run npx playwright install chromium manually
  3. Or switch to a system browser: set PLAYWRIGHT_BROWSER=msedge in settings.local.json

Browser process already running

On Windows, Chrome often runs as a background process. If the CDP port is occupied, quit Chrome fully or set a different port via CHROME_CDP_PORT.

Usage Notes

Alert Handling

Browser dialogs (alerts, confirms, prompts) block all further browser events. Avoid triggering these or dismiss them before proceeding with automation.

GIF Recording

Use GIF recording for multi-step interactions that users may want to review. Capture extra frames before and after actions for smooth playback.

Related Plugins

License

MIT