Appearance
Install
Option 1 -- Claude Code CLI (recommended)
Add the server directly from the terminal:
bash
claude mcp add playwright npx @playwright/mcp@latestThis writes the server entry into your Claude Code MCP config automatically.
Option 2 -- Manual JSON config
Add the following block to your MCP client config file (e.g. claude_desktop_config.json, VS Code settings.json, or your framework's MCP config):
json
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"]
}
}
}No global install required. npx pulls @playwright/mcp on demand.
Option 3 -- HTTP/SSE transport (remote or headless servers)
Run the server as a persistent HTTP endpoint:
bash
npx @playwright/mcp@latest --port 8931Then point your MCP client at http://localhost:8931.
Common CLI flags
| Flag | Default | Description |
|---|---|---|
--browser | chromium | Browser engine: chrome, firefox, webkit, msedge |
--headless | false | Run without a visible window |
--port | (stdio) | Enable HTTP/SSE transport on this port |
--isolated | false | In-memory profile; no disk persistence |
--user-data-dir | (system default) | Persistent browser profile path |
--allowed-hosts | (none) | Restrict which hosts the browser may reach |
--init-script | (none) | JS file(s) evaluated in every page context |
--timeout-action | 5000 ms | Timeout for individual actions |
--timeout-navigation | 60000 ms | Timeout for page navigations |
Advanced: JSON config file
For a persistent config, create a playwright-mcp.config.json and pass it with --config:
json
{
"browser": {
"browserName": "chromium",
"headless": true
},
"server": {
"port": 8931,
"host": "localhost"
}
}bash
npx @playwright/mcp@latest --config ./playwright-mcp.config.json