The following steps are required to install the Playwright MCP:
- environmental preparation: Install the latest LTS version of Node.js (e.g. v22), which can be accessed via the
node -v
verification version - global installation: Execute command
npm install -g @playwright/mcp
Or use the latest version ofnpx @playwright/mcp@latest
- Starting services: Run
npx @playwright/mcp@latest
Headed mode is enabled by default, adding--headless
Parameter Enable Headless Mode
For AI tool integration, MCP service information needs to be configured:
- Create a configuration file to specify the MCP server address
- In a Linux monitorless environment, you need to first pass the
playwright run-server
Starting the WebSocket Service - configure
PLAYWRIGHT_WS_ENDPOINT
Environment variable pointing to the WebSocket address
A full configuration example can be found in the official documentation, last updated until March 2025.
This answer comes from the articlePlaywright MCP: Browser Automation MCP Service from MicrosoftThe