@playwright/mcp 0.0.46 → 0.0.47-alpha-2025-11-15
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 +40 -9
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -270,15 +270,6 @@ Playwright MCP server supports following arguments. They can be provided in the
|
|
|
270
270
|
server is allowed to serve from.
|
|
271
271
|
Defaults to the host the server is bound
|
|
272
272
|
to. Pass '*' to disable the host check.
|
|
273
|
-
--allowed-origins <origins> semicolon-separated list of origins to
|
|
274
|
-
allow the browser to request. Default is
|
|
275
|
-
to allow all.
|
|
276
|
-
--blocked-origins <origins> semicolon-separated list of origins to
|
|
277
|
-
block the browser from requesting.
|
|
278
|
-
Blocklist is evaluated before allowlist.
|
|
279
|
-
If used without the allowlist, requests
|
|
280
|
-
not matching the blocklist are still
|
|
281
|
-
allowed.
|
|
282
273
|
--block-service-workers block service workers
|
|
283
274
|
--browser <browser> browser or chrome channel to use,
|
|
284
275
|
possible values: chrome, firefox,
|
|
@@ -307,6 +298,8 @@ Playwright MCP server supports following arguments. They can be provided in the
|
|
|
307
298
|
localhost. Use 0.0.0.0 to bind to all
|
|
308
299
|
interfaces.
|
|
309
300
|
--ignore-https-errors ignore https errors
|
|
301
|
+
--init-page <path...> path to TypeScript file to evaluate on
|
|
302
|
+
Playwright page object
|
|
310
303
|
--init-script <path...> path to JavaScript file to add as an
|
|
311
304
|
initialization script. The script will
|
|
312
305
|
be evaluated in every page before any of
|
|
@@ -402,6 +395,35 @@ state [here](https://playwright.dev/docs/auth).
|
|
|
402
395
|
|
|
403
396
|
The Playwright MCP Chrome Extension allows you to connect to existing browser tabs and leverage your logged-in sessions and browser state. See [extension/README.md](extension/README.md) for installation and setup instructions.
|
|
404
397
|
|
|
398
|
+
### Initial state
|
|
399
|
+
|
|
400
|
+
There are multiple ways to provide the initial state to the browser context or a page.
|
|
401
|
+
|
|
402
|
+
For the storage state, you can either:
|
|
403
|
+
- Start with a user data directory using the `--user-data-dir` argument. This will persist all browser data between the sessions.
|
|
404
|
+
- 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.
|
|
405
|
+
|
|
406
|
+
For the page state, you can use:
|
|
407
|
+
|
|
408
|
+
- `--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.
|
|
409
|
+
|
|
410
|
+
```ts
|
|
411
|
+
// init-page.ts
|
|
412
|
+
export default async ({ page }) => {
|
|
413
|
+
await page.context().grantPermissions(['geolocation']);
|
|
414
|
+
await page.context().setGeolocation({ latitude: 37.7749, longitude: -122.4194 });
|
|
415
|
+
await page.setViewportSize({ width: 1280, height: 720 });
|
|
416
|
+
};
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
- `--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.
|
|
420
|
+
This is useful for overriding browser APIs or setting up the environment.
|
|
421
|
+
|
|
422
|
+
```js
|
|
423
|
+
// init-script.js
|
|
424
|
+
window.isPlaywrightMCP = true;
|
|
425
|
+
```
|
|
426
|
+
|
|
405
427
|
### Configuration file
|
|
406
428
|
|
|
407
429
|
The Playwright MCP server can be configured using a JSON configuration file. You can specify the configuration file
|
|
@@ -708,6 +730,15 @@ http.createServer(async (req, res) => {
|
|
|
708
730
|
|
|
709
731
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
710
732
|
|
|
733
|
+
- **browser_run_code**
|
|
734
|
+
- Title: Run Playwright code
|
|
735
|
+
- Description: Run Playwright code snippet
|
|
736
|
+
- Parameters:
|
|
737
|
+
- `code` (string): Playwright code snippet to run. The snippet should access the `page` object to interact with the page. Can make multiple statements. For example: `await page.getByRole('button', { name: 'Submit' }).click();`
|
|
738
|
+
- Read-only: **false**
|
|
739
|
+
|
|
740
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
741
|
+
|
|
711
742
|
- **browser_select_option**
|
|
712
743
|
- Title: Select option
|
|
713
744
|
- Description: Select an option in a dropdown
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playwright/mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.47-alpha-2025-11-15",
|
|
4
4
|
"description": "Playwright Tools for MCP",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,15 +37,15 @@
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"playwright": "1.57.0-alpha-2025-11-
|
|
41
|
-
"playwright-core": "1.57.0-alpha-2025-11-
|
|
40
|
+
"playwright": "1.57.0-alpha-2025-11-14",
|
|
41
|
+
"playwright-core": "1.57.0-alpha-2025-11-14"
|
|
42
42
|
},
|
|
43
43
|
"bin": {
|
|
44
44
|
"mcp-server-playwright": "cli.js"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@modelcontextprotocol/sdk": "^1.17.5",
|
|
48
|
-
"@playwright/test": "1.57.0-alpha-2025-11-
|
|
48
|
+
"@playwright/test": "1.57.0-alpha-2025-11-14",
|
|
49
49
|
"@types/node": "^24.3.0",
|
|
50
50
|
"zod-to-json-schema": "^3.24.6"
|
|
51
51
|
}
|