Playwright MCP for Claude Code: Setup & Config
Playwright MCP lets Claude Code operate browsers using structured accessibility data.
What you can do with Playwright in Claude Code
Choose structured browser interaction with persistent state and detailed inspection tools.
- Explore a website through accessibility snapshots and iterative actions.
- Keep browser state across a long-running agent workflow.
Before you start: Playwright in Claude Code
- Node.js 18 or later
- An MCP-compatible client
Add the command to your client's MCP configuration. Browser selection, headless operation, and connection settings are configurable through documented arguments.
Playwright Claude Code configuration
Choose Claude Code configuration scope
For Playwright MCP, open Project scope: .mcp.json at the repository root. Project JSON: merge into mcpServers; user scope: use the CLI.
Add Playwright MCP to Claude Code
Use the playwright-mcp entry below in mcpServers. Keep Playwright MCP's documented stdio connection fields and your other Claude Code entries.
Check Playwright MCP in Claude Code
Playwright MCP: Inspect claude mcp list and /mcp status.
Config file · Project scope: .mcp.json at the repository root
{
"mcpServers": {
"playwright-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"@playwright/mcp@latest"
],
"env": {}
}
}
}claude mcp add-json --scope project 'playwright-mcp' '{"type":"stdio","command":"npx","args":["@playwright/mcp@latest"],"env":{}}'Playwright tools available to Claude Code
Playwright's stored tool list documents 25 tools; compare it with Claude Code's connected tool list, because the stored list is not a live check.
- browser_close
For Playwright's browser_close, review the permission request and arguments in Claude Code before approval.
- browser_resize
For Playwright's browser_resize, review the permission request and arguments in Claude Code before approval.
- browser_console_messages
For Playwright's browser_console_messages, review the permission request and arguments in Claude Code before approval.
Read messages emitted to the browser console.
- browser_handle_dialog
For Playwright's browser_handle_dialog, review the permission request and arguments in Claude Code before approval.
Respond to a browser dialog.
- browser_emulate_media
For Playwright's browser_emulate_media, review the permission request and arguments in Claude Code before approval.
Override CSS media settings such as the page color scheme.
- browser_evaluate
For Playwright's browser_evaluate, review the permission request and arguments in Claude Code before approval.
Evaluate JavaScript against a page or element.
- browser_file_upload
For Playwright's browser_file_upload, review the permission request and arguments in Claude Code before approval.
Supply files to an upload control.
- browser_drop
For Playwright's browser_drop, review the permission request and arguments in Claude Code before approval.
Drop local files or MIME data onto a page element.
- browser_find
For Playwright's browser_find, review the permission request and arguments in Claude Code before approval.
Find text or regex matches within the page accessibility snapshot.
- browser_fill_form
For Playwright's browser_fill_form, review the permission request and arguments in Claude Code before approval.
- browser_press_key
For Playwright's browser_press_key, review the permission request and arguments in Claude Code before approval.
- browser_type
For Playwright's browser_type, review the permission request and arguments in Claude Code before approval.
- browser_navigate
For Playwright's browser_navigate, review the permission request and arguments in Claude Code before approval.
- browser_navigate_back
For Playwright's browser_navigate_back, review the permission request and arguments in Claude Code before approval.
- browser_network_requests
For Playwright's browser_network_requests, review the permission request and arguments in Claude Code before approval.
- browser_network_request
For Playwright's browser_network_request, review the permission request and arguments in Claude Code before approval.
- browser_run_code_unsafe
For Playwright's browser_run_code_unsafe, review the permission request and arguments in Claude Code before approval.
- browser_take_screenshot
For Playwright's browser_take_screenshot, review the permission request and arguments in Claude Code before approval.
- browser_snapshot
For Playwright's browser_snapshot, review the permission request and arguments in Claude Code before approval.
- browser_click
For Playwright's browser_click, review the permission request and arguments in Claude Code before approval.
Click a page element.
- browser_drag
For Playwright's browser_drag, review the permission request and arguments in Claude Code before approval.
Drag from one page element to another.
- browser_hover
For Playwright's browser_hover, review the permission request and arguments in Claude Code before approval.
Position the pointer over an element.
- browser_select_option
For Playwright's browser_select_option, review the permission request and arguments in Claude Code before approval.
Choose an entry from a dropdown control.
- browser_tabs
For Playwright's browser_tabs, review the permission request and arguments in Claude Code before approval.
Inspect, open, switch, or close tabs.
- browser_wait_for
For Playwright's browser_wait_for, review the permission request and arguments in Claude Code before approval.
Pause for matching text, its disappearance, or an elapsed interval.
Troubleshooting Playwright in Claude Code
- If Playwright MCP fails to start, check npx @playwright/mcp@latest (Node.js/npm), the working directory, and Claude Code's selected scope; inspect claude mcp list and /mcp.
- Playwright MCP uses stdio here: Claude Code must keep the configured process running; protocol output belongs on stdout and diagnostics on stderr.
- Known limitation: Requires Node.js 18 or later.
- Known limitation: Tool schemas and accessibility trees can use more context than the separate CLI workflow.
- Known limitation: Origin filters are not a security boundary.
- General Claude Code troubleshooting lives in the /clients/claude-code guide.
Playwright MCP — details. Claude Code guide