AI Review Ready
Home / MCP scans / Playwright MCP
MCP server · microsoft/playwright-mcp

Playwright MCP: security facts and safe setup

Playwright MCP lets an AI agent drive a real browser. That is useful and risky in the same breath. Below is what its own README says about security, and the settings that shrink the blast radius.

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

Repositorymicrosoft/playwright-mcp · Apache-2.0 · about 40,000 GitHub stars
Checked26 Nov 2026, README at commit 2337aff
Documented tools72 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 defaultbrowser_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 READMEnpx @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

  1. A tool that runs code on your machine is on by default. browser_run_code_unsafe is listed under core automation, not behind a --caps flag, 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.
  2. 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.
  3. 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-access removes it entirely.
  4. Origin lists don't stop a determined page. --allowed-origins and --blocked-origins "do not serve as a security boundary and do not affect redirects."
  5. Secret masking is cosmetic. The secrets option replaces matching text in tool output, but "is a convenience and not a security feature."
  6. Network exposure. The HTTP mode binds to localhost by default; --host 0.0.0.0 exposes 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.
  • --isolated keeps 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_evaluate and browser_file_upload. Most clients let you deny or always-ask per tool.
  • Don't add --allow-unrestricted-file-access, --no-sandbox or --host 0.0.0.0 unless 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

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.