Sets up Playwright MCP server integration for Claude Code. Use when setting up Playwright, browser automation, web testing, scraping, or adding browser control capabilities.
Guide users through setting up a Playwright MCP server to enable Claude Code to interact with browsers for web automation, testing, and scraping.
Verify Node.js is installed (v18+ required):
node --version
Playwright requires browser binaries to be installed:
npx playwright install
This installs Chromium, Firefox, and WebKit browsers. For a smaller installation, you can install only specific browsers:
npx playwright install chromium # Chromium only
npx playwright install firefox # Firefox only
npx playwright install webkit # WebKit only
Add the official Microsoft Playwright MCP server to Claude Code using npx (no local installation needed):
claude mcp add playwright -s project -- npx @playwright/mcp@latest
IMPORTANT: After completing all setup steps, you MUST display this notice to the user:
================================================
RESTART REQUIRED
================================================
The Playwright MCP server has been configured.
Please restart Claude Code for the MCP
server to be registered and available.
After restarting:
1. Run /mcp to verify the server is connected
2. Test with: "Navigate to google.com and take a screenshot"
================================================
This notice is critical because MCP servers are only loaded when Claude Code starts.
Provide step-by-step guidance with commands the user can copy and run. After each step, confirm success before proceeding.
Always end with the restart notice - this is mandatory to ensure users know to restart Claude Code.
Browser installation failed:
npx playwright install-depsnpx playwright install chromiumNode.js issues:
node --version to verifyMCP not connecting:
/mcp shows the playwright server as connectednpx @playwright/mcp@latest --helpBrowser crashes or timeouts:
Once set up, the Playwright MCP enables Claude to:
User: "Set up Playwright MCP for my project"
Response:
npx playwright installclaude mcp add playwright -s project -- npx @playwright/mcp@latest