Playwright MCP for VS Code: Setup & Config
Playwright MCP lets VS Code operate browsers using structured accessibility data.
What you can do with Playwright in VS Code
Choose structured browser interaction with persistent state and detailed inspection tools.
- Explore a website through accessibility snapshots and iterative actions.
- Inspect console errors and individual network requests.
Before you start: Playwright in VS 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 VS Code configuration
Choose VS Code configuration scope
For Playwright MCP, open Workspace: .vscode/mcp.json. Merge into servers; preserve existing inputs.
Add Playwright MCP to VS Code
Use the playwright-mcp entry below in servers. Keep Playwright MCP's documented stdio connection fields and your other VS Code entries.
Check Playwright MCP in VS Code
Playwright MCP: Start in VS Code’s MCP controls; inspect output and trust prompts.
Config file · Workspace: .vscode/mcp.json
{
"servers": {
"playwright-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"@playwright/mcp@latest"
],
"env": {}
}
}
}Playwright tools available to VS Code
Playwright's stored tool list documents 25 tools; compare it with VS Code's connected tool list, because the stored list is not a live check.
- browser_close
Look for browser_close among VS Code's agent-mode tools after starting Playwright through the MCP controls.
- browser_resize
Look for browser_resize among VS Code's agent-mode tools after starting Playwright through the MCP controls.
Change the browser window dimensions.
- browser_console_messages
Look for browser_console_messages among VS Code's agent-mode tools after starting Playwright through the MCP controls.
Read messages emitted to the browser console.
- browser_handle_dialog
Look for browser_handle_dialog among VS Code's agent-mode tools after starting Playwright through the MCP controls.
Respond to a browser dialog.
- browser_emulate_media
Look for browser_emulate_media among VS Code's agent-mode tools after starting Playwright through the MCP controls.
Override CSS media settings such as the page color scheme.
- browser_evaluate
Look for browser_evaluate among VS Code's agent-mode tools after starting Playwright through the MCP controls.
Evaluate JavaScript against a page or element.
- browser_file_upload
Look for browser_file_upload among VS Code's agent-mode tools after starting Playwright through the MCP controls.
Supply files to an upload control.
- browser_drop
Look for browser_drop among VS Code's agent-mode tools after starting Playwright through the MCP controls.
Drop local files or MIME data onto a page element.
- browser_find
Look for browser_find among VS Code's agent-mode tools after starting Playwright through the MCP controls.
- browser_fill_form
Look for browser_fill_form among VS Code's agent-mode tools after starting Playwright through the MCP controls.
- browser_press_key
Look for browser_press_key among VS Code's agent-mode tools after starting Playwright through the MCP controls.
- browser_type
Look for browser_type among VS Code's agent-mode tools after starting Playwright through the MCP controls.
- browser_navigate
Look for browser_navigate among VS Code's agent-mode tools after starting Playwright through the MCP controls.
- browser_navigate_back
Look for browser_navigate_back among VS Code's agent-mode tools after starting Playwright through the MCP controls.
Return to the preceding page in browser history.
- browser_network_requests
Look for browser_network_requests among VS Code's agent-mode tools after starting Playwright through the MCP controls.
List captured network requests with reference numbers.
- browser_network_request
Look for browser_network_request among VS Code's agent-mode tools after starting Playwright through the MCP controls.
Inspect headers or body data for a numbered network request.
- browser_run_code_unsafe
Look for browser_run_code_unsafe among VS Code's agent-mode tools after starting Playwright through the MCP controls.
Execute a Playwright snippet in the server process; this permits arbitrary JavaScript execution.
- browser_take_screenshot
Look for browser_take_screenshot among VS Code's agent-mode tools after starting Playwright through the MCP controls.
Capture a page image; use an accessibility snapshot to guide actions.
- browser_snapshot
Look for browser_snapshot among VS Code's agent-mode tools after starting Playwright through the MCP controls.
Read the current page as an accessibility tree.
- browser_click
Look for browser_click among VS Code's agent-mode tools after starting Playwright through the MCP controls.
- browser_drag
Look for browser_drag among VS Code's agent-mode tools after starting Playwright through the MCP controls.
- browser_hover
Look for browser_hover among VS Code's agent-mode tools after starting Playwright through the MCP controls.
- browser_select_option
Look for browser_select_option among VS Code's agent-mode tools after starting Playwright through the MCP controls.
- browser_tabs
Look for browser_tabs among VS Code's agent-mode tools after starting Playwright through the MCP controls.
- browser_wait_for
Look for browser_wait_for among VS Code's agent-mode tools after starting Playwright through the MCP controls.
Troubleshooting Playwright in VS Code
- Make npx @playwright/mcp@latest (Node.js/npm) available in the workspace, container, or remote environment hosting Playwright MCP. Start through VS Code's MCP controls; inspect output and trust prompts.
- Playwright MCP uses stdio here: VS 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 VS Code troubleshooting lives in the /clients/vscode guide.
Playwright MCP — details. VS Code guide