Overview
Key features of the Playwright MCP server:- Accessibility-based: Uses structured accessibility snapshots, not pixel-based input
- LLM-friendly: Works with any model, no vision capabilities required
- Deterministic actions: Precise element targeting avoids screenshot ambiguity
- Full browser control: Navigate, click, type, drag, upload files, and more
Deploy to Heroku
Deploy the Playwright MCP server to Heroku with one click:- Streamable HTTP:
https://your-app-name.herokuapp.com/mcp - SSE endpoint:
https://your-app-name.herokuapp.com/sse
Register with Heroku AI
Register the MCP server with your Heroku AI model:Available Tools
Core Navigation
| Tool | Description |
|---|---|
browser_navigate | Navigate to a URL |
browser_navigate_back | Go back to previous page |
browser_navigate_forward | Go forward to next page |
browser_close | Close the browser |
Page Interaction
| Tool | Description |
|---|---|
browser_click | Click on an element |
browser_type | Type text into an input field |
browser_hover | Hover over an element |
browser_drag | Drag and drop between elements |
browser_select_option | Select dropdown option |
browser_press_key | Press a keyboard key |
Page Information
| Tool | Description |
|---|---|
browser_snapshot | Get accessibility snapshot of the page |
browser_take_screenshot | Capture a screenshot |
browser_console_messages | Get browser console messages |
browser_network_requests | List network requests |
File Operations
| Tool | Description |
|---|---|
browser_file_upload | Upload files to the page |
browser_pdf_save | Save page as PDF (requires --caps=pdf) |
Tab Management
| Tool | Description |
|---|---|
browser_tab_list | List all open tabs |
browser_tab_new | Open a new tab |
browser_tab_select | Switch to a specific tab |
browser_tab_close | Close a tab |
Advanced
| Tool | Description |
|---|---|
browser_evaluate | Execute JavaScript on the page |
browser_handle_dialog | Handle alert/confirm/prompt dialogs |
browser_wait_for | Wait for text or time |
browser_resize | Resize browser window |
Using with Heroku AI Agents
Automate web interactions through the Heroku Agents API:- Python
- cURL
How Element Targeting Works
The Playwright MCP server uses accessibility snapshots instead of screenshots. When you callbrowser_snapshot, you get a structured representation of the page:
ref number:
Configuration Options
Configure the server with command-line arguments or a config file:Common Options
| Option | Description |
|---|---|
--headless | Run browser in headless mode |
--browser <type> | Browser to use: chrome, firefox, webkit, msedge |
--viewport-size <size> | Browser viewport size (e.g., 1280,720) |
--user-data-dir <path> | Path to persistent browser profile |
--isolated | Use isolated profile (no persistence) |
Network Options
| Option | Description |
|---|---|
--allowed-origins <list> | Semicolon-separated origins to allow |
--blocked-origins <list> | Semicolon-separated origins to block |
--proxy-server <proxy> | Proxy server URL |
--ignore-https-errors | Ignore HTTPS certificate errors |
Capability Options
| Option | Description |
|---|---|
--caps=pdf | Enable PDF generation |
--caps=vision | Enable coordinate-based interactions |
Example Use Cases
Form Automation
Web Scraping
Testing Workflows
Research Tasks
Session Management
Persistent Profile
By default, the browser maintains a persistent profile. Login sessions and cookies are preserved between interactions. The profile is stored at:- macOS:
~/Library/Caches/ms-playwright/mcp-{channel}-profile - Linux:
~/.cache/ms-playwright/mcp-{channel}-profile - Windows:
%USERPROFILE%\AppData\Local\ms-playwright\mcp-{channel}-profile