From 927e570c18955b0a98c51b9c01553acce4e8b1a5 Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Wed, 24 Sep 2025 17:07:37 -0700 Subject: [PATCH] chore: roll Playwright to latest (#1078) --- README.md | 14 +++++++++++++- config.d.ts | 23 ++++++++++++++++++++++- package-lock.json | 28 ++++++++++++++-------------- package.json | 10 ++++++---- 4 files changed, 55 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index a00d721..e704052 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,10 @@ Playwright MCP server supports following arguments. They can be provided in the ``` > npx @playwright/mcp@latest --help + --allowed-hosts comma-separated list of hosts this + server is allowed to serve from. + Defaults to the host the server is bound + to. --allowed-origins semicolon-separated list of origins to allow the browser to request. Default is to allow all. @@ -217,6 +221,11 @@ Playwright MCP server supports following arguments. They can be provided in the localhost. Use 0.0.0.0 to bind to all interfaces. --ignore-https-errors ignore https errors + --init-script 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. --isolated keep the browser profile in memory, do not save it to disk. --image-responses whether to send image responses to the @@ -236,6 +245,9 @@ Playwright MCP server supports following arguments. They can be provided in the session into the output directory. --save-trace Whether to save the Playwright Trace of the session into the output directory. + --save-video Whether to save the video of the session + into the output directory. For example + "--save-video=800x600" --secrets path to a file containing secrets in the dotenv format --shared-browser-context reuse the same browser context between @@ -251,7 +263,7 @@ Playwright MCP server supports following arguments. They can be provided in the specified, a temporary directory will be created. --viewport-size specify browser viewport size in pixels, - for example "1280, 720" + for example "1280x720" ``` diff --git a/config.d.ts b/config.d.ts index 1f30cf5..e89bfd9 100644 --- a/config.d.ts +++ b/config.d.ts @@ -16,7 +16,7 @@ import type * as playwright from 'playwright'; -export type ToolCapability = 'core' | 'core-tabs' | 'core-install' | 'vision' | 'pdf' | 'verify'; +export type ToolCapability = 'core' | 'core-tabs' | 'core-install' | 'vision' | 'pdf' | 'testing' | 'tracing'; export type Config = { /** @@ -68,6 +68,12 @@ export type Config = { * Remote endpoint to connect to an existing Playwright server. */ remoteEndpoint?: string; + + /** + * Paths to JavaScript files to add as initialization scripts. + * The scripts will be evaluated in every page before any of the page's scripts. + */ + initScript?: string[]; }, server?: { @@ -80,6 +86,12 @@ export type Config = { * The host to bind the server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces. */ host?: string; + + /** + * The hosts this server is allowed to serve from. Defaults to the host server is bound to. + * This is not for CORS, but rather for the DNS rebinding protection. + */ + allowedHosts?: string[]; }, /** @@ -100,6 +112,14 @@ export type Config = { */ saveTrace?: boolean; + /** + * If specified, saves the Playwright video of the session into the output directory. + */ + saveVideo?: { + width: number; + height: number; + }; + /** * Reuse the same browser context between all connected HTTP clients. */ @@ -146,3 +166,4 @@ export type Config = { */ imageResponses?: 'allow' | 'omit'; }; + diff --git a/package-lock.json b/package-lock.json index 9cf2f66..60178d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,15 +9,15 @@ "version": "0.0.39", "license": "Apache-2.0", "dependencies": { - "playwright": "1.56.0-alpha-1758292576000", - "playwright-core": "1.56.0-alpha-1758292576000" + "playwright": "1.56.0-alpha-1758750661000", + "playwright-core": "1.56.0-alpha-1758750661000" }, "bin": { "mcp-server-playwright": "cli.js" }, "devDependencies": { "@modelcontextprotocol/sdk": "^1.17.5", - "@playwright/test": "1.56.0-alpha-1758292576000", + "@playwright/test": "1.56.0-alpha-1758750661000", "@types/node": "^24.3.0", "zod-to-json-schema": "^3.24.6" }, @@ -50,13 +50,13 @@ } }, "node_modules/@playwright/test": { - "version": "1.56.0-alpha-1758292576000", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.56.0-alpha-1758292576000.tgz", - "integrity": "sha512-U5SLVseO2I8yDg2lSMPrlTR08KBTyIrFFi1EP23LSxdQ+jKsnOdQdHzUCY+qXQWIMC24eNtgPWYPmh9hgf1kAA==", + "version": "1.56.0-alpha-1758750661000", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.56.0-alpha-1758750661000.tgz", + "integrity": "sha512-sQT1R0BDA/+KYSx8fCps7i0RGB/EyakmXN+xoYCj5F7oDvJo8lr9urEbnP5RytBfsYoqBqNkIGdCbyebF4+a0A==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright": "1.56.0-alpha-1758292576000" + "playwright": "1.56.0-alpha-1758750661000" }, "bin": { "playwright": "cli.js" @@ -825,12 +825,12 @@ } }, "node_modules/playwright": { - "version": "1.56.0-alpha-1758292576000", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.56.0-alpha-1758292576000.tgz", - "integrity": "sha512-XRTRlArx9KgiGsboXUpJR7ZDazUPfO51t1nrQ+w883e02/IDNxcqPpQXJcFAy4nFqG925r//VR9AyseVfw1AWg==", + "version": "1.56.0-alpha-1758750661000", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.56.0-alpha-1758750661000.tgz", + "integrity": "sha512-15C/m7NPpAmBX2MFMrepCMj18ksBYvhbT90cvFjG2iBs2YPqO2U4f9OjcX207ITSmDAAJ8pWBlJutcZUYUERXg==", "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.56.0-alpha-1758292576000" + "playwright-core": "1.56.0-alpha-1758750661000" }, "bin": { "playwright": "cli.js" @@ -843,9 +843,9 @@ } }, "node_modules/playwright-core": { - "version": "1.56.0-alpha-1758292576000", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.56.0-alpha-1758292576000.tgz", - "integrity": "sha512-qXLOCI9RhulhdvNjFglvgoyUw3N49putP8iU0uhoZ+mE3lEXAJNy/v1znCRvhjwvfsGsabO9+Xe4sfvu2GFGCw==", + "version": "1.56.0-alpha-1758750661000", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.56.0-alpha-1758750661000.tgz", + "integrity": "sha512-ivP4xjc6EHkUqF80pMFfDRijKLEvO64qC6DTgyYrbsyCo8gugkqwKm6lFWn4W47g4S8juoUwQhlRVjM2BJ+ruA==", "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" diff --git a/package.json b/package.json index 7c2de8e..2fad9b2 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,9 @@ "ftest": "playwright test --project=firefox", "wtest": "playwright test --project=webkit", "dtest": "MCP_IN_DOCKER=1 playwright test --project=chromium-docker", - "npm-publish": "npm run clean && npm run test && npm publish" + "npm-publish": "npm run clean && npm run test && npm publish", + "copy-config": "cp ../playwright/packages/playwright/src/mcp/config.d.ts . && perl -pi -e \"s|import type \\* as playwright from 'playwright-core';|import type * as playwright from 'playwright';|\" ./config.d.ts", + "roll": "npm run copy-config && npm run lint" }, "exports": { "./package.json": "./package.json", @@ -33,15 +35,15 @@ } }, "dependencies": { - "playwright": "1.56.0-alpha-1758292576000", - "playwright-core": "1.56.0-alpha-1758292576000" + "playwright": "1.56.0-alpha-1758750661000", + "playwright-core": "1.56.0-alpha-1758750661000" }, "bin": { "mcp-server-playwright": "cli.js" }, "devDependencies": { "@modelcontextprotocol/sdk": "^1.17.5", - "@playwright/test": "1.56.0-alpha-1758292576000", + "@playwright/test": "1.56.0-alpha-1758750661000", "@types/node": "^24.3.0", "zod-to-json-schema": "^3.24.6" }