Short answer: Playwright MCP is not a security boundary, in its maintainers' own words. Run it with
--isolated, don't give it your everyday logged-in browser, keep it bound to localhost, pin the package version, and require approval for the code-running tools.Facts from the README
| Repository | microsoft/playwright-mcp · Apache-2.0 · about 40,000 GitHub stars |
|---|---|
| Checked | 26 Nov 2026, README at commit 2337aff |
| Documented tools | 72 in total; 29 marked read-only, 43 not. 25 are on by default (core automation and tab management); the rest are opt-in with --caps. |
| Code execution, on by default | browser_run_code_unsafe: "executes arbitrary JavaScript in the Playwright server process and is RCE-equivalent." Also browser_evaluate (runs JavaScript in the page). |
| Install command in README | npx @playwright/mcp@latest: @latest downloads whatever version is newest each time your editor starts (unpinned). |
| Security statement | "Playwright MCP is not a security boundary." |
The risks, in plain words
- A tool that runs code on your machine is on by default.
browser_run_code_unsafeis listed under core automation, not behind a--capsflag, and the README describes it as RCE-equivalent. Any web page the agent reads can contain instructions (prompt injection) that try to get the agent to call it. - Your logins live in a persistent profile. By default the browser profile is saved to disk ("All the logged in information will be stored in the persistent profile"), at
%USERPROFILE%\AppData\Local\ms-playwright\mcp-…on Windows,~/Library/Caches/ms-playwright/mcp-…on macOS and~/.cache/ms-playwright/mcp-…on Linux. If you log in to email or admin panels there, the agent can act as you. - File limits are a guardrail, not a wall. File access is limited to the workspace by default, but the config docs say this is "a convenience defense … not a secure boundary; a deliberate attempt to reach other directories can be easily worked around."
--allow-unrestricted-file-accessremoves it entirely. - Origin lists don't stop a determined page.
--allowed-originsand--blocked-origins"do not serve as a security boundary and do not affect redirects." - Secret masking is cosmetic. The
secretsoption replaces matching text in tool output, but "is a convenience and not a security feature." - Network exposure. The HTTP mode binds to localhost by default;
--host 0.0.0.0exposes it to your network, and--allowed-hosts '*'disables the host check.
Safer setup
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@<exact-version>", "--isolated"]
}
}
}
- Pin the version instead of
@latest, and update on purpose. --isolatedkeeps the profile in memory, so nothing persists between sessions. If a task needs a login, use a throwaway test account and--storage-state, never your personal browser.- Require approval in your MCP client for
browser_run_code_unsafe,browser_evaluateandbrowser_file_upload. Most clients let you deny or always-ask per tool. - Don't add
--allow-unrestricted-file-access,--no-sandboxor--host 0.0.0.0unless you know exactly why. - Point the agent only at sites you trust for the task; treat every page it reads as untrusted input.
Check your own config in 10 seconds with the MCP config checker (runs in your browser).
For security reviews
If your product uses Playwright MCP, a buyer's questionnaire will ask how agent tools are restricted. A good answer names the pinned version, --isolated, the tools that need human approval, and the test account used. See how to answer the MCP question.
Sources
- Playwright MCP README (Security section, configuration options, tool list): github.com/microsoft/playwright-mcp @ 2337aff
- MCP security best practices (linked from the README): modelcontextprotocol.io
Facts copied from the project's own documentation on 26 Nov 2026. This page has no grade: we grade only servers we've hand-checked (methodology). Maintainers: tell us if anything is out of date.