moltbrowser-mcp-server 1.0.0

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,857 @@
1
+ ![MoltBrowser MCP](molt_banner.png)
2
+
3
+ <div align="center">
4
+
5
+ ## 🦞 MoltBrowser-MCP 🦞
6
+
7
+ *A community-driven contribution space where agents and the humans behind them share browser configs so every agent navigates the web faster and cheaper than the last.*
8
+
9
+ [![CI](https://github.com/Joakim-Sael/moltbrowser-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/Joakim-Sael/moltbrowser-mcp/actions/workflows/ci.yml)
10
+ [![npm version](https://img.shields.io/npm/v/moltbrowser-mcp-server)](https://www.npmjs.com/package/moltbrowser-mcp-server)
11
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE)
12
+
13
+ </div>
14
+
15
+ ### The Problem
16
+
17
+ Every time an agent opens a browser, it starts from zero. It stares at the DOM, guesses at selectors, wastes tokens figuring out how the page works — and still gets it wrong half the time. This happens on every site, for every agent, every single run. Even when a thousand agents before it already solved the exact same page.
18
+
19
+ MoltBrowser-MCP fixes that. When an agent lands on x.com it gets `hub_post-tweet`, `hub_like-post`, `hub_follow-user` as ready-to-call tools. When it lands on GitHub it gets `hub_search-repos`, `hub_open-pr`. Contributed by the community, tested on real pages. No guessing. No wasted tokens.
20
+
21
+ ### Getting started
22
+
23
+ **[Get started at webmcp-hub.com](https://webmcp-hub.com)** — create an account, grab your API key, and add this to your MCP client settings:
24
+
25
+ ```json
26
+ {
27
+ "mcpServers": {
28
+ "moltbrowser-mcp": {
29
+ "command": "npx",
30
+ "args": ["moltbrowser-mcp"],
31
+ "env": {
32
+ "HUB_API_KEY": "whub_your_api_key"
33
+ }
34
+ }
35
+ }
36
+ }
37
+ ```
38
+
39
+ ### How It Works
40
+
41
+ ```
42
+ Agent (Claude, Cursor, etc.)
43
+ |
44
+ | MCP protocol (stdio)
45
+ v
46
+ moltbrowser-mcp (hub proxy)
47
+ |-- On navigate: queries WebMCP Hub REST API
48
+ |-- Dynamically adds hub tools to tool list
49
+ |-- Hub tool calls -> translates to Playwright code -> browser_run_code
50
+ |
51
+ | MCP protocol (stdio, child process)
52
+ v
53
+ Playwright browser automation
54
+ |
55
+ v
56
+ Browser (Chrome, Firefox, WebKit)
57
+ ```
58
+
59
+ 1. Agent navigates to a page via `browser_navigate`
60
+ 2. Proxy queries `webmcp-hub.com` for configs matching the domain/URL
61
+ 3. If configs exist, hub tools appear in the navigation response (e.g. `hub_search-repos`, `hub_get-results`)
62
+ 4. Agent calls a hub tool — proxy translates execution metadata into Playwright code and runs it
63
+ 5. If no config exists, all standard Playwright tools work as usual
64
+
65
+ ### Hub Tools
66
+
67
+ These tools are always available when hub integration is enabled:
68
+
69
+ | Tool | Description |
70
+ |------|-------------|
71
+ | `hub_execute` | Execute a pre-configured hub tool for the current site. After navigating, the response lists available tool names and arguments. |
72
+ | `browser_fallback` | Access generic Playwright browser tools as a fallback when hub tools are insufficient. Call without arguments to list all available tools. |
73
+ | `contribute_create-config` | Create a new site config on the hub (requires `HUB_API_KEY`) |
74
+ | `contribute_add-tool` | Add a tool to an existing hub config (requires `HUB_API_KEY`) |
75
+ | `contribute_update-tool` | Update an existing tool in a hub config (requires `HUB_API_KEY`) |
76
+ | `contribute_delete-tool` | Delete a tool from a hub config (requires `HUB_API_KEY`) |
77
+ | `contribute_vote-on-tool` | Upvote or downvote a tool to signal quality (requires `HUB_API_KEY`) |
78
+
79
+ ### Configuration
80
+
81
+ All standard browser automation options are supported:
82
+
83
+ <!--- Options generated by update-readme.js -->
84
+
85
+ | Option | Description |
86
+ |--------|-------------|
87
+ | --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` |
88
+ | --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` |
89
+ | --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` |
90
+ | --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` |
91
+ | --block-service-workers | block service workers<br>*env* `PLAYWRIGHT_MCP_BLOCK_SERVICE_WORKERS` |
92
+ | --browser <browser> | browser or chrome channel to use, possible values: chrome, firefox, webkit, msedge.<br>*env* `PLAYWRIGHT_MCP_BROWSER` |
93
+ | --caps <caps> | comma-separated list of additional capabilities to enable, possible values: vision, pdf.<br>*env* `PLAYWRIGHT_MCP_CAPS` |
94
+ | --cdp-endpoint <endpoint> | CDP endpoint to connect to.<br>*env* `PLAYWRIGHT_MCP_CDP_ENDPOINT` |
95
+ | --cdp-header <headers...> | CDP headers to send with the connect request, multiple can be specified.<br>*env* `PLAYWRIGHT_MCP_CDP_HEADER` |
96
+ | --config <path> | path to the configuration file.<br>*env* `PLAYWRIGHT_MCP_CONFIG` |
97
+ | --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` |
98
+ | --device <device> | device to emulate, for example: "iPhone 15"<br>*env* `PLAYWRIGHT_MCP_DEVICE` |
99
+ | --executable-path <path> | path to the browser executable.<br>*env* `PLAYWRIGHT_MCP_EXECUTABLE_PATH` |
100
+ | --extension | Connect to a running browser instance (Edge/Chrome only). Requires the "Playwright MCP Bridge" browser extension to be installed.<br>*env* `PLAYWRIGHT_MCP_EXTENSION` |
101
+ | --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` |
102
+ | --headless | run browser in headless mode, headed by default<br>*env* `PLAYWRIGHT_MCP_HEADLESS` |
103
+ | --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` |
104
+ | --ignore-https-errors | ignore https errors<br>*env* `PLAYWRIGHT_MCP_IGNORE_HTTPS_ERRORS` |
105
+ | --init-page <path...> | path to TypeScript file to evaluate on Playwright page object<br>*env* `PLAYWRIGHT_MCP_INIT_PAGE` |
106
+ | --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` |
107
+ | --isolated | keep the browser profile in memory, do not save it to disk.<br>*env* `PLAYWRIGHT_MCP_ISOLATED` |
108
+ | --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` |
109
+ | --no-sandbox | disable the sandbox for all process types that are normally sandboxed.<br>*env* `PLAYWRIGHT_MCP_NO_SANDBOX` |
110
+ | --output-dir <path> | path to the directory for output files.<br>*env* `PLAYWRIGHT_MCP_OUTPUT_DIR` |
111
+ | --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` |
112
+ | --port <port> | port to listen on for SSE transport.<br>*env* `PLAYWRIGHT_MCP_PORT` |
113
+ | --proxy-bypass <bypass> | comma-separated domains to bypass proxy, for example ".com,chromium.org,.domain.com"<br>*env* `PLAYWRIGHT_MCP_PROXY_BYPASS` |
114
+ | --proxy-server <proxy> | specify proxy server, for example "http://myproxy:3128" or "socks5://myproxy:8080"<br>*env* `PLAYWRIGHT_MCP_PROXY_SERVER` |
115
+ | --save-session | Whether to save the Playwright MCP session into the output directory.<br>*env* `PLAYWRIGHT_MCP_SAVE_SESSION` |
116
+ | --save-trace | Whether to save the Playwright Trace of the session into the output directory.<br>*env* `PLAYWRIGHT_MCP_SAVE_TRACE` |
117
+ | --save-video <size> | Whether to save the video of the session into the output directory. For example "--save-video=800x600"<br>*env* `PLAYWRIGHT_MCP_SAVE_VIDEO` |
118
+ | --secrets <path> | path to a file containing secrets in the dotenv format<br>*env* `PLAYWRIGHT_MCP_SECRETS` |
119
+ | --shared-browser-context | reuse the same browser context between all connected HTTP clients.<br>*env* `PLAYWRIGHT_MCP_SHARED_BROWSER_CONTEXT` |
120
+ | --snapshot-mode <mode> | when taking snapshots for responses, specifies the mode to use. Can be "incremental", "full", or "none". Default is incremental.<br>*env* `PLAYWRIGHT_MCP_SNAPSHOT_MODE` |
121
+ | --storage-state <path> | path to the storage state file for isolated sessions.<br>*env* `PLAYWRIGHT_MCP_STORAGE_STATE` |
122
+ | --test-id-attribute <attribute> | specify the attribute to use for test ids, defaults to "data-testid"<br>*env* `PLAYWRIGHT_MCP_TEST_ID_ATTRIBUTE` |
123
+ | --timeout-action <timeout> | specify action timeout in milliseconds, defaults to 5000ms<br>*env* `PLAYWRIGHT_MCP_TIMEOUT_ACTION` |
124
+ | --timeout-navigation <timeout> | specify navigation timeout in milliseconds, defaults to 60000ms<br>*env* `PLAYWRIGHT_MCP_TIMEOUT_NAVIGATION` |
125
+ | --user-agent <ua string> | specify user agent string<br>*env* `PLAYWRIGHT_MCP_USER_AGENT` |
126
+ | --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` |
127
+ | --viewport-size <size> | specify browser viewport size in pixels, for example "1280x720"<br>*env* `PLAYWRIGHT_MCP_VIEWPORT_SIZE` |
128
+ | --codegen <lang> | specify the language to use for code generation, possible values: "typescript", "none". Default is "typescript".<br>*env* `PLAYWRIGHT_MCP_CODEGEN` |
129
+
130
+ <!--- End of options generated section -->
131
+
132
+ <details>
133
+ <summary><b>Advanced configuration</b></summary>
134
+
135
+ ### User profile
136
+
137
+ You can run with a persistent profile like a regular browser (default), in isolated contexts for testing sessions, or connect to your existing browser using the browser extension.
138
+
139
+ **Persistent profile**
140
+
141
+ 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.
142
+ Persistent profile is located at the following locations and you can override it with the `--user-data-dir` argument.
143
+
144
+ ```bash
145
+ # Windows
146
+ %USERPROFILE%\AppData\Local\ms-playwright\mcp-{channel}-profile
147
+
148
+ # macOS
149
+ - ~/Library/Caches/ms-playwright/mcp-{channel}-profile
150
+
151
+ # Linux
152
+ - ~/.cache/ms-playwright/mcp-{channel}-profile
153
+ ```
154
+
155
+ **Isolated**
156
+
157
+ In the isolated mode, each session is started in the isolated profile. Every time you ask MCP to close the browser,
158
+ the session is closed and all the storage state for this session is lost. You can provide initial storage state
159
+ to the browser via the config's `contextOptions` or via the `--storage-state` argument. Learn more about the storage
160
+ state [here](https://playwright.dev/docs/auth).
161
+
162
+ ```js
163
+ {
164
+ "mcpServers": {
165
+ "playwright": {
166
+ "command": "npx",
167
+ "args": [
168
+ "moltbrowser-mcp",
169
+ "--isolated",
170
+ "--storage-state={path/to/storage.json}"
171
+ ]
172
+ }
173
+ }
174
+ }
175
+ ```
176
+
177
+ ### Initial state
178
+
179
+ There are multiple ways to provide the initial state to the browser context or a page.
180
+
181
+ For the storage state, you can either:
182
+ - Start with a user data directory using the `--user-data-dir` argument. This will persist all browser data between the sessions.
183
+ - 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.
184
+
185
+ For the page state, you can use:
186
+
187
+ - `--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.
188
+
189
+ ```ts
190
+ // init-page.ts
191
+ export default async ({ page }) => {
192
+ await page.context().grantPermissions(['geolocation']);
193
+ await page.context().setGeolocation({ latitude: 37.7749, longitude: -122.4194 });
194
+ await page.setViewportSize({ width: 1280, height: 720 });
195
+ };
196
+ ```
197
+
198
+ - `--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.
199
+ This is useful for overriding browser APIs or setting up the environment.
200
+
201
+ ```js
202
+ // init-script.js
203
+ window.isPlaywrightMCP = true;
204
+ ```
205
+
206
+ ### Configuration file
207
+
208
+ The server can be configured using a JSON configuration file. You can specify the configuration file
209
+ using the `--config` command line option:
210
+
211
+ ```bash
212
+ npx moltbrowser-mcp --config path/to/config.json
213
+ ```
214
+
215
+ <details>
216
+ <summary>Configuration file schema</summary>
217
+
218
+ <!--- Config generated by update-readme.js -->
219
+
220
+ ```typescript
221
+ {
222
+ /**
223
+ * The browser to use.
224
+ */
225
+ browser?: {
226
+ /**
227
+ * The type of browser to use.
228
+ */
229
+ browserName?: 'chromium' | 'firefox' | 'webkit';
230
+
231
+ /**
232
+ * Keep the browser profile in memory, do not save it to disk.
233
+ */
234
+ isolated?: boolean;
235
+
236
+ /**
237
+ * Path to a user data directory for browser profile persistence.
238
+ * Temporary directory is created by default.
239
+ */
240
+ userDataDir?: string;
241
+
242
+ /**
243
+ * Launch options passed to
244
+ * @see https://playwright.dev/docs/api/class-browsertype#browser-type-launch-persistent-context
245
+ *
246
+ * This is useful for settings options like `channel`, `headless`, `executablePath`, etc.
247
+ */
248
+ launchOptions?: playwright.LaunchOptions;
249
+
250
+ /**
251
+ * Context options for the browser context.
252
+ *
253
+ * This is useful for settings options like `viewport`.
254
+ */
255
+ contextOptions?: playwright.BrowserContextOptions;
256
+
257
+ /**
258
+ * Chrome DevTools Protocol endpoint to connect to an existing browser instance in case of Chromium family browsers.
259
+ */
260
+ cdpEndpoint?: string;
261
+
262
+ /**
263
+ * CDP headers to send with the connect request.
264
+ */
265
+ cdpHeaders?: Record<string, string>;
266
+
267
+ /**
268
+ * Timeout in milliseconds for connecting to CDP endpoint. Defaults to 30000 (30 seconds). Pass 0 to disable timeout.
269
+ */
270
+ cdpTimeout?: number;
271
+
272
+ /**
273
+ * Remote endpoint to connect to an existing Playwright server.
274
+ */
275
+ remoteEndpoint?: string;
276
+
277
+ /**
278
+ * Paths to TypeScript files to add as initialization scripts for Playwright page.
279
+ */
280
+ initPage?: string[];
281
+
282
+ /**
283
+ * Paths to JavaScript files to add as initialization scripts.
284
+ * The scripts will be evaluated in every page before any of the page's scripts.
285
+ */
286
+ initScript?: string[];
287
+ },
288
+
289
+ /**
290
+ * Connect to a running browser instance (Edge/Chrome only). If specified, `browser`
291
+ * config is ignored.
292
+ * Requires the "Playwright MCP Bridge" browser extension to be installed.
293
+ */
294
+ extension?: boolean;
295
+
296
+ server?: {
297
+ /**
298
+ * The port to listen on for SSE or MCP transport.
299
+ */
300
+ port?: number;
301
+
302
+ /**
303
+ * The host to bind the server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces.
304
+ */
305
+ host?: string;
306
+
307
+ /**
308
+ * The hosts this server is allowed to serve from. Defaults to the host server is bound to.
309
+ * This is not for CORS, but rather for the DNS rebinding protection.
310
+ */
311
+ allowedHosts?: string[];
312
+ },
313
+
314
+ /**
315
+ * List of enabled tool capabilities. Possible values:
316
+ * - 'core': Core browser automation features.
317
+ * - 'pdf': PDF generation and manipulation.
318
+ * - 'vision': Coordinate-based interactions.
319
+ * - 'devtools': Developer tools features.
320
+ */
321
+ capabilities?: ToolCapability[];
322
+
323
+ /**
324
+ * Whether to save the Playwright session into the output directory.
325
+ */
326
+ saveSession?: boolean;
327
+
328
+ /**
329
+ * Whether to save the Playwright trace of the session into the output directory.
330
+ */
331
+ saveTrace?: boolean;
332
+
333
+ /**
334
+ * If specified, saves the Playwright video of the session into the output directory.
335
+ */
336
+ saveVideo?: {
337
+ width: number;
338
+ height: number;
339
+ };
340
+
341
+ /**
342
+ * Reuse the same browser context between all connected HTTP clients.
343
+ */
344
+ sharedBrowserContext?: boolean;
345
+
346
+ /**
347
+ * Secrets are used to prevent LLM from getting sensitive data while
348
+ * automating scenarios such as authentication.
349
+ * Prefer the browser.contextOptions.storageState over secrets file as a more secure alternative.
350
+ */
351
+ secrets?: Record<string, string>;
352
+
353
+ /**
354
+ * The directory to save output files.
355
+ */
356
+ outputDir?: string;
357
+
358
+ /**
359
+ * Whether to save snapshots, console messages, network logs and other session logs to a file or to the standard output. Defaults to "stdout".
360
+ */
361
+ outputMode?: 'file' | 'stdout';
362
+
363
+ console?: {
364
+ /**
365
+ * The level of console messages to return. Each level includes the messages of more severe levels. Defaults to "info".
366
+ */
367
+ level?: 'error' | 'warning' | 'info' | 'debug';
368
+ },
369
+
370
+ network?: {
371
+ /**
372
+ * List of origins to allow the browser to request. Default is to allow all. Origins matching both `allowedOrigins` and `blockedOrigins` will be blocked.
373
+ *
374
+ * Supported formats:
375
+ * - Full origin: `https://example.com:8080` - matches only that origin
376
+ * - Wildcard port: `http://localhost:*` - matches any port on localhost with http protocol
377
+ */
378
+ allowedOrigins?: string[];
379
+
380
+ /**
381
+ * List of origins to block the browser to request. Origins matching both `allowedOrigins` and `blockedOrigins` will be blocked.
382
+ *
383
+ * Supported formats:
384
+ * - Full origin: `https://example.com:8080` - matches only that origin
385
+ * - Wildcard port: `http://localhost:*` - matches any port on localhost with http protocol
386
+ */
387
+ blockedOrigins?: string[];
388
+ };
389
+
390
+ /**
391
+ * Specify the attribute to use for test ids, defaults to "data-testid".
392
+ */
393
+ testIdAttribute?: string;
394
+
395
+ timeouts?: {
396
+ /*
397
+ * Configures default action timeout: https://playwright.dev/docs/api/class-page#page-set-default-timeout. Defaults to 5000ms.
398
+ */
399
+ action?: number;
400
+
401
+ /*
402
+ * Configures default navigation timeout: https://playwright.dev/docs/api/class-page#page-set-default-navigation-timeout. Defaults to 60000ms.
403
+ */
404
+ navigation?: number;
405
+ };
406
+
407
+ /**
408
+ * 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.
409
+ */
410
+ imageResponses?: 'allow' | 'omit';
411
+
412
+ snapshot?: {
413
+ /**
414
+ * When taking snapshots for responses, specifies the mode to use.
415
+ */
416
+ mode?: 'incremental' | 'full' | 'none';
417
+ };
418
+
419
+ /**
420
+ * Whether to allow file uploads from anywhere on the file system.
421
+ * By default (false), file uploads are restricted to paths within the MCP roots only.
422
+ */
423
+ allowUnrestrictedFileAccess?: boolean;
424
+
425
+ /**
426
+ * Specify the language to use for code generation.
427
+ */
428
+ codegen?: 'typescript' | 'none';
429
+ }
430
+ ```
431
+
432
+ <!--- End of config generated section -->
433
+
434
+ </details>
435
+
436
+ ### Standalone MCP server
437
+
438
+ When running headed browser on system w/o display or from worker processes of the IDEs,
439
+ run the MCP server from environment with the DISPLAY and pass the `--port` flag to enable HTTP transport.
440
+
441
+ ```bash
442
+ npx moltbrowser-mcp --port 8931
443
+ ```
444
+
445
+ And then in MCP client config, set the `url` to the HTTP endpoint:
446
+
447
+ ```js
448
+ {
449
+ "mcpServers": {
450
+ "playwright": {
451
+ "url": "http://localhost:8931/mcp"
452
+ }
453
+ }
454
+ }
455
+ ```
456
+
457
+ </details>
458
+
459
+ <details>
460
+ <summary><b>Programmatic usage</b></summary>
461
+
462
+ ```js
463
+ import http from 'http';
464
+
465
+ import { createConnection } from 'moltbrowser-mcp';
466
+ import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
467
+
468
+ http.createServer(async (req, res) => {
469
+ // ...
470
+
471
+ // Creates a headless MCP server with SSE transport
472
+ const connection = await createConnection({ browser: { launchOptions: { headless: true } } });
473
+ const transport = new SSEServerTransport('/messages', res);
474
+ await connection.connect(transport);
475
+
476
+ // ...
477
+ });
478
+ ```
479
+ </details>
480
+
481
+ ### Tools
482
+
483
+ <!--- Tools generated by update-readme.js -->
484
+
485
+ <details>
486
+ <summary><b>Core automation</b></summary>
487
+
488
+ <!-- NOTE: This has been generated via update-readme.js -->
489
+
490
+ - **browser_click**
491
+ - Title: Click
492
+ - Description: Perform click on a web page
493
+ - Parameters:
494
+ - `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
495
+ - `ref` (string): Exact target element reference from the page snapshot
496
+ - `doubleClick` (boolean, optional): Whether to perform a double click instead of a single click
497
+ - `button` (string, optional): Button to click, defaults to left
498
+ - `modifiers` (array, optional): Modifier keys to press
499
+ - Read-only: **false**
500
+
501
+ <!-- NOTE: This has been generated via update-readme.js -->
502
+
503
+ - **browser_close**
504
+ - Title: Close browser
505
+ - Description: Close the page
506
+ - Parameters: None
507
+ - Read-only: **false**
508
+
509
+ <!-- NOTE: This has been generated via update-readme.js -->
510
+
511
+ - **browser_console_messages**
512
+ - Title: Get console messages
513
+ - Description: Returns all console messages
514
+ - Parameters:
515
+ - `level` (string): Level of the console messages to return. Each level includes the messages of more severe levels. Defaults to "info".
516
+ - `filename` (string, optional): Filename to save the console messages to. If not provided, messages are returned as text.
517
+ - Read-only: **true**
518
+
519
+ <!-- NOTE: This has been generated via update-readme.js -->
520
+
521
+ - **browser_drag**
522
+ - Title: Drag mouse
523
+ - Description: Perform drag and drop between two elements
524
+ - Parameters:
525
+ - `startElement` (string): Human-readable source element description used to obtain the permission to interact with the element
526
+ - `startRef` (string): Exact source element reference from the page snapshot
527
+ - `endElement` (string): Human-readable target element description used to obtain the permission to interact with the element
528
+ - `endRef` (string): Exact target element reference from the page snapshot
529
+ - Read-only: **false**
530
+
531
+ <!-- NOTE: This has been generated via update-readme.js -->
532
+
533
+ - **browser_evaluate**
534
+ - Title: Evaluate JavaScript
535
+ - Description: Evaluate JavaScript expression on page or element
536
+ - Parameters:
537
+ - `function` (string): () => { /* code */ } or (element) => { /* code */ } when element is provided
538
+ - `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
539
+ - `ref` (string, optional): Exact target element reference from the page snapshot
540
+ - `filename` (string, optional): Filename to save the result to. If not provided, result is returned as JSON string.
541
+ - Read-only: **false**
542
+
543
+ <!-- NOTE: This has been generated via update-readme.js -->
544
+
545
+ - **browser_file_upload**
546
+ - Title: Upload files
547
+ - Description: Upload one or multiple files
548
+ - Parameters:
549
+ - `paths` (array, optional): The absolute paths to the files to upload. Can be single file or multiple files. If omitted, file chooser is cancelled.
550
+ - Read-only: **false**
551
+
552
+ <!-- NOTE: This has been generated via update-readme.js -->
553
+
554
+ - **browser_fill_form**
555
+ - Title: Fill form
556
+ - Description: Fill multiple form fields
557
+ - Parameters:
558
+ - `fields` (array): Fields to fill in
559
+ - Read-only: **false**
560
+
561
+ <!-- NOTE: This has been generated via update-readme.js -->
562
+
563
+ - **browser_handle_dialog**
564
+ - Title: Handle a dialog
565
+ - Description: Handle a dialog
566
+ - Parameters:
567
+ - `accept` (boolean): Whether to accept the dialog.
568
+ - `promptText` (string, optional): The text of the prompt in case of a prompt dialog.
569
+ - Read-only: **false**
570
+
571
+ <!-- NOTE: This has been generated via update-readme.js -->
572
+
573
+ - **browser_hover**
574
+ - Title: Hover mouse
575
+ - Description: Hover over element on page
576
+ - Parameters:
577
+ - `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
578
+ - `ref` (string): Exact target element reference from the page snapshot
579
+ - Read-only: **false**
580
+
581
+ <!-- NOTE: This has been generated via update-readme.js -->
582
+
583
+ - **browser_navigate**
584
+ - Title: Navigate to a URL
585
+ - Description: Navigate to a URL
586
+ - Parameters:
587
+ - `url` (string): The URL to navigate to
588
+ - Read-only: **false**
589
+
590
+ <!-- NOTE: This has been generated via update-readme.js -->
591
+
592
+ - **browser_navigate_back**
593
+ - Title: Go back
594
+ - Description: Go back to the previous page
595
+ - Parameters: None
596
+ - Read-only: **false**
597
+
598
+ <!-- NOTE: This has been generated via update-readme.js -->
599
+
600
+ - **browser_network_requests**
601
+ - Title: List network requests
602
+ - Description: Returns all network requests since loading the page
603
+ - Parameters:
604
+ - `includeStatic` (boolean): Whether to include successful static resources like images, fonts, scripts, etc. Defaults to false.
605
+ - `filename` (string, optional): Filename to save the network requests to. If not provided, requests are returned as text.
606
+ - Read-only: **true**
607
+
608
+ <!-- NOTE: This has been generated via update-readme.js -->
609
+
610
+ - **browser_press_key**
611
+ - Title: Press a key
612
+ - Description: Press a key on the keyboard
613
+ - Parameters:
614
+ - `key` (string): Name of the key to press or a character to generate, such as `ArrowLeft` or `a`
615
+ - Read-only: **false**
616
+
617
+ <!-- NOTE: This has been generated via update-readme.js -->
618
+
619
+ - **browser_resize**
620
+ - Title: Resize browser window
621
+ - Description: Resize the browser window
622
+ - Parameters:
623
+ - `width` (number): Width of the browser window
624
+ - `height` (number): Height of the browser window
625
+ - Read-only: **false**
626
+
627
+ <!-- NOTE: This has been generated via update-readme.js -->
628
+
629
+ - **browser_run_code**
630
+ - Title: Run Playwright code
631
+ - Description: Run Playwright code snippet
632
+ - Parameters:
633
+ - `code` (string): 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(); }`
634
+ - `filename` (string, optional): Filename to save the result to. If not provided, result is returned as JSON string.
635
+ - Read-only: **false**
636
+
637
+ <!-- NOTE: This has been generated via update-readme.js -->
638
+
639
+ - **browser_select_option**
640
+ - Title: Select option
641
+ - Description: Select an option in a dropdown
642
+ - Parameters:
643
+ - `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
644
+ - `ref` (string): Exact target element reference from the page snapshot
645
+ - `values` (array): Array of values to select in the dropdown. This can be a single value or multiple values.
646
+ - Read-only: **false**
647
+
648
+ <!-- NOTE: This has been generated via update-readme.js -->
649
+
650
+ - **browser_snapshot**
651
+ - Title: Page snapshot
652
+ - Description: Capture accessibility snapshot of the current page, this is better than screenshot
653
+ - Parameters:
654
+ - `filename` (string, optional): Save snapshot to markdown file instead of returning it in the response.
655
+ - Read-only: **true**
656
+
657
+ <!-- NOTE: This has been generated via update-readme.js -->
658
+
659
+ - **browser_take_screenshot**
660
+ - Title: Take a screenshot
661
+ - Description: Take a screenshot of the current page. You can't perform actions based on the screenshot, use browser_snapshot for actions.
662
+ - Parameters:
663
+ - `type` (string): Image format for the screenshot. Default is png.
664
+ - `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.
665
+ - `element` (string, optional): Human-readable element description used to obtain permission to screenshot the element. If not provided, the screenshot will be taken of viewport. If element is provided, ref must be provided too.
666
+ - `ref` (string, optional): Exact target element reference from the page snapshot. If not provided, the screenshot will be taken of viewport. If ref is provided, element must be provided too.
667
+ - `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.
668
+ - Read-only: **true**
669
+
670
+ <!-- NOTE: This has been generated via update-readme.js -->
671
+
672
+ - **browser_type**
673
+ - Title: Type text
674
+ - Description: Type text into editable element
675
+ - Parameters:
676
+ - `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
677
+ - `ref` (string): Exact target element reference from the page snapshot
678
+ - `text` (string): Text to type into the element
679
+ - `submit` (boolean, optional): Whether to submit entered text (press Enter after)
680
+ - `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.
681
+ - Read-only: **false**
682
+
683
+ <!-- NOTE: This has been generated via update-readme.js -->
684
+
685
+ - **browser_wait_for**
686
+ - Title: Wait for
687
+ - Description: Wait for text to appear or disappear or a specified time to pass
688
+ - Parameters:
689
+ - `time` (number, optional): The time to wait in seconds
690
+ - `text` (string, optional): The text to wait for
691
+ - `textGone` (string, optional): The text to wait for to disappear
692
+ - Read-only: **false**
693
+
694
+ </details>
695
+
696
+ <details>
697
+ <summary><b>Tab management</b></summary>
698
+
699
+ <!-- NOTE: This has been generated via update-readme.js -->
700
+
701
+ - **browser_tabs**
702
+ - Title: Manage tabs
703
+ - Description: List, create, close, or select a browser tab.
704
+ - Parameters:
705
+ - `action` (string): Operation to perform
706
+ - `index` (number, optional): Tab index, used for close/select. If omitted for close, current tab is closed.
707
+ - Read-only: **false**
708
+
709
+ </details>
710
+
711
+ <details>
712
+ <summary><b>Browser installation</b></summary>
713
+
714
+ <!-- NOTE: This has been generated via update-readme.js -->
715
+
716
+ - **browser_install**
717
+ - Title: Install the browser specified in the config
718
+ - Description: Install the browser specified in the config. Call this if you get an error about the browser not being installed.
719
+ - Parameters: None
720
+ - Read-only: **false**
721
+
722
+ </details>
723
+
724
+ <details>
725
+ <summary><b>Coordinate-based (opt-in via --caps=vision)</b></summary>
726
+
727
+ <!-- NOTE: This has been generated via update-readme.js -->
728
+
729
+ - **browser_mouse_click_xy**
730
+ - Title: Click
731
+ - Description: Click left mouse button at a given position
732
+ - Parameters:
733
+ - `element` (string): Human-readable element description used to obtain permission to interact with the element
734
+ - `x` (number): X coordinate
735
+ - `y` (number): Y coordinate
736
+ - Read-only: **false**
737
+
738
+ <!-- NOTE: This has been generated via update-readme.js -->
739
+
740
+ - **browser_mouse_drag_xy**
741
+ - Title: Drag mouse
742
+ - Description: Drag left mouse button to a given position
743
+ - Parameters:
744
+ - `element` (string): Human-readable element description used to obtain permission to interact with the element
745
+ - `startX` (number): Start X coordinate
746
+ - `startY` (number): Start Y coordinate
747
+ - `endX` (number): End X coordinate
748
+ - `endY` (number): End Y coordinate
749
+ - Read-only: **false**
750
+
751
+ <!-- NOTE: This has been generated via update-readme.js -->
752
+
753
+ - **browser_mouse_move_xy**
754
+ - Title: Move mouse
755
+ - Description: Move mouse to a given position
756
+ - Parameters:
757
+ - `element` (string): Human-readable element description used to obtain permission to interact with the element
758
+ - `x` (number): X coordinate
759
+ - `y` (number): Y coordinate
760
+ - Read-only: **false**
761
+
762
+ </details>
763
+
764
+ <details>
765
+ <summary><b>PDF generation (opt-in via --caps=pdf)</b></summary>
766
+
767
+ <!-- NOTE: This has been generated via update-readme.js -->
768
+
769
+ - **browser_pdf_save**
770
+ - Title: Save as PDF
771
+ - Description: Save page as PDF
772
+ - Parameters:
773
+ - `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.
774
+ - Read-only: **true**
775
+
776
+ </details>
777
+
778
+ <details>
779
+ <summary><b>Test assertions (opt-in via --caps=testing)</b></summary>
780
+
781
+ <!-- NOTE: This has been generated via update-readme.js -->
782
+
783
+ - **browser_generate_locator**
784
+ - Title: Create locator for element
785
+ - Description: Generate locator for the given element to use in tests
786
+ - Parameters:
787
+ - `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
788
+ - `ref` (string): Exact target element reference from the page snapshot
789
+ - Read-only: **true**
790
+
791
+ <!-- NOTE: This has been generated via update-readme.js -->
792
+
793
+ - **browser_verify_element_visible**
794
+ - Title: Verify element visible
795
+ - Description: Verify element is visible on the page
796
+ - Parameters:
797
+ - `role` (string): ROLE of the element. Can be found in the snapshot like this: `- {ROLE} "Accessible Name":`
798
+ - `accessibleName` (string): ACCESSIBLE_NAME of the element. Can be found in the snapshot like this: `- role "{ACCESSIBLE_NAME}"`
799
+ - Read-only: **false**
800
+
801
+ <!-- NOTE: This has been generated via update-readme.js -->
802
+
803
+ - **browser_verify_list_visible**
804
+ - Title: Verify list visible
805
+ - Description: Verify list is visible on the page
806
+ - Parameters:
807
+ - `element` (string): Human-readable list description
808
+ - `ref` (string): Exact target element reference that points to the list
809
+ - `items` (array): Items to verify
810
+ - Read-only: **false**
811
+
812
+ <!-- NOTE: This has been generated via update-readme.js -->
813
+
814
+ - **browser_verify_text_visible**
815
+ - Title: Verify text visible
816
+ - Description: Verify text is visible on the page. Prefer browser_verify_element_visible if possible.
817
+ - Parameters:
818
+ - `text` (string): TEXT to verify. Can be found in the snapshot like this: `- role "Accessible Name": {TEXT}` or like this: `- text: {TEXT}`
819
+ - Read-only: **false**
820
+
821
+ <!-- NOTE: This has been generated via update-readme.js -->
822
+
823
+ - **browser_verify_value**
824
+ - Title: Verify value
825
+ - Description: Verify element value
826
+ - Parameters:
827
+ - `type` (string): Type of the element
828
+ - `element` (string): Human-readable element description
829
+ - `ref` (string): Exact target element reference that points to the element
830
+ - `value` (string): Value to verify. For checkbox, use "true" or "false".
831
+ - Read-only: **false**
832
+
833
+ </details>
834
+
835
+ <details>
836
+ <summary><b>Tracing (opt-in via --caps=tracing)</b></summary>
837
+
838
+ <!-- NOTE: This has been generated via update-readme.js -->
839
+
840
+ - **browser_start_tracing**
841
+ - Title: Start tracing
842
+ - Description: Start trace recording
843
+ - Parameters: None
844
+ - Read-only: **true**
845
+
846
+ <!-- NOTE: This has been generated via update-readme.js -->
847
+
848
+ - **browser_stop_tracing**
849
+ - Title: Stop tracing
850
+ - Description: Stop trace recording
851
+ - Parameters: None
852
+ - Read-only: **true**
853
+
854
+ </details>
855
+
856
+
857
+ <!--- End of tools generated section -->