execute command. Use the MCP setup below only if your client doesn't support skills or you specifically need the MCP protocol.Note: CLI is the recommended way to use Playwriter. See README.md for CLI usage.
12345678{ "mcpServers": { "playwriter": { "command": "npx", "args": ["-y", "playwriter@latest"] } } }
1npx -y @playwriter/install-mcp playwriter@latest
execute tool to run Playwright codeexecute tool - run Playwright code snippetsreset tool - reconnect if connection issues occurPLAYWRITER_AUTO_ENABLEabout:blank; navigate it to any URL.PLAYWRITER_AUTO_ENABLE=false to disable and require manually enabling the extension on a tab before connecting:1234567891011{ "mcpServers": { "playwriter": { "command": "npx", "args": ["-y", "playwriter@latest"], "env": { "PLAYWRITER_AUTO_ENABLE": "false" } } } }
PLAYWRITER_DIRECT in your MCP config:1234567891011{ "mcpServers": { "playwriter": { "command": "npx", "args": ["-y", "playwriter@latest"], "env": { "PLAYWRITER_DIRECT": "1" } } } }
chrome://inspect/#remote-debugging or launch with --remote-debugging-port=9222.PLAYWRITER_DIRECT=ws://127.0.0.1:9222/devtools/browser/abc.1npx -y playwriter serve --token <secret>
12345678{ "mcpServers": { "playwriter": { "command": "npx", "args": ["-y", "playwriter@latest", "--host", "host.docker.internal", "--token", "<secret>"] } } }
123456789101112{ "mcpServers": { "playwriter": { "command": "npx", "args": ["-y", "playwriter@latest"], "env": { "PLAYWRITER_HOST": "host.docker.internal", "PLAYWRITER_TOKEN": "<secret>" } } } }
host.docker.internal for devcontainers, or your host's IP for VMs/SSH.