Skip to content
Hidden Logic Lab

Playwright MCP ships browser_run_code_unsafe on by default. The vendor calls it RCE-equivalent, and the profile persists unless you pass --isolated.

Published

Playwright MCP is Microsoft’s official Model Context Protocol server for Playwright. It lets a coding agent drive a real browser through structured accessibility snapshots — navigate, click, type, take screenshots, read console and network traffic, and evaluate JavaScript — rather than through a vision model. Publisher: Microsoft Corporation. License: Apache-2.0. npm: @playwright/mcp. MCP registry name: io.github.microsoft/playwright-mcp.

This review pins the latest stable release at research time, 0.0.86:

  • Git tag v0.0.86, commit 2337aff0213d28db41d3e3daf48cee19b3d0bd82. Commit date 19 November 2026, 02:49:18 Asia/Hong_Kong. The GitHub Release was published 02:50:38 the same morning.
  • npm @playwright/mcp@0.0.86, published 19 November 2026, 02:54:16 Asia/Hong_Kong. The registry gitHead is the same SHA as the tag. That package pins playwright and playwright-core to 1.66.0-alpha-2026-11-18.

The MCP implementation is not in the playwright-mcp tree. The repo’s own AGENTS.md says the server lives in microsoft/playwright, under packages/playwright-core/src/tools/: mcp/ is the server, and backend/ is the tools. The alpha’s registry gitHead is 8124fc39233c4c349b9dbebd4abc4103738eae81 (test: accept the context destroyed error in the worker evaluate test (#44195), 18 November 2026, 09:35:04 Asia/Hong_Kong).

At research time on 25 November 2026, 22:30 Asia/Hong_Kong, GitHub showed 40,128 stars and 3,497 forks. The repo is not archived. Created 22 March 2025, 01:48:36 Asia/Hong_Kong. Requires Node.js 20 or newer. Default-branch HEAD was the v0.0.86 tag itself. The npm registry listed 0.0.86 as latest. We pinned 0.0.86 and the alpha it declares, not a later Playwright tip.

How we reviewed this. Static review of a clone of microsoft/playwright-mcp at 2337aff, the npm 0.0.86 tarball (SHA-256 a72b824664ebf803f3ae57ad9500a50ede12af44203482e74bcc64f9149d6ea1, SHA-1 4e8403f75ce9355fde4661f60ecb6c0bd6edd4e9, 25,480 bytes; the registry shasum and sha512 integrity both matched), a sparse checkout of microsoft/playwright at 8124fc3 limited to packages/playwright-core/src/tools/, the imported defaultCacheDirectory helper in server/registry/index.ts at that commit, first-party docs in the tag (README, AGENTS.md, config.d.ts, SECURITY.md), and the npm playwright-core@1.66.0-alpha-2026-11-18 tarball (SHA-256 b2225299c14479f069a523adf141ea2bb890dc974c28fbce13d35134d61a86c0, SHA-1 10d3725d092c17fde9ae50944b47cfb406551dbd, 3,238,335 bytes; registry shasum and sha512 integrity both matched; unpacked size 13,999,960 bytes, 116 files). All seven files in the @playwright/mcp tarball — README.md, LICENSE, cli.js, index.js, index.d.ts, config.d.ts, package.json — were byte-identical to the tag. We confirmed that the compiled lib/coreBundle.js in the playwright-core tarball contains the same distinctive strings as the TypeScript we read, including browser_run_code_unsafe, RCE-equivalent, ms-playwright-mcp, allowUnrestrictedFileAccess, and page-provided, untrusted. We inspected package.json scripts before unpacking and did not run npm install. We did not run the MCP server, start Chrome or any Playwright browser, execute npx or install-browser, run tests that launch the server or a browser, log into any MCP client, or send live tool calls. We did not treat the rest of playwright-core — the browser engine, the 14 MB compiled tree outside the MCP strings we checked, or ThirdPartyNotices — as audited line by line. Review date 25 November 2026, Asia/Hong_Kong.

Verdict in plain language

Malware: We found no evidence of a malicious program in first-party source at 2337aff, in the npm 0.0.86 shim, or in the MCP TypeScript we read at 8124fc3 (high confidence, not absolute). There is no install, postinstall, or prepare hook on @playwright/mcp@0.0.86, playwright-core@1.66.0-alpha-2026-11-18, or the playwright wrapper at the same alpha. We did not find a hidden telemetry or exfil path in the MCP server or tool sources we read. This is not a runtime “confirmed clean” certificate. We did not execute the server, and we did not audit all of playwright-core.

Permission scope: Default MCP transport is stdio. Passing --port starts an HTTP server with Streamable HTTP at /mcp and legacy SSE at /sse. The default bind host is localhost; --host 0.0.0.0 binds all interfaces. DNS-rebinding protection is a Host-header allowlist that defaults to localhost and loopback plus the --host value; --allowed-hosts * turns that check off. We did not find an authentication gate on that HTTP path in the sources we read.

The default tool list is every tool whose capability starts with core, except those marked skillOnly. That is 25 tools in this pin, and it includes browser_run_code_unsafe and browser_evaluate. The vendor’s own schema describes browser_run_code_unsafe as executing arbitrary JavaScript in the Playwright server process and as RCE-equivalent. Cookie, localStorage, and storage-state tools stay behind --caps=storage. Vision, PDF, and DevTools tools stay behind --caps. Origin allow/block lists, the workspace file-access guard, and the secrets / redact-url-params filters are documented as conveniences, not security boundaries.

Unless you pass --isolated, the MCP server launches a persistent Chrome profile under the user cache directory, hashed by the client workspace path. That is not the everyday Chrome profile you browse with by hand, but it is not a throwaway temp directory either: cookies and site storage in that profile survive across sessions. --extension and --cdp-endpoint attach to a running browser and inherit whatever session that browser already has.

The honest risks are that default tool surface and that permission scope, not a trojan in the trees we read. Official getting-started snippets still install @playwright/mcp@latest.

The published package is a shim; the server lives in an alpha of playwright-core

At 2337aff, cli.js and index.js do almost no work of their own. The CLI loads playwright-core/lib/utilsBundle and playwright-core/lib/coreBundle, then calls tools.decorateMCPCommand. The library entry exports createConnection: tools.createConnection. .npmignore ships only the README, the license, the two entry files, and the type stubs. The npm tarball matches that list: seven files, about 97 KB unpacked.

A review that stopped at the playwright-mcp repo would miss the server. The tools, the default flags, the profile directory, and the HTTP transport all live in the pinned playwright-core alpha. That alpha is dated, not a stable Playwright release, and the repo documents that the pin is older than the tip of upstream main. Both playwright and playwright-core at this alpha carry SLSA provenance attestations on the registry; we verified the tarball hashes, not the provenance documents themselves.

Default browser selection in validateBrowserConfig is also easy to miss: if you do not set a browser name, the server uses chromium with channel chrome — the installed Chrome, not a bundled Chromium download. Headless defaults on only when the process is on Linux and DISPLAY is unset; otherwise the MCP path leaves the browser headed. npx @playwright/mcp@0.0.86 install-browser chrome is the documented way to install Chrome through this package. We did not run that installer.

browser_run_code_unsafe is on by default

filteredTools keeps every tool whose capability starts with core, plus whatever you add with --caps, and drops skillOnly tools from the MCP list. browser_run_code_unsafe is capability: 'core'. It is not behind a flag.

The tool description in that file is direct: “Run a Playwright code snippet. Unsafe: executes arbitrary JavaScript in the Playwright server process and is RCE-equivalent.” The implementation compiles the supplied function with Node’s vm module, binds the current Playwright page, and exposes a list of host globals to that context, including fetch, Buffer, and crypto. It can also load the snippet from a file via filename, resolved against the workspace root. Node’s vm is not a security sandbox. We did not attempt to escape it, and we are not publishing a proof of concept. The vendor already tells you what the tool is.

browser_evaluate is also a default core tool. That one runs in the page, not in the MCP server process: it evals the supplied expression in the page (or on an element). It is a different trust boundary from browser_run_code_unsafe, and a weaker one than a page already has if you have clicked or typed, but it is still on unless you take the tool away at the client.

There is no --no-run-code or equivalent in the CLI we read. If you do not want this tool, the control is on the MCP client: refuse the call, or do not expose the tool.

The default profile persists; --isolated is the opt-in

The README and the --user-data-dir help text say that if you do not specify a profile directory, “a temporary directory will be created.” The MCP launch path does not match that wording.

createBrowser takes the persistent path unless isolated is set, or unless you asked for a CDP, extension, or remote attach. resolveCLIConfigForMCP does not default isolated to true. --isolated and PLAYWRIGHT_MCP_ISOLATED are opt-in. (The Playwright CLI has a different defaulting function, resolveCLIConfigForCLI. This review is about the MCP server.)

When the persistent path runs, userDataDir defaults to a directory under defaultCacheDirectory() named ms-playwright-mcp/mcp-<browserToken>-<7-character SHA-256 of the client cwd>. On Linux that cache root is $XDG_CACHE_HOME or ~/.cache; on macOS, ~/Library/Caches; on Windows, %LOCALAPPDATA%. The same workspace therefore reopens the same profile. Cookies and site storage in that profile survive a client restart. They are still not, by default, the cookies from the Chrome profile you use by hand.

--isolated keeps the profile in memory and does not save it to disk. --user-data-dir points the persistent profile at a path you choose. --storage-state seeds an isolated context. --extension (Chrome/Edge, with the Playwright extension) and --cdp-endpoint attach to a browser you already started. The 0.0.86 release notes say that in extension mode, browser-wide changes such as setting or clearing cookies and granting permissions are now refused, but clients can still read browser-wide data such as cookies. Dedicated cookie and storage tools are opt-in, as below; evaluate, run-code, snapshots, and network details are not.

What the model can already read and do without extra caps

The 25 default MCP tools include navigation, tabs, snapshot, screenshot, click, type, fill, file upload and drop, dialogs, console, wait, window resize, and close. Two of them matter as much as run-code for a logged-in session.

browser_network_requests and browser_network_request are core. The detail tool is documented to return “full details (headers and body).” The implementation writes request and response headers into the tool result, including whatever Playwright surfaces on request.headers() and response.headers(). Cookie and authorization headers are not stripped by default. Request and response bodies are available through a part argument. The secrets map and --redact-url-params only rewrite values you listed in advance, and config.d.ts says both are conveniences, not a security feature. There is no default equivalent of a “redact network headers” flag in the sources we read.

browser_snapshot returns the accessibility tree of the page. That is the product’s intended interface, and it is also untrusted content: a page can put instructions into the tree. Microsoft closed a report about that class of issue (#1479) by pointing at the README’s security section. File uploads and downloads resolve names against the workspace root, or against the output directory (.playwright-mcp under the client cwd, or a temp dir if that cwd is not writable). Navigation to file: URLs is blocked unless --allow-unrestricted-file-access is on. The same flag lifts the workspace/output-directory file guard. The type stub and the README both say that guard is “not a secure boundary” and that a deliberate attempt to reach other directories “can be easily worked around.” Given that browser_run_code_unsafe is already a default core tool, that disclaimer is consistent with the rest of the design.

Cookie list/get/set, localStorage, sessionStorage, and storage-state tools are capability storage. Network mocks and network-state tools are capability network. Coordinate-based mouse tools are vision. PDF is pdf. Tracing, video, and the recorder are devtools. The CLI documents --caps as vision, pdf, devtools; the filter will also honor storage or network if you pass them. They are off until you do.

--allowed-origins and --blocked-origins restrict what the browser may request. The official help text says they do not serve as a security boundary and do not affect redirects. Default is to allow all origins.

Attach modes, HTTP, and page-registered tools

Default transport is stdio: the MCP client spawns npx @playwright/mcp@... and talks on standard input and output. --port switches that to HTTP. --host defaults to localhost and can be set to 0.0.0.0. The Host-header allowlist is real, and * disables it. We did not find a bearer token, path secret, or other authentication check on /mcp or /sse in http.ts. If you bind that port beyond loopback, the tool surface above is the authorization model.

WebMCP is on unless you pass --no-webmcp. The first-party browser_webmcp_list and browser_webmcp_call tools are skillOnly, so they do not appear in the default MCP tool list. Collection still happens with the page snapshot. Page-registered tools are then projected into MCP through dynamicTools() and can be called by name. The server labels them “page-provided, untrusted” in its own listing text. A page you navigate to can therefore add tools to the client’s tool list for that session.

The official README’s standard config, and the VS Code install badges, still use @playwright/mcp@latest. The Docker snippet on the same page uses mcr.microsoft.com/playwright/mcp with --pull=always. The 0.0.86 release notes tell you how to pin: npx @playwright/mcp@0.0.86.

When this is a poor fit

  • You would not give the model a shell on the machine that runs the MCP server, but you plan to leave browser_run_code_unsafe enabled in the client.
  • You assumed the default MCP launch was a throwaway profile. It is not: --isolated is off unless you pass it.
  • You plan to use --extension or --cdp-endpoint against a Chrome you already use for email, a bank, or a cloud console.
  • You wanted network headers or cookie values kept out of the model by default. They are not.
  • You cannot accept page-registered WebMCP tools appearing in the client, and you have not set --no-webmcp.
  • You wanted a pinned, auditable install but copied the official @playwright/mcp@latest snippet, or a Docker run with --pull=always.
  • You planned to put the HTTP transport on a non-loopback address and expected the server to authenticate callers.
  • You expected --allowed-origins, --blocked-origins, or the workspace file guard to be a security boundary. First-party docs say they are not.
  • You needed a stable Playwright runtime and did not want an alpha playwright-core pulled in as the implementation.

Bottom line

Playwright MCP is a genuine first-party browser MCP: the tools are real, the default transport is stdio, and the project is unusually blunt about not being a security boundary. No malware found in our static review of 2337aff, the npm 0.0.86 shim, and the MCP sources at 8124fc3. The honest risks are the default tool surface — especially browser_run_code_unsafe, which the vendor describes as RCE-equivalent — a persistent cache profile that is easy to mistake for a temporary one, and attach modes that can inherit a signed-in browser.

If you use it, pin @playwright/mcp@0.0.86 (or a later SHA you have actually read) instead of @latest; pass --isolated unless you intend the cache profile to keep cookies; do not turn on --extension or --cdp-endpoint against a Chrome you would not hand to the model; set --no-webmcp if you do not want page-registered tools in the client; keep the process on stdio or on loopback if you enable --port; and refuse or disable browser_run_code_unsafe in the client if that call is outside the job. The flags are in the product; several of the defaults are not the conservative setting.

Official sources: github.com/microsoft/playwright-mcp, tag v0.0.86, commit 2337aff, npm @playwright/mcp@0.0.86, playwright-core 1.66.0-alpha-2026-11-18 at commit 8124fc3, Playwright MCP README, AGENTS.md, config.d.ts.

More skill reviews

← All skill reviews