Releases: microsoft/playwright-mcp
v0.0.48
v0.0.47
New ways to provide initial state
There are now multiple ways to provide the initial state to the browser context or a page.
For the storage state, you can either:
- Start with a user data directory using the
--user-data-dirargument. This will persist all browser data between the sessions. - Start with a storage state file using the
--storage-stateargument. This will load cookies and local storage from the file into an isolated browser context.
For the page state, you can use:
- ❗NEW❗
--init-pageto 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. You can use various Playwright APIs there, perform necessary steps, etc.
// init-page.ts
export default async ({ page }) => {
await page.context().grantPermissions(['geolocation']);
await page.context().setGeolocation({ latitude: 37.7749, longitude: -122.4194 });
await page.setViewportSize({ width: 1280, height: 720 });
};--init-scriptto 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.
This is useful for overriding browser APIs or setting up the environment.
// init-script.js
window.isPlaywrightMCP = true;New run-code command to save tokens
There now is a new browser_run_code command that allows LLM to run Playwright APIs as well. LLM can call it with a batch of Playwright APIs:
{
name: 'browser_run_code',
arguments: {
code: `
await page.getByRole("checkbox", { name: "Accept" }).check();
await page.getByRole("button", { name: "Submit" }).click();
`;
}
}This way LLM can speed up repetitive operations and save on context tokens.
Breaking changes
--allowed-origins and --blocked-origins flags are gone. Please use --proxy as a safer alternative or rely upon the underlying OS policies instead.
v0.0.46
Maintenance release
- fresh Playwright under the hood
- chore(mcp): log tool responses for debugging - microsoft/playwright#38110
v0.0.45
v0.0.44
Maintenance release
v0.0.43
MCP Changes Since Last Release
- Incremental page snapshots:
pageStatenow supports diffs. Unchanged subtrees are collapsed as- ref=<id> [unchanged]. Reduces noise and payload size. microsoft/playwright#37795 - Encourage relative path usage — MCP now suggests using relative paths for portability microsoft/playwright#37857
- Image size cap — Added limits on rendered image sizes to prevent resource overuse microsoft/playwright#37856
v0.0.42
- microsoft/playwright@47f3da3 feat(mcp): support test-id-attribute option (microsoft/playwright#37760)
v0.0.41
- microsoft/playwright@86a00d0 chore(mcp): handle cross-fs video moves (microsoft/playwright#37663)
- microsoft/playwright@52b2da8 chore(mcp): support --allowed-hosts=* (microsoft/playwright#37657)
- microsoft/playwright@9f371ad feat(mcp): console error and faster wait (microsoft/playwright#37618)
- microsoft/playwright@2d33cdd chore: do not rename video files outside --save-videos (microsoft/playwright#37616)
v0.0.40
Features
-
microsoft/playwright@c813e9cf5 feat(mcp): allow saving videos for sessions microsoft/playwright#37531
# video is saved from the creation of the page to the closure of the context (browser_close call). npx @playwright/mcp --save-video=800x600 -
microsoft/playwright@fff065816 feat(mcp): add --init-script option microsoft/playwright#37507
# the code in web-mocks.js will run on page initialization npx @playwright/mcp --init-script=./web-mocks.js -
microsoft/playwright@1313fbd47 chore(mcp): introduce allowed-hosts microsoft/playwright#37541
# Runs MCP server only accessible on 192.168.1.10, defense from DNS rebind npx @playwright/mcp --allowed-hosts=192.168.1.10:8080 --port=8080
Bugfixes
- microsoft/playwright@da333232e fix(mcp): snapshot for ai fixes microsoft/playwright#37527
- microsoft/playwright@499d084a5 fix(session): an extra check for session log microsoft/playwright#37508
- microsoft/playwright@2f820cb20 fix(mcp): lax file path sanitization microsoft/playwright#37502
v0.0.39
microsoft/playwright@afb59a0ec fix(mcp): tolerate malformed roots microsoft/playwright#37492
microsoft/playwright@0574514a0 feat(mcp): support shared browser context microsoft/playwright#37463