What It Does
Script execution, data extraction, and file uploads — all through a clean set of MCP tools. Whether running headless in CI or with a visible browser for debugging, it handles the full lifecycle of browser automation workflows.
Playwright MCP gives your AI agent complete control over a real web browser using the Model Context Protocol. Built on Microsoft's Playwright engine, it supports Chromium, Firefox, and WebKit, enabling programmatic navigation, form interaction, Java.
Key Features
- Multi-Browser Support — Run automation against Chromium, Firefox, or WebKit by passing a single `--browser` flag. Switching engines requires no code changes, making cross-browser testing or compatibility checks straightforward.
- Rich MCP Tool Set — Exposes 10 purpose-built tools — `browser_navigate`, `browser_click`, `browser_type`, `browser_evaluate`, `browser_snapshot`, `browser_choose_file`, `browser_press`, and more — covering every common browser interaction pattern an AI agent needs.
- JavaScript Execution — The `browser_evaluate` tool runs arbitrary JavaScript in the page context and returns results as JSON, enabling complex data extraction, DOM manipulation, and custom scripting without additional tooling.
- Flexible Run Modes — Supports headless and headed modes, configurable viewport sizes, custom user agents, and adjustable action/navigation timeouts — adaptable to both CI pipelines and interactive debugging sessions.
- Built-in Security Controls — Restricts filesystem access to the workspace root by default, supports `--allowed-hosts` and `--blocked-origins` to control navigation targets, and enables sandboxing out of the box to reduce attack surface.
- Trace, Video & Output Capture — Optionally save Playwright traces (`--save-trace`), record session video (`--save-video`), and direct output artifacts to a configurable directory — useful for debugging failed automation runs or auditing agent behavior.
Use Cases
- Automated login and authenticated scraping — Navigate to a login page, fill in credentials with `browser_type`, submit with `browser_click`, then proceed to authenticated pages to extract data — all in a single agent workflow.
- Dynamic data extraction from JavaScript-rendered pages — Use `browser_navigate` to load a page, then `browser_evaluate` with a custom script to pull table rows, structured JSON, or any DOM content that only appears after JavaScript execution.
- End-to-end form testing and validation — Walk through multi-step forms — selecting dropdown options, uploading files, pressing keyboard shortcuts, and verifying result text — to validate web app behavior from a user's perspective.
- Web UI monitoring and screenshot capture — Navigate to dashboards or landing pages on a schedule, capture the rendered state via `browser_evaluate` and output-dir screenshots, and flag visual or content changes over time.