@quantum-ai/playwright-mcp 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,1559 @@
1
+ ## Playwright MCP
2
+
3
+ A Model Context Protocol (MCP) server that provides browser automation capabilities using [Playwright](https://playwright.dev). This server enables LLMs to interact with web pages through structured accessibility snapshots, bypassing the need for screenshots or visually-tuned models.
4
+
5
+ ### Playwright MCP vs Playwright CLI
6
+
7
+ This package provides MCP interface into Playwright. If you are using a **coding agent**, you might benefit from using the [CLI+SKILLS](https://github.com/microsoft/playwright-cli) instead.
8
+
9
+ - **CLI**: Modern **coding agents** increasingly favor CLI–based workflows exposed as SKILLs over MCP because CLI invocations are more token-efficient: they avoid loading large tool schemas and verbose accessibility trees into the model context, allowing agents to act through concise, purpose-built commands. This makes CLI + SKILLs better suited for high-throughput coding agents that must balance browser automation with large codebases, tests, and reasoning within limited context windows.<br>**Learn more about [Playwright CLI with SKILLS](https://github.com/microsoft/playwright-cli)**.
10
+
11
+ - **MCP**: MCP remains relevant for specialized agentic loops that benefit from persistent state, rich introspection, and iterative reasoning over page structure, such as exploratory automation, self-healing tests, or long-running autonomous workflows where maintaining continuous browser context outweighs token cost concerns.
12
+
13
+ ### Key Features
14
+
15
+ - **Fast and lightweight**. Uses Playwright's accessibility tree, not pixel-based input.
16
+ - **LLM-friendly**. No vision models needed, operates purely on structured data.
17
+ - **Deterministic tool application**. Avoids ambiguity common with screenshot-based approaches.
18
+
19
+ ### Requirements
20
+ - Node.js 18 or newer
21
+ - VS Code, Cursor, Windsurf, Claude Desktop, Goose, Junie or any other MCP client
22
+
23
+ <!--
24
+ // Generate using:
25
+ node utils/generate-links.js
26
+ -->
27
+
28
+ ### Getting started
29
+
30
+ First, install the Playwright MCP server with your client.
31
+
32
+ **Standard config** works in most of the tools:
33
+
34
+ ```js
35
+ {
36
+ "mcpServers": {
37
+ "playwright": {
38
+ "command": "npx",
39
+ "args": [
40
+ "@playwright/mcp@latest"
41
+ ]
42
+ }
43
+ }
44
+ }
45
+ ```
46
+
47
+ [<img src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Server&color=0098FF" alt="Install in VS Code">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522playwright%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522%2540playwright%252Fmcp%2540latest%2522%255D%257D) [<img alt="Install in VS Code Insiders" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Install%20Server&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522playwright%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522%2540playwright%252Fmcp%2540latest%2522%255D%257D)
48
+
49
+ <details>
50
+ <summary>Amp</summary>
51
+
52
+ Add via the Amp VS Code extension settings screen or by updating your settings.json file:
53
+
54
+ ```json
55
+ "amp.mcpServers": {
56
+ "playwright": {
57
+ "command": "npx",
58
+ "args": [
59
+ "@playwright/mcp@latest"
60
+ ]
61
+ }
62
+ }
63
+ ```
64
+
65
+ **Amp CLI Setup:**
66
+
67
+ Add via the `amp mcp add`command below
68
+
69
+ ```bash
70
+ amp mcp add playwright -- npx @playwright/mcp@latest
71
+ ```
72
+
73
+ </details>
74
+
75
+ <details>
76
+ <summary>Antigravity</summary>
77
+
78
+ Add via the Antigravity settings or by updating your configuration file:
79
+
80
+ ```json
81
+ {
82
+ "mcpServers": {
83
+ "playwright": {
84
+ "command": "npx",
85
+ "args": [
86
+ "@playwright/mcp@latest"
87
+ ]
88
+ }
89
+ }
90
+ }
91
+ ```
92
+
93
+ </details>
94
+
95
+ <details>
96
+ <summary>Claude Code</summary>
97
+
98
+ Use the Claude Code CLI to add the Playwright MCP server:
99
+
100
+ ```bash
101
+ claude mcp add playwright npx @playwright/mcp@latest
102
+ ```
103
+ </details>
104
+
105
+ <details>
106
+ <summary>Claude Desktop</summary>
107
+
108
+ Follow the MCP install [guide](https://modelcontextprotocol.io/quickstart/user), use the standard config above.
109
+
110
+ </details>
111
+
112
+ <details>
113
+ <summary>Cline</summary>
114
+
115
+ Follow the instruction in the section [Configuring MCP Servers](https://docs.cline.bot/mcp/configuring-mcp-servers)
116
+
117
+ **Example: Local Setup**
118
+
119
+ Add the following to your [`cline_mcp_settings.json`](https://docs.cline.bot/mcp/configuring-mcp-servers#editing-mcp-settings-files) file:
120
+
121
+ ```json
122
+ {
123
+ "mcpServers": {
124
+ "playwright": {
125
+ "type": "stdio",
126
+ "command": "npx",
127
+ "timeout": 30,
128
+ "args": [
129
+ "-y",
130
+ "@playwright/mcp@latest"
131
+ ],
132
+ "disabled": false
133
+ }
134
+ }
135
+ }
136
+ ```
137
+
138
+ </details>
139
+
140
+ <details>
141
+ <summary>Codex</summary>
142
+
143
+ Use the Codex CLI to add the Playwright MCP server:
144
+
145
+ ```bash
146
+ codex mcp add playwright npx "@playwright/mcp@latest"
147
+ ```
148
+
149
+ Alternatively, create or edit the configuration file `~/.codex/config.toml` and add:
150
+
151
+ ```toml
152
+ [mcp_servers.playwright]
153
+ command = "npx"
154
+ args = ["@playwright/mcp@latest"]
155
+ ```
156
+
157
+ For more information, see the [Codex MCP documentation](https://github.com/openai/codex/blob/main/codex-rs/config.md#mcp_servers).
158
+
159
+ </details>
160
+
161
+ <details>
162
+ <summary>Copilot</summary>
163
+
164
+ Use the Copilot CLI to interactively add the Playwright MCP server:
165
+
166
+ ```bash
167
+ /mcp add
168
+ ```
169
+
170
+ Alternatively, create or edit the configuration file `~/.copilot/mcp-config.json` and add:
171
+
172
+ ```json
173
+ {
174
+ "mcpServers": {
175
+ "playwright": {
176
+ "type": "local",
177
+ "command": "npx",
178
+ "tools": [
179
+ "*"
180
+ ],
181
+ "args": [
182
+ "@playwright/mcp@latest"
183
+ ]
184
+ }
185
+ }
186
+ }
187
+ ```
188
+
189
+ For more information, see the [Copilot CLI documentation](https://docs.github.com/en/copilot/concepts/agents/about-copilot-cli).
190
+
191
+ </details>
192
+
193
+ <details>
194
+ <summary>Cursor</summary>
195
+
196
+ #### Click the button to install:
197
+
198
+ [<img src="https://cursor.com/deeplink/mcp-install-dark.svg" alt="Install in Cursor">](https://cursor.com/en/install-mcp?name=Playwright&config=eyJjb21tYW5kIjoibnB4IEBwbGF5d3JpZ2h0L21jcEBsYXRlc3QifQ%3D%3D)
199
+
200
+ #### Or install manually:
201
+
202
+ Go to `Cursor Settings` -> `MCP` -> `Add new MCP Server`. Name to your liking, use `command` type with the command `npx @playwright/mcp@latest`. You can also verify config or add command like arguments via clicking `Edit`.
203
+
204
+ </details>
205
+
206
+ <details>
207
+ <summary>Factory</summary>
208
+
209
+ Use the Factory CLI to add the Playwright MCP server:
210
+
211
+ ```bash
212
+ droid mcp add playwright "npx @playwright/mcp@latest"
213
+ ```
214
+
215
+ Alternatively, type `/mcp` within Factory droid to open an interactive UI for managing MCP servers.
216
+
217
+ For more information, see the [Factory MCP documentation](https://docs.factory.ai/cli/configuration/mcp).
218
+
219
+ </details>
220
+
221
+ <details>
222
+ <summary>Gemini CLI</summary>
223
+
224
+ Follow the MCP install [guide](https://github.com/google-gemini/gemini-cli/blob/main/docs/tools/mcp-server.md#configure-the-mcp-server-in-settingsjson), use the standard config above.
225
+
226
+ </details>
227
+
228
+ <details>
229
+ <summary>Goose</summary>
230
+
231
+ #### Click the button to install:
232
+
233
+ [![Install in Goose](https://block.github.io/goose/img/extension-install-dark.svg)](https://block.github.io/goose/extension?cmd=npx&arg=%40playwright%2Fmcp%40latest&id=playwright&name=Playwright&description=Interact%20with%20web%20pages%20through%20structured%20accessibility%20snapshots%20using%20Playwright)
234
+
235
+ #### Or install manually:
236
+
237
+ Go to `Advanced settings` -> `Extensions` -> `Add custom extension`. Name to your liking, use type `STDIO`, and set the `command` to `npx @playwright/mcp`. Click "Add Extension".
238
+ </details>
239
+
240
+ <details>
241
+ <summary>Junie</summary>
242
+
243
+ To add the Playwright MCP server in Junie CLI:
244
+
245
+ 1. Type `/mcp`
246
+ 2. Press `Ctrl+A` to add a new MCP server
247
+ 3. Select **Playwright** from the list
248
+
249
+ Alternatively, add to `.junie/mcp/mcp.json`:
250
+
251
+ ```json
252
+ {
253
+ "mcpServers": {
254
+ "Playwright": {
255
+ "command": "npx",
256
+ "args": [
257
+ "-y",
258
+ "@playwright/mcp@latest"
259
+ ]
260
+ }
261
+ }
262
+ }
263
+ ```
264
+
265
+ For more information, see the [Junie MCP configuration documentation](https://junie.jetbrains.com/docs/junie-cli-mcp-configuration.html).
266
+
267
+ </details>
268
+
269
+ <details>
270
+ <summary>Kiro</summary>
271
+
272
+ [![Add to Kiro](https://kiro.dev/images/add-to-kiro.svg)](https://kiro.dev/launch/mcp/add?name=playwright&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22%40playwright%2Fmcp%40latest%22%5D%7D)
273
+
274
+ Follow the MCP Servers [documentation](https://kiro.dev/docs/mcp/). For example in `.kiro/settings/mcp.json`:
275
+
276
+ ```json
277
+ {
278
+ "mcpServers": {
279
+ "playwright": {
280
+ "command": "npx",
281
+ "args": [
282
+ "@playwright/mcp@latest"
283
+ ]
284
+ }
285
+ }
286
+ }
287
+ ```
288
+ </details>
289
+
290
+ <details>
291
+ <summary>LM Studio</summary>
292
+
293
+ #### Click the button to install:
294
+
295
+ [![Add MCP Server playwright to LM Studio](https://files.lmstudio.ai/deeplink/mcp-install-light.svg)](https://lmstudio.ai/install-mcp?name=playwright&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyJAcGxheXdyaWdodC9tY3BAbGF0ZXN0Il19)
296
+
297
+ #### Or install manually:
298
+
299
+ Go to `Program` in the right sidebar -> `Install` -> `Edit mcp.json`. Use the standard config above.
300
+ </details>
301
+
302
+ <details>
303
+ <summary>opencode</summary>
304
+
305
+ Follow the MCP Servers [documentation](https://opencode.ai/docs/mcp-servers/). For example in `~/.config/opencode/opencode.json`:
306
+
307
+ ```json
308
+ {
309
+ "$schema": "https://opencode.ai/config.json",
310
+ "mcp": {
311
+ "playwright": {
312
+ "type": "local",
313
+ "command": [
314
+ "npx",
315
+ "@playwright/mcp@latest"
316
+ ],
317
+ "enabled": true
318
+ }
319
+ }
320
+ }
321
+
322
+ ```
323
+ </details>
324
+
325
+ <details>
326
+ <summary>Qodo Gen</summary>
327
+
328
+ Open [Qodo Gen](https://docs.qodo.ai/qodo-documentation/qodo-gen) chat panel in VSCode or IntelliJ → Connect more tools → + Add new MCP → Paste the standard config above.
329
+
330
+ Click <code>Save</code>.
331
+ </details>
332
+
333
+ <details>
334
+ <summary>VS Code</summary>
335
+
336
+ #### Click the button to install:
337
+
338
+ [<img src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Server&color=0098FF" alt="Install in VS Code">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522playwright%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522%2540playwright%252Fmcp%2540latest%2522%255D%257D) [<img alt="Install in VS Code Insiders" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Install%20Server&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522playwright%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522%2540playwright%252Fmcp%2540latest%2522%255D%257D)
339
+
340
+ #### Or install manually:
341
+
342
+ Follow the MCP install [guide](https://code.visualstudio.com/docs/copilot/chat/mcp-servers#_add-an-mcp-server), use the standard config above. You can also install the Playwright MCP server using the VS Code CLI:
343
+
344
+ ```bash
345
+ # For VS Code
346
+ code --add-mcp '{"name":"playwright","command":"npx","args":["@playwright/mcp@latest"]}'
347
+ ```
348
+
349
+ After installation, the Playwright MCP server will be available for use with your GitHub Copilot agent in VS Code.
350
+ </details>
351
+
352
+ <details>
353
+ <summary>Warp</summary>
354
+
355
+ Go to `Settings` -> `AI` -> `Manage MCP Servers` -> `+ Add` to [add an MCP Server](https://docs.warp.dev/knowledge-and-collaboration/mcp#adding-an-mcp-server). Use the standard config above.
356
+
357
+ Alternatively, use the slash command `/add-mcp` in the Warp prompt and paste the standard config from above:
358
+ ```js
359
+ {
360
+ "mcpServers": {
361
+ "playwright": {
362
+ "command": "npx",
363
+ "args": [
364
+ "@playwright/mcp@latest"
365
+ ]
366
+ }
367
+ }
368
+ }
369
+ ```
370
+
371
+ </details>
372
+
373
+ <details>
374
+ <summary>Windsurf</summary>
375
+
376
+ Follow Windsurf MCP [documentation](https://docs.windsurf.com/windsurf/cascade/mcp). Use the standard config above.
377
+
378
+ </details>
379
+
380
+ ### Configuration
381
+
382
+ Playwright MCP server supports following arguments. They can be provided in the JSON configuration above, as a part of the `"args"` list:
383
+
384
+ <!--- Options generated by update-readme.js -->
385
+
386
+ | Option | Description |
387
+ |--------|-------------|
388
+ | --allowed-hosts <hosts...> | comma-separated list of hosts this server is allowed to serve from. Defaults to the host the server is bound to. Pass '*' to disable the host check.<br>*env* `PLAYWRIGHT_MCP_ALLOWED_HOSTS` |
389
+ | --allowed-origins <origins> | semicolon-separated list of TRUSTED origins to allow the browser to request. Default is to allow all. Important: *does not* serve as a security boundary and *does not* affect redirects.<br>*env* `PLAYWRIGHT_MCP_ALLOWED_ORIGINS` |
390
+ | --allow-unrestricted-file-access | allow access to files outside of the workspace roots. Also allows unrestricted access to file:// URLs. By default access to file system is restricted to workspace root directories (or cwd if no roots are configured) only, and navigation to file:// URLs is blocked.<br>*env* `PLAYWRIGHT_MCP_ALLOW_UNRESTRICTED_FILE_ACCESS` |
391
+ | --blocked-origins <origins> | semicolon-separated list of origins to block the browser from requesting. Blocklist is evaluated before allowlist. If used without the allowlist, requests not matching the blocklist are still allowed. Important: *does not* serve as a security boundary and *does not* affect redirects.<br>*env* `PLAYWRIGHT_MCP_BLOCKED_ORIGINS` |
392
+ | --block-service-workers | block service workers<br>*env* `PLAYWRIGHT_MCP_BLOCK_SERVICE_WORKERS` |
393
+ | --browser <browser> | browser or chrome channel to use, possible values: chrome, firefox, webkit, msedge.<br>*env* `PLAYWRIGHT_MCP_BROWSER` |
394
+ | --caps <caps> | comma-separated list of additional capabilities to enable, possible values: vision, pdf, devtools.<br>*env* `PLAYWRIGHT_MCP_CAPS` |
395
+ | --cdp-endpoint <endpoint> | CDP endpoint to connect to.<br>*env* `PLAYWRIGHT_MCP_CDP_ENDPOINT` |
396
+ | --cdp-header <headers...> | CDP headers to send with the connect request, multiple can be specified.<br>*env* `PLAYWRIGHT_MCP_CDP_HEADERS` |
397
+ | --cdp-timeout <timeout> | timeout in milliseconds for connecting to CDP endpoint, defaults to 30000ms<br>*env* `PLAYWRIGHT_MCP_CDP_TIMEOUT` |
398
+ | --codegen <lang> | specify the language to use for code generation, possible values: "typescript", "none". Default is "typescript".<br>*env* `PLAYWRIGHT_MCP_CODEGEN` |
399
+ | --config <path> | path to the configuration file.<br>*env* `PLAYWRIGHT_MCP_CONFIG` |
400
+ | --console-level <level> | level of console messages to return: "error", "warning", "info", "debug". Each level includes the messages of more severe levels.<br>*env* `PLAYWRIGHT_MCP_CONSOLE_LEVEL` |
401
+ | --device <device> | device to emulate, for example: "iPhone 15"<br>*env* `PLAYWRIGHT_MCP_DEVICE` |
402
+ | --executable-path <path> | path to the browser executable.<br>*env* `PLAYWRIGHT_MCP_EXECUTABLE_PATH` |
403
+ | --extension | Connect to a running browser instance (Edge/Chrome only). Requires the "Playwright Extension" to be installed.<br>*env* `PLAYWRIGHT_MCP_EXTENSION` |
404
+ | --endpoint <endpoint> | Bound browser endpoint to connect to.<br>*env* `PLAYWRIGHT_MCP_ENDPOINT` |
405
+ | --grant-permissions <permissions...> | List of permissions to grant to the browser context, for example "geolocation", "clipboard-read", "clipboard-write".<br>*env* `PLAYWRIGHT_MCP_GRANT_PERMISSIONS` |
406
+ | --headless | run browser in headless mode, headed by default<br>*env* `PLAYWRIGHT_MCP_HEADLESS` |
407
+ | --host <host> | host to bind server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces.<br>*env* `PLAYWRIGHT_MCP_HOST` |
408
+ | --ignore-https-errors | ignore https errors<br>*env* `PLAYWRIGHT_MCP_IGNORE_HTTPS_ERRORS` |
409
+ | --init-page <path...> | path to TypeScript file to evaluate on Playwright page object<br>*env* `PLAYWRIGHT_MCP_INIT_PAGE` |
410
+ | --init-script <path...> | path to JavaScript file to add as an initialization script. The script will be evaluated in every page before any of the page's scripts. Can be specified multiple times.<br>*env* `PLAYWRIGHT_MCP_INIT_SCRIPT` |
411
+ | --isolated | keep the browser profile in memory, do not save it to disk.<br>*env* `PLAYWRIGHT_MCP_ISOLATED` |
412
+ | --image-responses <mode> | whether to send image responses to the client. Can be "allow" or "omit", Defaults to "allow".<br>*env* `PLAYWRIGHT_MCP_IMAGE_RESPONSES` |
413
+ | --no-sandbox | disable the sandbox for all process types that are normally sandboxed.<br>*env* `PLAYWRIGHT_MCP_NO_SANDBOX` |
414
+ | --output-dir <path> | path to the directory for output files.<br>*env* `PLAYWRIGHT_MCP_OUTPUT_DIR` |
415
+ | --output-max-size <bytes> | Threshold for evicting old output files, in bytes.<br>*env* `PLAYWRIGHT_MCP_OUTPUT_MAX_SIZE` |
416
+ | --output-mode <mode> | whether to save snapshots, console messages, network logs to a file or to the standard output. Can be "file" or "stdout". Default is "stdout".<br>*env* `PLAYWRIGHT_MCP_OUTPUT_MODE` |
417
+ | --port <port> | port to listen on for SSE transport.<br>*env* `PLAYWRIGHT_MCP_PORT` |
418
+ | --proxy-bypass <bypass> | comma-separated domains to bypass proxy, for example ".com,chromium.org,.domain.com"<br>*env* `PLAYWRIGHT_MCP_PROXY_BYPASS` |
419
+ | --proxy-server <proxy> | specify proxy server, for example "http://myproxy:3128" or "socks5://myproxy:8080"<br>*env* `PLAYWRIGHT_MCP_PROXY_SERVER` |
420
+ | --sandbox | enable the sandbox for all process types that are normally not sandboxed.<br>*env* `PLAYWRIGHT_MCP_SANDBOX` |
421
+ | --save-session | Whether to save the Playwright MCP session into the output directory.<br>*env* `PLAYWRIGHT_MCP_SAVE_SESSION` |
422
+ | --secrets <path> | path to a file containing secrets in the dotenv format<br>*env* `PLAYWRIGHT_MCP_SECRETS_FILE` |
423
+ | --shared-browser-context | reuse the same browser context between all connected HTTP clients.<br>*env* `PLAYWRIGHT_MCP_SHARED_BROWSER_CONTEXT` |
424
+ | --snapshot-mode <mode> | when taking snapshots for responses, specifies the mode to use. Can be "full" or "none". Default is "full".<br>*env* `PLAYWRIGHT_MCP_SNAPSHOT_MODE` |
425
+ | --storage-state <path> | path to the storage state file for isolated sessions.<br>*env* `PLAYWRIGHT_MCP_STORAGE_STATE` |
426
+ | --test-id-attribute <attribute> | specify the attribute to use for test ids, defaults to "data-testid"<br>*env* `PLAYWRIGHT_MCP_TEST_ID_ATTRIBUTE` |
427
+ | --timeout-action <timeout> | specify action timeout in milliseconds, defaults to 5000ms<br>*env* `PLAYWRIGHT_MCP_TIMEOUT_ACTION` |
428
+ | --timeout-navigation <timeout> | specify navigation timeout in milliseconds, defaults to 60000ms<br>*env* `PLAYWRIGHT_MCP_TIMEOUT_NAVIGATION` |
429
+ | --user-agent <ua string> | specify user agent string<br>*env* `PLAYWRIGHT_MCP_USER_AGENT` |
430
+ | --user-data-dir <path> | path to the user data directory. If not specified, a temporary directory will be created.<br>*env* `PLAYWRIGHT_MCP_USER_DATA_DIR` |
431
+ | --viewport-size <size> | specify browser viewport size in pixels, for example "1280x720"<br>*env* `PLAYWRIGHT_MCP_VIEWPORT_SIZE` |
432
+
433
+ <!--- End of options generated section -->
434
+
435
+ ### User profile
436
+
437
+ You can run Playwright MCP with persistent profile like a regular browser (default), in isolated contexts for testing sessions, or connect to your existing browser using the browser extension.
438
+
439
+ **Persistent profile**
440
+
441
+ All the logged in information will be stored in the persistent profile, you can delete it between sessions if you'd like to clear the offline state.
442
+ Persistent profile is located at the following locations and you can override it with the `--user-data-dir` argument.
443
+
444
+ ```bash
445
+ # Windows
446
+ %USERPROFILE%\AppData\Local\ms-playwright\mcp-{channel}-{workspace-hash}
447
+
448
+ # macOS
449
+ - ~/Library/Caches/ms-playwright/mcp-{channel}-{workspace-hash}
450
+
451
+ # Linux
452
+ - ~/.cache/ms-playwright/mcp-{channel}-{workspace-hash}
453
+ ```
454
+
455
+ `{workspace-hash}` is derived from the MCP client's workspace root, so different projects get separate profiles automatically.
456
+
457
+ > [!IMPORTANT]
458
+ > A persistent profile can only be used by one browser instance at a time, so concurrent MCP clients sharing the same workspace will conflict. To run several clients in parallel, start each additional client with `--isolated` or point it at a distinct `--user-data-dir`.
459
+
460
+ **Isolated**
461
+
462
+ In the isolated mode, each session is started in the isolated profile. Every time you ask MCP to close the browser,
463
+ the session is closed and all the storage state for this session is lost. You can provide initial storage state
464
+ to the browser via the config's `contextOptions` or via the `--storage-state` argument. Learn more about the storage
465
+ state [here](https://playwright.dev/docs/auth).
466
+
467
+ ```js
468
+ {
469
+ "mcpServers": {
470
+ "playwright": {
471
+ "command": "npx",
472
+ "args": [
473
+ "@playwright/mcp@latest",
474
+ "--isolated",
475
+ "--storage-state={path/to/storage.json}"
476
+ ]
477
+ }
478
+ }
479
+ }
480
+ ```
481
+
482
+ **Browser Extension**
483
+
484
+ The Playwright MCP Chrome Extension allows you to connect to existing browser tabs and leverage your logged-in sessions and browser state. See [microsoft/playwright › packages/extension](https://github.com/microsoft/playwright/tree/main/packages/extension#readme) for installation and setup instructions.
485
+
486
+ ### Initial state
487
+
488
+ There are multiple ways to provide the initial state to the browser context or a page.
489
+
490
+ For the storage state, you can either:
491
+ - Start with a user data directory using the `--user-data-dir` argument. This will persist all browser data between the sessions.
492
+ - Start with a storage state file using the `--storage-state` argument. This will load cookies and local storage from the file into an isolated browser context.
493
+
494
+ For the page state, you can use:
495
+
496
+ - `--init-page` to point to a TypeScript file that will be evaluated on the Playwright page object. This allows you to run arbitrary code to set up the page.
497
+
498
+ ```ts
499
+ // init-page.ts
500
+ export default async ({ page }) => {
501
+ await page.context().grantPermissions(['geolocation']);
502
+ await page.context().setGeolocation({ latitude: 37.7749, longitude: -122.4194 });
503
+ await page.setViewportSize({ width: 1280, height: 720 });
504
+ };
505
+ ```
506
+
507
+ - `--init-script` to point to a JavaScript file that will be added as an initialization script. The script will be evaluated in every page before any of the page's scripts.
508
+ This is useful for overriding browser APIs or setting up the environment.
509
+
510
+ ```js
511
+ // init-script.js
512
+ window.isPlaywrightMCP = true;
513
+ ```
514
+
515
+ ### Configuration file
516
+
517
+ The Playwright MCP server can be configured using a JSON configuration file. You can specify the configuration file
518
+ using the `--config` command line option:
519
+
520
+ ```bash
521
+ npx @playwright/mcp@latest --config path/to/config.json
522
+ ```
523
+
524
+ <details>
525
+ <summary>Configuration file schema</summary>
526
+
527
+ <!--- Config generated by update-readme.js -->
528
+
529
+ ```typescript
530
+ {
531
+ /**
532
+ * The browser to use.
533
+ */
534
+ browser?: {
535
+ /**
536
+ * The type of browser to use.
537
+ */
538
+ browserName?: 'chromium' | 'firefox' | 'webkit';
539
+
540
+ /**
541
+ * Keep the browser profile in memory, do not save it to disk.
542
+ */
543
+ isolated?: boolean;
544
+
545
+ /**
546
+ * Path to a user data directory for browser profile persistence.
547
+ * Temporary directory is created by default.
548
+ */
549
+ userDataDir?: string;
550
+
551
+ /**
552
+ * Launch options passed to
553
+ * @see https://playwright.dev/docs/api/class-browsertype#browser-type-launch-persistent-context
554
+ *
555
+ * This is useful for settings options like `channel`, `headless`, `executablePath`, etc.
556
+ */
557
+ launchOptions?: playwright.LaunchOptions;
558
+
559
+ /**
560
+ * Context options for the browser context.
561
+ *
562
+ * This is useful for settings options like `viewport`.
563
+ */
564
+ contextOptions?: playwright.BrowserContextOptions;
565
+
566
+ /**
567
+ * Chrome DevTools Protocol endpoint to connect to an existing browser instance in case of Chromium family browsers.
568
+ */
569
+ cdpEndpoint?: string;
570
+
571
+ /**
572
+ * CDP headers to send with the connect request.
573
+ */
574
+ cdpHeaders?: Record<string, string>;
575
+
576
+ /**
577
+ * Timeout in milliseconds for connecting to CDP endpoint. Defaults to 30000 (30 seconds). Pass 0 to disable timeout.
578
+ */
579
+ cdpTimeout?: number;
580
+
581
+ /**
582
+ * Remote endpoint to connect to an existing Playwright server. May be a
583
+ * WebSocket URL string, or a [ConnectOptions] object that mirrors the
584
+ * `connectOptions` shape used by the test runner. When passed as an object,
585
+ * `exposeNetwork`, `headers`, `slowMo`, and `timeout` are forwarded to the
586
+ * underlying connect call.
587
+ */
588
+ remoteEndpoint?: string | playwright.ConnectOptions & { endpoint: string };
589
+
590
+ /**
591
+ * Paths to TypeScript files to add as initialization scripts for Playwright page.
592
+ */
593
+ initPage?: string[];
594
+
595
+ /**
596
+ * Paths to JavaScript files to add as initialization scripts.
597
+ * The scripts will be evaluated in every page before any of the page's scripts.
598
+ */
599
+ initScript?: string[];
600
+ },
601
+
602
+ /**
603
+ * Connect to a running browser instance (Edge/Chrome only). If specified, `browser`
604
+ * config is ignored.
605
+ * Requires the "Playwright Extension" to be installed.
606
+ */
607
+ extension?: boolean;
608
+
609
+ server?: {
610
+ /**
611
+ * The port to listen on for SSE or MCP transport.
612
+ */
613
+ port?: number;
614
+
615
+ /**
616
+ * The host to bind the server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces.
617
+ */
618
+ host?: string;
619
+
620
+ /**
621
+ * The hosts this server is allowed to serve from. Defaults to the host server is bound to.
622
+ * This is not for CORS, but rather for the DNS rebinding protection.
623
+ */
624
+ allowedHosts?: string[];
625
+ },
626
+
627
+ /**
628
+ * List of enabled tool capabilities. Possible values:
629
+ * - 'core': Core browser automation features.
630
+ * - 'pdf': PDF generation and manipulation.
631
+ * - 'vision': Coordinate-based interactions.
632
+ * - 'devtools': Developer tools features.
633
+ */
634
+ capabilities?: ToolCapability[];
635
+
636
+ /**
637
+ * Whether to save the Playwright session into the output directory.
638
+ */
639
+ saveSession?: boolean;
640
+
641
+ /**
642
+ * Reuse the same browser context between all connected HTTP clients.
643
+ */
644
+ sharedBrowserContext?: boolean;
645
+
646
+ /**
647
+ * Secrets are used to replace matching plain text in the tool responses to prevent the LLM
648
+ * from accidentally getting sensitive data. It is a convenience and not a security feature,
649
+ * make sure to always examine information coming in and from the tool on the client.
650
+ */
651
+ secrets?: Record<string, string>;
652
+
653
+ /**
654
+ * The directory to save output files.
655
+ */
656
+ outputDir?: string;
657
+
658
+ /**
659
+ * Threshold for evicting old output files, in bytes.
660
+ */
661
+ outputMaxSize?: number;
662
+
663
+ console?: {
664
+ /**
665
+ * The level of console messages to return. Each level includes the messages of more severe levels. Defaults to "info".
666
+ */
667
+ level?: 'error' | 'warning' | 'info' | 'debug';
668
+ },
669
+
670
+ network?: {
671
+ /**
672
+ * List of origins to allow the browser to request. Default is to allow all. Origins matching both `allowedOrigins` and `blockedOrigins` will be blocked.
673
+ *
674
+ * Supported formats:
675
+ * - Full origin: `https://example.com:8080` - matches only that origin
676
+ * - Wildcard port: `http://localhost:*` - matches any port on localhost with http protocol
677
+ */
678
+ allowedOrigins?: string[];
679
+
680
+ /**
681
+ * List of origins to block the browser to request. Origins matching both `allowedOrigins` and `blockedOrigins` will be blocked.
682
+ *
683
+ * Supported formats:
684
+ * - Full origin: `https://example.com:8080` - matches only that origin
685
+ * - Wildcard port: `http://localhost:*` - matches any port on localhost with http protocol
686
+ */
687
+ blockedOrigins?: string[];
688
+ };
689
+
690
+ /**
691
+ * Specify the attribute to use for test ids, defaults to "data-testid".
692
+ */
693
+ testIdAttribute?: string;
694
+
695
+ timeouts?: {
696
+ /*
697
+ * Configures default action timeout: https://playwright.dev/docs/api/class-page#page-set-default-timeout. Defaults to 5000ms.
698
+ */
699
+ action?: number;
700
+
701
+ /*
702
+ * Configures default navigation timeout: https://playwright.dev/docs/api/class-page#page-set-default-navigation-timeout. Defaults to 60000ms.
703
+ */
704
+ navigation?: number;
705
+
706
+ /**
707
+ * Configures default expect timeout: https://playwright.dev/docs/test-timeouts#expect-timeout. Defaults to 5000ms.
708
+ */
709
+ expect?: number;
710
+ };
711
+
712
+ /**
713
+ * Whether to send image responses to the client. Can be "allow", "omit", or "auto". Defaults to "auto", which sends images if the client can display them.
714
+ */
715
+ imageResponses?: 'allow' | 'omit';
716
+
717
+ snapshot?: {
718
+ /**
719
+ * When taking snapshots for responses, specifies the mode to use.
720
+ */
721
+ mode?: 'full' | 'none';
722
+ };
723
+
724
+ /**
725
+ * allowUnrestrictedFileAccess acts as a guardrail to prevent the LLM from accidentally
726
+ * wandering outside its intended workspace. It is a convenience defense to catch unintended
727
+ * file access, not a secure boundary; a deliberate attempt to reach other directories can be
728
+ * easily worked around, so always rely on client-level permissions for true security.
729
+ */
730
+ allowUnrestrictedFileAccess?: boolean;
731
+
732
+ /**
733
+ * Specify the language to use for code generation.
734
+ */
735
+ codegen?: 'typescript' | 'none';
736
+ }
737
+ ```
738
+
739
+ <!--- End of config generated section -->
740
+
741
+ </details>
742
+
743
+ ### Standalone MCP server
744
+
745
+ When running headed browser on system w/o display or from worker processes of the IDEs,
746
+ run the MCP server from environment with the DISPLAY and pass the `--port` flag to enable HTTP transport.
747
+
748
+ ```bash
749
+ npx @playwright/mcp@latest --port 8931
750
+ ```
751
+
752
+ And then in MCP client config, set the `url` to the HTTP endpoint:
753
+
754
+ ```js
755
+ {
756
+ "mcpServers": {
757
+ "playwright": {
758
+ "url": "http://localhost:8931/mcp"
759
+ }
760
+ }
761
+ }
762
+ ```
763
+
764
+ ## Security
765
+
766
+ Playwright MCP is **not** a security boundary. See [MCP Security Best Practices](https://modelcontextprotocol.io/docs/tutorials/security/security_best_practices) for guidance on securing your deployment.
767
+
768
+ <details>
769
+ <summary><b>Docker</b></summary>
770
+
771
+ **NOTE:** The Docker implementation only supports headless chromium at the moment.
772
+
773
+ ```js
774
+ {
775
+ "mcpServers": {
776
+ "playwright": {
777
+ "command": "docker",
778
+ "args": ["run", "-i", "--rm", "--init", "--pull=always", "mcr.microsoft.com/playwright/mcp"]
779
+ }
780
+ }
781
+ }
782
+ ```
783
+
784
+ Or If you prefer to run the container as a long-lived service instead of letting the MCP client spawn it, use:
785
+
786
+ ```
787
+ docker run -d -i --rm --init --pull=always \
788
+ --entrypoint node \
789
+ --name playwright \
790
+ -p 8931:8931 \
791
+ mcr.microsoft.com/playwright/mcp \
792
+ /app/cli.js --headless --browser chromium --no-sandbox --port 8931 --host 0.0.0.0
793
+ ```
794
+
795
+ The server will listen on host port **8931** and can be reached by any MCP client.
796
+
797
+ You can build the Docker image yourself.
798
+
799
+ ```
800
+ docker build -t mcr.microsoft.com/playwright/mcp .
801
+ ```
802
+ </details>
803
+
804
+ <details>
805
+ <summary><b>Programmatic usage</b></summary>
806
+
807
+ ```js
808
+ import http from 'http';
809
+
810
+ import { createConnection } from '@playwright/mcp';
811
+ import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
812
+
813
+ http.createServer(async (req, res) => {
814
+ // ...
815
+
816
+ // Creates a headless Playwright MCP server with SSE transport
817
+ const connection = await createConnection({ browser: { launchOptions: { headless: true } } });
818
+ const transport = new SSEServerTransport('/messages', res);
819
+ await connection.connect(transport);
820
+
821
+ // ...
822
+ });
823
+ ```
824
+ </details>
825
+
826
+ ### Tools
827
+
828
+ <!--- Tools generated by update-readme.js -->
829
+
830
+ <details>
831
+ <summary><b>Core automation</b></summary>
832
+
833
+ <!-- NOTE: This has been generated via update-readme.js -->
834
+
835
+ - **browser_click**
836
+ - Title: Click
837
+ - Description: Perform click on a web page
838
+ - Parameters:
839
+ - `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
840
+ - `target` (string): Exact target element reference from the page snapshot, or a unique element selector
841
+ - `doubleClick` (boolean, optional): Whether to perform a double click instead of a single click
842
+ - `button` (string, optional): Button to click, defaults to left
843
+ - `modifiers` (array, optional): Modifier keys to press
844
+ - Read-only: **false**
845
+
846
+ <!-- NOTE: This has been generated via update-readme.js -->
847
+
848
+ - **browser_close**
849
+ - Title: Close browser
850
+ - Description: Close the page
851
+ - Parameters: None
852
+ - Read-only: **false**
853
+
854
+ <!-- NOTE: This has been generated via update-readme.js -->
855
+
856
+ - **browser_console_messages**
857
+ - Title: Get console messages
858
+ - Description: Returns all console messages
859
+ - Parameters:
860
+ - `level` (string): Level of the console messages to return. Each level includes the messages of more severe levels. Defaults to "info".
861
+ - `all` (boolean, optional): Return all console messages since the beginning of the session, not just since the last navigation. Defaults to false.
862
+ - `filename` (string, optional): Filename to save the console messages to. If not provided, messages are returned as text.
863
+ - Read-only: **true**
864
+
865
+ <!-- NOTE: This has been generated via update-readme.js -->
866
+
867
+ - **browser_drag**
868
+ - Title: Drag mouse
869
+ - Description: Perform drag and drop between two elements
870
+ - Parameters:
871
+ - `startElement` (string, optional): Human-readable source element description used to obtain the permission to interact with the element
872
+ - `startTarget` (string): Exact target element reference from the page snapshot, or a unique element selector
873
+ - `endElement` (string, optional): Human-readable target element description used to obtain the permission to interact with the element
874
+ - `endTarget` (string): Exact target element reference from the page snapshot, or a unique element selector
875
+ - Read-only: **false**
876
+
877
+ <!-- NOTE: This has been generated via update-readme.js -->
878
+
879
+ - **browser_drop**
880
+ - Title: Drop files or data onto an element
881
+ - Description: Drop files or MIME-typed data onto an element, as if dragged from outside the page. At least one of "paths" or "data" must be provided.
882
+ - Parameters:
883
+ - `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
884
+ - `target` (string): Exact target element reference from the page snapshot, or a unique element selector
885
+ - `paths` (array, optional): Absolute paths to files to drop onto the element.
886
+ - `data` (object, optional): Data to drop, as a map of MIME type to string value (e.g. {"text/plain": "hello", "text/uri-list": "https://example.com"}).
887
+ - Read-only: **false**
888
+
889
+ <!-- NOTE: This has been generated via update-readme.js -->
890
+
891
+ - **browser_evaluate**
892
+ - Title: Evaluate JavaScript
893
+ - Description: Evaluate JavaScript expression on page or element
894
+ - Parameters:
895
+ - `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
896
+ - `target` (string, optional): Exact target element reference from the page snapshot, or a unique element selector
897
+ - `function` (string): () => { /* code */ } or (element) => { /* code */ } when element is provided
898
+ - `filename` (string, optional): Filename to save the result to. If not provided, result is returned as text.
899
+ - Read-only: **false**
900
+
901
+ <!-- NOTE: This has been generated via update-readme.js -->
902
+
903
+ - **browser_file_upload**
904
+ - Title: Upload files
905
+ - Description: Upload one or multiple files
906
+ - Parameters:
907
+ - `paths` (array, optional): The absolute paths to the files to upload. Can be single file or multiple files. If omitted, file chooser is cancelled.
908
+ - Read-only: **false**
909
+
910
+ <!-- NOTE: This has been generated via update-readme.js -->
911
+
912
+ - **browser_fill_form**
913
+ - Title: Fill form
914
+ - Description: Fill multiple form fields
915
+ - Parameters:
916
+ - `fields` (array): Fields to fill in
917
+ - Read-only: **false**
918
+
919
+ <!-- NOTE: This has been generated via update-readme.js -->
920
+
921
+ - **browser_handle_dialog**
922
+ - Title: Handle a dialog
923
+ - Description: Handle a dialog
924
+ - Parameters:
925
+ - `accept` (boolean): Whether to accept the dialog.
926
+ - `promptText` (string, optional): The text of the prompt in case of a prompt dialog.
927
+ - Read-only: **false**
928
+
929
+ <!-- NOTE: This has been generated via update-readme.js -->
930
+
931
+ - **browser_hover**
932
+ - Title: Hover mouse
933
+ - Description: Hover over element on page
934
+ - Parameters:
935
+ - `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
936
+ - `target` (string): Exact target element reference from the page snapshot, or a unique element selector
937
+ - Read-only: **false**
938
+
939
+ <!-- NOTE: This has been generated via update-readme.js -->
940
+
941
+ - **browser_navigate**
942
+ - Title: Navigate to a URL
943
+ - Description: Navigate to a URL
944
+ - Parameters:
945
+ - `url` (string): The URL to navigate to
946
+ - Read-only: **false**
947
+
948
+ <!-- NOTE: This has been generated via update-readme.js -->
949
+
950
+ - **browser_navigate_back**
951
+ - Title: Go back
952
+ - Description: Go back to the previous page in the history
953
+ - Parameters: None
954
+ - Read-only: **false**
955
+
956
+ <!-- NOTE: This has been generated via update-readme.js -->
957
+
958
+ - **browser_network_request**
959
+ - Title: Show network request details
960
+ - Description: Returns full details (headers and body) of a single network request, or a single part if `part` is set. Use the number from browser_network_requests.
961
+ - Parameters:
962
+ - `index` (integer): 1-based index of the request, as printed by browser_network_requests.
963
+ - `part` (string, optional): Return only this part of the request. Omit to return full details.
964
+ - `filename` (string, optional): Filename to save the result to. If not provided, output is returned as text.
965
+ - Read-only: **true**
966
+
967
+ <!-- NOTE: This has been generated via update-readme.js -->
968
+
969
+ - **browser_network_requests**
970
+ - Title: List network requests
971
+ - Description: Returns a numbered list of network requests since loading the page. Use browser_network_request with the number to get full details.
972
+ - Parameters:
973
+ - `static` (boolean): Whether to include successful static resources like images, fonts, scripts, etc. Defaults to false.
974
+ - `filter` (string, optional): Only return requests whose URL matches this regexp (e.g. "/api/.*user").
975
+ - `filename` (string, optional): Filename to save the network requests to. If not provided, requests are returned as text.
976
+ - Read-only: **true**
977
+
978
+ <!-- NOTE: This has been generated via update-readme.js -->
979
+
980
+ - **browser_press_key**
981
+ - Title: Press a key
982
+ - Description: Press a key on the keyboard
983
+ - Parameters:
984
+ - `key` (string): Name of the key to press or a character to generate, such as `ArrowLeft` or `a`
985
+ - Read-only: **false**
986
+
987
+ <!-- NOTE: This has been generated via update-readme.js -->
988
+
989
+ - **browser_resize**
990
+ - Title: Resize browser window
991
+ - Description: Resize the browser window
992
+ - Parameters:
993
+ - `width` (number): Width of the browser window
994
+ - `height` (number): Height of the browser window
995
+ - Read-only: **false**
996
+
997
+ <!-- NOTE: This has been generated via update-readme.js -->
998
+
999
+ - **browser_run_code_unsafe**
1000
+ - Title: Run Playwright code (unsafe)
1001
+ - Description: Run a Playwright code snippet. Unsafe: executes arbitrary JavaScript in the Playwright server process and is RCE-equivalent.
1002
+ - Parameters:
1003
+ - `code` (string, optional): A JavaScript function containing Playwright code to execute. It will be invoked with a single argument, page, which you can use for any page interaction. For example: `async (page) => { await page.getByRole('button', { name: 'Submit' }).click(); return await page.title(); }`
1004
+ - `filename` (string, optional): Load code from the specified file. If both code and filename are provided, code will be ignored.
1005
+ - Read-only: **false**
1006
+
1007
+ <!-- NOTE: This has been generated via update-readme.js -->
1008
+
1009
+ - **browser_select_option**
1010
+ - Title: Select option
1011
+ - Description: Select an option in a dropdown
1012
+ - Parameters:
1013
+ - `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
1014
+ - `target` (string): Exact target element reference from the page snapshot, or a unique element selector
1015
+ - `values` (array): Array of values to select in the dropdown. This can be a single value or multiple values.
1016
+ - Read-only: **false**
1017
+
1018
+ <!-- NOTE: This has been generated via update-readme.js -->
1019
+
1020
+ - **browser_snapshot**
1021
+ - Title: Page snapshot
1022
+ - Description: Capture accessibility snapshot of the current page, this is better than screenshot
1023
+ - Parameters:
1024
+ - `target` (string, optional): Exact target element reference from the page snapshot, or a unique element selector
1025
+ - `filename` (string, optional): Save snapshot to markdown file instead of returning it in the response.
1026
+ - `depth` (number, optional): Limit the depth of the snapshot tree
1027
+ - `boxes` (boolean, optional): Include each element's bounding box as [box=x,y,width,height] in the snapshot. Coordinates are viewport-relative, in CSS pixels (Element.getBoundingClientRect)
1028
+ - Read-only: **true**
1029
+
1030
+ <!-- NOTE: This has been generated via update-readme.js -->
1031
+
1032
+ - **browser_take_screenshot**
1033
+ - Title: Take a screenshot
1034
+ - Description: Take a screenshot of the current page. You can't perform actions based on the screenshot, use browser_snapshot for actions.
1035
+ - Parameters:
1036
+ - `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
1037
+ - `target` (string, optional): Exact target element reference from the page snapshot, or a unique element selector
1038
+ - `type` (string): Image format for the screenshot. Default is png.
1039
+ - `filename` (string, optional): File name to save the screenshot to. Defaults to `page-{timestamp}.{png|jpeg}` if not specified. Prefer relative file names to stay within the output directory.
1040
+ - `fullPage` (boolean, optional): When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Cannot be used with element screenshots.
1041
+ - Read-only: **true**
1042
+
1043
+ <!-- NOTE: This has been generated via update-readme.js -->
1044
+
1045
+ - **browser_type**
1046
+ - Title: Type text
1047
+ - Description: Type text into editable element
1048
+ - Parameters:
1049
+ - `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
1050
+ - `target` (string): Exact target element reference from the page snapshot, or a unique element selector
1051
+ - `text` (string): Text to type into the element
1052
+ - `submit` (boolean, optional): Whether to submit entered text (press Enter after)
1053
+ - `slowly` (boolean, optional): Whether to type one character at a time. Useful for triggering key handlers in the page. By default entire text is filled in at once.
1054
+ - Read-only: **false**
1055
+
1056
+ <!-- NOTE: This has been generated via update-readme.js -->
1057
+
1058
+ - **browser_wait_for**
1059
+ - Title: Wait for
1060
+ - Description: Wait for text to appear or disappear or a specified time to pass
1061
+ - Parameters:
1062
+ - `time` (number, optional): The time to wait in seconds
1063
+ - `text` (string, optional): The text to wait for
1064
+ - `textGone` (string, optional): The text to wait for to disappear
1065
+ - Read-only: **false**
1066
+
1067
+ </details>
1068
+
1069
+ <details>
1070
+ <summary><b>Tab management</b></summary>
1071
+
1072
+ <!-- NOTE: This has been generated via update-readme.js -->
1073
+
1074
+ - **browser_tabs**
1075
+ - Title: Manage tabs
1076
+ - Description: List, create, close, or select a browser tab.
1077
+ - Parameters:
1078
+ - `action` (string): Operation to perform
1079
+ - `index` (number, optional): Tab index, used for close/select. If omitted for close, current tab is closed.
1080
+ - `url` (string, optional): URL to navigate to in the new tab, used for new.
1081
+ - Read-only: **false**
1082
+
1083
+ </details>
1084
+
1085
+ <details>
1086
+ <summary><b>Browser installation</b></summary>
1087
+
1088
+ </details>
1089
+
1090
+ <details>
1091
+ <summary><b>Configuration (opt-in via --caps=config)</b></summary>
1092
+
1093
+ <!-- NOTE: This has been generated via update-readme.js -->
1094
+
1095
+ - **browser_get_config**
1096
+ - Title: Get config
1097
+ - Description: Get the final resolved config after merging CLI options, environment variables and config file.
1098
+ - Parameters: None
1099
+ - Read-only: **true**
1100
+
1101
+ </details>
1102
+
1103
+ <details>
1104
+ <summary><b>Network (opt-in via --caps=network)</b></summary>
1105
+
1106
+ <!-- NOTE: This has been generated via update-readme.js -->
1107
+
1108
+ - **browser_network_state_set**
1109
+ - Title: Set network state
1110
+ - Description: Sets the browser network state to online or offline. When offline, all network requests will fail.
1111
+ - Parameters:
1112
+ - `state` (string): Set to "offline" to simulate offline mode, "online" to restore network connectivity
1113
+ - Read-only: **false**
1114
+
1115
+ <!-- NOTE: This has been generated via update-readme.js -->
1116
+
1117
+ - **browser_route**
1118
+ - Title: Mock network requests
1119
+ - Description: Set up a route to mock network requests matching a URL pattern
1120
+ - Parameters:
1121
+ - `pattern` (string): URL pattern to match (e.g., "**/api/users", "**/*.{png,jpg}")
1122
+ - `status` (number, optional): HTTP status code to return (default: 200)
1123
+ - `body` (string, optional): Response body (text or JSON string)
1124
+ - `contentType` (string, optional): Content-Type header (e.g., "application/json", "text/html")
1125
+ - `headers` (array, optional): Headers to add in "Name: Value" format
1126
+ - `removeHeaders` (string, optional): Comma-separated list of header names to remove from request
1127
+ - Read-only: **false**
1128
+
1129
+ <!-- NOTE: This has been generated via update-readme.js -->
1130
+
1131
+ - **browser_route_list**
1132
+ - Title: List network routes
1133
+ - Description: List all active network routes
1134
+ - Parameters: None
1135
+ - Read-only: **true**
1136
+
1137
+ <!-- NOTE: This has been generated via update-readme.js -->
1138
+
1139
+ - **browser_unroute**
1140
+ - Title: Remove network routes
1141
+ - Description: Remove network routes matching a pattern (or all routes if no pattern specified)
1142
+ - Parameters:
1143
+ - `pattern` (string, optional): URL pattern to unroute (omit to remove all routes)
1144
+ - Read-only: **false**
1145
+
1146
+ </details>
1147
+
1148
+ <details>
1149
+ <summary><b>Storage (opt-in via --caps=storage)</b></summary>
1150
+
1151
+ <!-- NOTE: This has been generated via update-readme.js -->
1152
+
1153
+ - **browser_cookie_clear**
1154
+ - Title: Clear cookies
1155
+ - Description: Clear all cookies
1156
+ - Parameters: None
1157
+ - Read-only: **false**
1158
+
1159
+ <!-- NOTE: This has been generated via update-readme.js -->
1160
+
1161
+ - **browser_cookie_delete**
1162
+ - Title: Delete cookie
1163
+ - Description: Delete a specific cookie
1164
+ - Parameters:
1165
+ - `name` (string): Cookie name to delete
1166
+ - Read-only: **false**
1167
+
1168
+ <!-- NOTE: This has been generated via update-readme.js -->
1169
+
1170
+ - **browser_cookie_get**
1171
+ - Title: Get cookie
1172
+ - Description: Get a specific cookie by name
1173
+ - Parameters:
1174
+ - `name` (string): Cookie name to get
1175
+ - Read-only: **true**
1176
+
1177
+ <!-- NOTE: This has been generated via update-readme.js -->
1178
+
1179
+ - **browser_cookie_list**
1180
+ - Title: List cookies
1181
+ - Description: List all cookies (optionally filtered by domain/path)
1182
+ - Parameters:
1183
+ - `domain` (string, optional): Filter cookies by domain
1184
+ - `path` (string, optional): Filter cookies by path
1185
+ - Read-only: **true**
1186
+
1187
+ <!-- NOTE: This has been generated via update-readme.js -->
1188
+
1189
+ - **browser_cookie_set**
1190
+ - Title: Set cookie
1191
+ - Description: Set a cookie with optional flags (domain, path, expires, httpOnly, secure, sameSite)
1192
+ - Parameters:
1193
+ - `name` (string): Cookie name
1194
+ - `value` (string): Cookie value
1195
+ - `domain` (string, optional): Cookie domain
1196
+ - `path` (string, optional): Cookie path
1197
+ - `expires` (number, optional): Cookie expiration as Unix timestamp
1198
+ - `httpOnly` (boolean, optional): Whether the cookie is HTTP only
1199
+ - `secure` (boolean, optional): Whether the cookie is secure
1200
+ - `sameSite` (string, optional): Cookie SameSite attribute
1201
+ - Read-only: **false**
1202
+
1203
+ <!-- NOTE: This has been generated via update-readme.js -->
1204
+
1205
+ - **browser_localstorage_clear**
1206
+ - Title: Clear localStorage
1207
+ - Description: Clear all localStorage
1208
+ - Parameters: None
1209
+ - Read-only: **false**
1210
+
1211
+ <!-- NOTE: This has been generated via update-readme.js -->
1212
+
1213
+ - **browser_localstorage_delete**
1214
+ - Title: Delete localStorage item
1215
+ - Description: Delete a localStorage item
1216
+ - Parameters:
1217
+ - `key` (string): Key to delete
1218
+ - Read-only: **false**
1219
+
1220
+ <!-- NOTE: This has been generated via update-readme.js -->
1221
+
1222
+ - **browser_localstorage_get**
1223
+ - Title: Get localStorage item
1224
+ - Description: Get a localStorage item by key
1225
+ - Parameters:
1226
+ - `key` (string): Key to get
1227
+ - Read-only: **true**
1228
+
1229
+ <!-- NOTE: This has been generated via update-readme.js -->
1230
+
1231
+ - **browser_localstorage_list**
1232
+ - Title: List localStorage
1233
+ - Description: List all localStorage key-value pairs
1234
+ - Parameters: None
1235
+ - Read-only: **true**
1236
+
1237
+ <!-- NOTE: This has been generated via update-readme.js -->
1238
+
1239
+ - **browser_localstorage_set**
1240
+ - Title: Set localStorage item
1241
+ - Description: Set a localStorage item
1242
+ - Parameters:
1243
+ - `key` (string): Key to set
1244
+ - `value` (string): Value to set
1245
+ - Read-only: **false**
1246
+
1247
+ <!-- NOTE: This has been generated via update-readme.js -->
1248
+
1249
+ - **browser_sessionstorage_clear**
1250
+ - Title: Clear sessionStorage
1251
+ - Description: Clear all sessionStorage
1252
+ - Parameters: None
1253
+ - Read-only: **false**
1254
+
1255
+ <!-- NOTE: This has been generated via update-readme.js -->
1256
+
1257
+ - **browser_sessionstorage_delete**
1258
+ - Title: Delete sessionStorage item
1259
+ - Description: Delete a sessionStorage item
1260
+ - Parameters:
1261
+ - `key` (string): Key to delete
1262
+ - Read-only: **false**
1263
+
1264
+ <!-- NOTE: This has been generated via update-readme.js -->
1265
+
1266
+ - **browser_sessionstorage_get**
1267
+ - Title: Get sessionStorage item
1268
+ - Description: Get a sessionStorage item by key
1269
+ - Parameters:
1270
+ - `key` (string): Key to get
1271
+ - Read-only: **true**
1272
+
1273
+ <!-- NOTE: This has been generated via update-readme.js -->
1274
+
1275
+ - **browser_sessionstorage_list**
1276
+ - Title: List sessionStorage
1277
+ - Description: List all sessionStorage key-value pairs
1278
+ - Parameters: None
1279
+ - Read-only: **true**
1280
+
1281
+ <!-- NOTE: This has been generated via update-readme.js -->
1282
+
1283
+ - **browser_sessionstorage_set**
1284
+ - Title: Set sessionStorage item
1285
+ - Description: Set a sessionStorage item
1286
+ - Parameters:
1287
+ - `key` (string): Key to set
1288
+ - `value` (string): Value to set
1289
+ - Read-only: **false**
1290
+
1291
+ <!-- NOTE: This has been generated via update-readme.js -->
1292
+
1293
+ - **browser_set_storage_state**
1294
+ - Title: Restore storage state
1295
+ - Description: Restore storage state (cookies, local storage) from a file. This clears existing cookies and local storage before restoring.
1296
+ - Parameters:
1297
+ - `filename` (string): Path to the storage state file to restore from
1298
+ - Read-only: **false**
1299
+
1300
+ <!-- NOTE: This has been generated via update-readme.js -->
1301
+
1302
+ - **browser_storage_state**
1303
+ - Title: Save storage state
1304
+ - Description: Save storage state (cookies, local storage) to a file for later reuse
1305
+ - Parameters:
1306
+ - `filename` (string, optional): File name to save the storage state to. Defaults to `storage-state-{timestamp}.json` if not specified.
1307
+ - Read-only: **true**
1308
+
1309
+ </details>
1310
+
1311
+ <details>
1312
+ <summary><b>DevTools (opt-in via --caps=devtools)</b></summary>
1313
+
1314
+ <!-- NOTE: This has been generated via update-readme.js -->
1315
+
1316
+ - **browser_annotate**
1317
+ - Title: Annotate the current page
1318
+ - Description: Open the Playwright Dashboard in annotation mode for the current page and wait for the user to draw annotations. Returns the annotated screenshot, ARIA snapshot, and the list of annotations.
1319
+ - Parameters: None
1320
+ - Read-only: **true**
1321
+
1322
+ <!-- NOTE: This has been generated via update-readme.js -->
1323
+
1324
+ - **browser_hide_highlight**
1325
+ - Title: Hide element highlight
1326
+ - Description: Remove a highlight overlay previously added for the element.
1327
+ - Parameters:
1328
+ - `element` (string, optional): Human-readable element description used when adding the highlight; must match the value passed to browser_highlight.
1329
+ - `target` (string, optional): Exact target element reference from the page snapshot, or a unique element selector
1330
+ - Read-only: **true**
1331
+
1332
+ <!-- NOTE: This has been generated via update-readme.js -->
1333
+
1334
+ - **browser_highlight**
1335
+ - Title: Highlight element
1336
+ - Description: Show a persistent highlight overlay around the element on the page.
1337
+ - Parameters:
1338
+ - `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
1339
+ - `target` (string): Exact target element reference from the page snapshot, or a unique element selector
1340
+ - `style` (string, optional): Additional inline CSS applied to the highlight overlay, e.g. "outline: 2px dashed red".
1341
+ - Read-only: **true**
1342
+
1343
+ <!-- NOTE: This has been generated via update-readme.js -->
1344
+
1345
+ - **browser_resume**
1346
+ - Title: Resume paused script execution
1347
+ - Description: Resume script execution after it was paused. When called with step set to true, execution will pause again before the next action.
1348
+ - Parameters:
1349
+ - `step` (boolean, optional): When true, execution will pause again before the next action, allowing step-by-step debugging.
1350
+ - `location` (string, optional): Pause execution at a specific <file>:<line>, e.g. "example.spec.ts:42".
1351
+ - Read-only: **false**
1352
+
1353
+ <!-- NOTE: This has been generated via update-readme.js -->
1354
+
1355
+ - **browser_start_tracing**
1356
+ - Title: Start tracing
1357
+ - Description: Start trace recording
1358
+ - Parameters: None
1359
+ - Read-only: **true**
1360
+
1361
+ <!-- NOTE: This has been generated via update-readme.js -->
1362
+
1363
+ - **browser_start_video**
1364
+ - Title: Start video
1365
+ - Description: Start video recording
1366
+ - Parameters:
1367
+ - `filename` (string, optional): Filename to save the video.
1368
+ - `size` (object, optional): Video size
1369
+ - Read-only: **true**
1370
+
1371
+ <!-- NOTE: This has been generated via update-readme.js -->
1372
+
1373
+ - **browser_stop_tracing**
1374
+ - Title: Stop tracing
1375
+ - Description: Stop trace recording
1376
+ - Parameters: None
1377
+ - Read-only: **true**
1378
+
1379
+ <!-- NOTE: This has been generated via update-readme.js -->
1380
+
1381
+ - **browser_stop_video**
1382
+ - Title: Stop video
1383
+ - Description: Stop video recording
1384
+ - Parameters: None
1385
+ - Read-only: **true**
1386
+
1387
+ <!-- NOTE: This has been generated via update-readme.js -->
1388
+
1389
+ - **browser_video_chapter**
1390
+ - Title: Video chapter
1391
+ - Description: Add a chapter marker to the video recording. Shows a full-screen chapter card with blurred backdrop.
1392
+ - Parameters:
1393
+ - `title` (string): Chapter title
1394
+ - `description` (string, optional): Chapter description
1395
+ - `duration` (number, optional): Duration in milliseconds to show the chapter card
1396
+ - Read-only: **true**
1397
+
1398
+ <!-- NOTE: This has been generated via update-readme.js -->
1399
+
1400
+ - **browser_video_hide_actions**
1401
+ - Title: Hide action overlays
1402
+ - Description: Stop annotating actions performed on the page.
1403
+ - Parameters: None
1404
+ - Read-only: **true**
1405
+
1406
+ <!-- NOTE: This has been generated via update-readme.js -->
1407
+
1408
+ - **browser_video_show_actions**
1409
+ - Title: Show action overlays
1410
+ - Description: Annotate subsequent actions performed on the page with a callout that names the action and highlights the target element. Useful while video recording or screencasting.
1411
+ - Parameters:
1412
+ - `duration` (number, optional): How long each action annotation stays on screen, in milliseconds. Defaults to 500.
1413
+ - `position` (string, optional): Where to place the action title relative to the page. Defaults to top-right.
1414
+ - `cursor` (string, optional): Cursor decoration for pointer actions. "pointer" (default) animates a mouse pointer from the previous action point to the next one; "none" disables the cursor decoration.
1415
+ - Read-only: **true**
1416
+
1417
+ </details>
1418
+
1419
+ <details>
1420
+ <summary><b>Coordinate-based (opt-in via --caps=vision)</b></summary>
1421
+
1422
+ <!-- NOTE: This has been generated via update-readme.js -->
1423
+
1424
+ - **browser_mouse_click_xy**
1425
+ - Title: Click
1426
+ - Description: Click mouse button at a given position
1427
+ - Parameters:
1428
+ - `x` (number): X coordinate
1429
+ - `y` (number): Y coordinate
1430
+ - `button` (string, optional): Button to click, defaults to left
1431
+ - `clickCount` (number, optional): Number of clicks, defaults to 1
1432
+ - `delay` (number, optional): Time to wait between mouse down and mouse up in milliseconds, defaults to 0
1433
+ - Read-only: **false**
1434
+
1435
+ <!-- NOTE: This has been generated via update-readme.js -->
1436
+
1437
+ - **browser_mouse_down**
1438
+ - Title: Press mouse down
1439
+ - Description: Press mouse down
1440
+ - Parameters:
1441
+ - `button` (string, optional): Button to press, defaults to left
1442
+ - Read-only: **false**
1443
+
1444
+ <!-- NOTE: This has been generated via update-readme.js -->
1445
+
1446
+ - **browser_mouse_drag_xy**
1447
+ - Title: Drag mouse
1448
+ - Description: Drag left mouse button to a given position
1449
+ - Parameters:
1450
+ - `startX` (number): Start X coordinate
1451
+ - `startY` (number): Start Y coordinate
1452
+ - `endX` (number): End X coordinate
1453
+ - `endY` (number): End Y coordinate
1454
+ - Read-only: **false**
1455
+
1456
+ <!-- NOTE: This has been generated via update-readme.js -->
1457
+
1458
+ - **browser_mouse_move_xy**
1459
+ - Title: Move mouse
1460
+ - Description: Move mouse to a given position
1461
+ - Parameters:
1462
+ - `x` (number): X coordinate
1463
+ - `y` (number): Y coordinate
1464
+ - Read-only: **false**
1465
+
1466
+ <!-- NOTE: This has been generated via update-readme.js -->
1467
+
1468
+ - **browser_mouse_up**
1469
+ - Title: Press mouse up
1470
+ - Description: Press mouse up
1471
+ - Parameters:
1472
+ - `button` (string, optional): Button to press, defaults to left
1473
+ - Read-only: **false**
1474
+
1475
+ <!-- NOTE: This has been generated via update-readme.js -->
1476
+
1477
+ - **browser_mouse_wheel**
1478
+ - Title: Scroll mouse wheel
1479
+ - Description: Scroll mouse wheel
1480
+ - Parameters:
1481
+ - `deltaX` (number): X delta
1482
+ - `deltaY` (number): Y delta
1483
+ - Read-only: **false**
1484
+
1485
+ </details>
1486
+
1487
+ <details>
1488
+ <summary><b>PDF generation (opt-in via --caps=pdf)</b></summary>
1489
+
1490
+ <!-- NOTE: This has been generated via update-readme.js -->
1491
+
1492
+ - **browser_pdf_save**
1493
+ - Title: Save as PDF
1494
+ - Description: Save page as PDF
1495
+ - Parameters:
1496
+ - `filename` (string, optional): File name to save the pdf to. Defaults to `page-{timestamp}.pdf` if not specified. Prefer relative file names to stay within the output directory.
1497
+ - Read-only: **true**
1498
+
1499
+ </details>
1500
+
1501
+ <details>
1502
+ <summary><b>Test assertions (opt-in via --caps=testing)</b></summary>
1503
+
1504
+ <!-- NOTE: This has been generated via update-readme.js -->
1505
+
1506
+ - **browser_generate_locator**
1507
+ - Title: Create locator for element
1508
+ - Description: Generate locator for the given element to use in tests
1509
+ - Parameters:
1510
+ - `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
1511
+ - `target` (string): Exact target element reference from the page snapshot, or a unique element selector
1512
+ - Read-only: **true**
1513
+
1514
+ <!-- NOTE: This has been generated via update-readme.js -->
1515
+
1516
+ - **browser_verify_element_visible**
1517
+ - Title: Verify element visible
1518
+ - Description: Verify element is visible on the page
1519
+ - Parameters:
1520
+ - `role` (string): ROLE of the element. Can be found in the snapshot like this: `- {ROLE} "Accessible Name":`
1521
+ - `accessibleName` (string): ACCESSIBLE_NAME of the element. Can be found in the snapshot like this: `- role "{ACCESSIBLE_NAME}"`
1522
+ - Read-only: **false**
1523
+
1524
+ <!-- NOTE: This has been generated via update-readme.js -->
1525
+
1526
+ - **browser_verify_list_visible**
1527
+ - Title: Verify list visible
1528
+ - Description: Verify list is visible on the page
1529
+ - Parameters:
1530
+ - `element` (string): Human-readable list description
1531
+ - `target` (string): Exact target element reference that points to the list
1532
+ - `items` (array): Items to verify
1533
+ - Read-only: **false**
1534
+
1535
+ <!-- NOTE: This has been generated via update-readme.js -->
1536
+
1537
+ - **browser_verify_text_visible**
1538
+ - Title: Verify text visible
1539
+ - Description: Verify text is visible on the page. Prefer browser_verify_element_visible if possible.
1540
+ - Parameters:
1541
+ - `text` (string): TEXT to verify. Can be found in the snapshot like this: `- role "Accessible Name": {TEXT}` or like this: `- text: {TEXT}`
1542
+ - Read-only: **false**
1543
+
1544
+ <!-- NOTE: This has been generated via update-readme.js -->
1545
+
1546
+ - **browser_verify_value**
1547
+ - Title: Verify value
1548
+ - Description: Verify element value
1549
+ - Parameters:
1550
+ - `type` (string): Type of the element
1551
+ - `element` (string): Human-readable element description
1552
+ - `target` (string): Exact target element reference from the page snapshot
1553
+ - `value` (string): Value to verify. For checkbox, use "true" or "false".
1554
+ - Read-only: **false**
1555
+
1556
+ </details>
1557
+
1558
+
1559
+ <!--- End of tools generated section -->