Skip to content
← All guides

Playwright MCP server security: what it can reach

The Playwright MCP server drives a real browser. See its tools, the flags that limit it, and how to deny code tools in Claude Code and Codex.

4 min read

The Playwright MCP server is Microsoft’s browser automation server, and it runs on your Mac with npx @playwright/mcp@latest. Its tools click, type, upload files and run JavaScript in a real browser, so it reaches any site the browser can, including pages where you are signed in. The README says plainly that “Playwright MCP is not a security boundary.” Run it isolated and headless where you can, and deny the code tools.

Who maintains it and how it runs

The repository is microsoft/playwright-mcp. It is a local stdio server with no OAuth of its own. The browser is the credential. The README’s setup commands are:

claude mcp add playwright npx @playwright/mcp@latest
codex mcp add playwright npx "@playwright/mcp@latest"

@latest fetches the current release on each start. Pin a version if you want updates to be a decision.

What the tools can do

GroupTools
Navigate and actbrowser_navigate, browser_click, browser_type, browser_fill_form, browser_press_key, browser_select_option, browser_drag, browser_handle_dialog
Filesbrowser_file_upload
Inspectbrowser_snapshot, browser_take_screenshot, browser_console_messages, browser_network_requests, browser_network_request
Run codebrowser_evaluate, browser_run_code_unsafe
Managebrowser_tabs, browser_resize, browser_wait_for, browser_close, browser_get_config

Extra groups such as network, storage, devtools, vision and PDF tools are opt in through --caps. The server has no delete tool of its own. A browser logged in to a site can still delete things on that site by clicking.

Risks

  • Page content. Every page the browser loads is text the model reads, so a hostile page can steer the agent.
  • Your sessions. The --extension option connects to a running Edge or Chrome instance, which brings its logged-in sessions in. Without it, the default profile directory is a temporary one when --user-data-dir is unset.
  • Arbitrary code. browser_evaluate and browser_run_code_unsafe run JavaScript in the page.
  • Secrets. The README calls --secrets “a convenience and not a security feature.”
  • Origin lists. --allowed-origins defaults to allowing all, and the README says it “does not serve as a security boundary.”

Flags that limit it

FlagEffect
--isolatedKeeps the browser profile in memory and does not save it
--headlessRuns headless. The default is headed
--allowed-origins, --blocked-originsSemicolon-separated origins the browser may request. The blocklist is checked first
--user-data-dirSets the profile folder
--capsAdds capability groups. Leave it out to keep the core set
--save-sessionSaves the MCP session into the output directory

Limit it in Claude Code

claude mcp add playwright -- npx @playwright/mcp@latest --isolated --blocked-origins "https://mail.example.com"
{
  "permissions": {
    "deny": ["mcp__playwright__browser_run_code_unsafe", "mcp__playwright__browser_evaluate"],
    "ask": ["mcp__playwright__browser_file_upload", "mcp__playwright__browser_fill_form"]
  }
}

Limit it in Codex

[mcp_servers.playwright]
command = "npx"
args = ["@playwright/mcp@latest", "--isolated"]
disabled_tools = ["browser_run_code_unsafe", "browser_evaluate"]
default_tools_approval_mode = "prompt"

Checklist

  1. Use --isolated so no profile carries over.
  2. Never attach --extension to your everyday browser profile.
  3. Deny the two code tools unless a test needs them.
  4. Treat the origin flags as a seatbelt, since the README says they are not a boundary.
  5. Keep real passwords out of prompts and out of --secrets files. See keeping keys out of agent logs.
  6. Read the MCP security hub, and for Chrome’s own server see the Chrome DevTools guide.

Checked against the vendor documentation on November 25, 2026. microsoft/playwright-mcp · Claude Code permissions · Codex MCP

What Excellent covers

Excellent does not inspect MCP servers themselves. Its free scan reads supported logs on the Mac and reports findings for review. It reads the session logs of Claude Code, Codex, Grok Build, GitHub Copilot CLI, Gemini CLI and Qwen Code, so it can show what an agent did after it called a tool. It does not read Cursor’s, OpenClaw’s or Claude Cowork’s logs. For a local report without installing an app, run the free scan. Its script uses Python 3.9 or later when your Mac has it and the shell when it doesn’t, reads the logs locally and makes no network requests. See a sample report.

Excellent Pro adds checks before supported actions. Claude Code can display an ask prompt. With Codex, an Excellent “ask” refuses the action and tells the agent to ask you. Commands sent into an already running Codex shell fall outside that check. Agent coverage · Pricing. Pro is US-only for now.

Related guides

View all