37 lines
No EOL
1.1 KiB
Markdown
37 lines
No EOL
1.1 KiB
Markdown
# playwright-mcp
|
|
|
|
MCP server for browser automation via Playwright.
|
|
|
|
Source: [`@playwright/mcp`](https://npm.im/@playwright/mcp)
|
|
|
|
## Environment Variables
|
|
|
|
| Variable | Required | Description |
|
|
|----------|----------|-------------|
|
|
| `PLAYWRIGHT_MCP_HEADLESS` | No | Run headless (`true`/`false`, default: `true`) |
|
|
| `PLAYWRIGHT_MCP_BROWSER` | No | Browser to use (`firefox`, `chromium`, `webkit`, default: `chromium`) |
|
|
|
|
## Usage
|
|
|
|
This MCP runs better natively (not in a container) because it needs direct display access for headed mode and browser binaries.
|
|
|
|
```bash
|
|
npx @playwright/mcp
|
|
# or with options:
|
|
PLAYWRIGHT_MCP_HEADLESS=true PLAYWRIGHT_MCP_BROWSER=firefox npx @playwright/mcp
|
|
```
|
|
|
|
For headed mode (visible browser window), ensure a display is available and run:
|
|
|
|
```bash
|
|
PLAYWRIGHT_MCP_HEADLESS=false PLAYWRIGHT_MCP_BROWSER=firefox npx @playwright/mcp
|
|
```
|
|
|
|
## Tools
|
|
|
|
- Navigation (goto, back, forward, refresh)
|
|
- Element interaction (click, fill, select, hover)
|
|
- Screenshots (full page, element)
|
|
- Form filling and submission
|
|
- Console and network monitoring
|
|
- PDF generation |