Skip to content

Install

Add the server directly from the terminal:

bash
claude mcp add playwright npx @playwright/mcp@latest

This 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 8931

Then point your MCP client at http://localhost:8931.

Common CLI flags

FlagDefaultDescription
--browserchromiumBrowser engine: chrome, firefox, webkit, msedge
--headlessfalseRun without a visible window
--port(stdio)Enable HTTP/SSE transport on this port
--isolatedfalseIn-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-action5000 msTimeout for individual actions
--timeout-navigation60000 msTimeout 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