# 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.

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](https://github.com/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:

```bash
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

| Group | Tools |
| --- | --- |
| Navigate and act | `browser_navigate`, `browser_click`, `browser_type`, `browser_fill_form`, `browser_press_key`, `browser_select_option`, `browser_drag`, `browser_handle_dialog` |
| Files | `browser_file_upload` |
| Inspect | `browser_snapshot`, `browser_take_screenshot`, `browser_console_messages`, `browser_network_requests`, `browser_network_request` |
| Run code | `browser_evaluate`, `browser_run_code_unsafe` |
| Manage | `browser_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

| Flag | Effect |
| --- | --- |
| `--isolated` | Keeps the browser profile in memory and does not save it |
| `--headless` | Runs headless. The default is headed |
| `--allowed-origins`, `--blocked-origins` | Semicolon-separated origins the browser may request. The blocklist is checked first |
| `--user-data-dir` | Sets the profile folder |
| `--caps` | Adds capability groups. Leave it out to keep the core set |
| `--save-session` | Saves the MCP session into the output directory |

## Limit it in Claude Code

```bash
claude mcp add playwright -- npx @playwright/mcp@latest --isolated --blocked-origins "https://mail.example.com"
```

```json
{
  "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

```toml
[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](https://www.excellent.so/guides/keep-keys-and-email-out-of-agent-logs).
6. Read the [MCP security hub](https://www.excellent.so/guides/mcp-server-security), and for Chrome’s own server see the [Chrome DevTools guide](https://www.excellent.so/guides/chrome-devtools-mcp-server).

Checked against the vendor documentation on November 25, 2026. [microsoft/playwright-mcp](https://github.com/microsoft/playwright-mcp) · [Claude Code permissions](https://code.claude.com/docs/en/permissions) · [Codex MCP](https://developers.openai.com/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](https://www.excellent.so/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](https://www.excellent.so/r/sample).

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](https://www.excellent.so/agents) · [Pricing](https://www.excellent.so/pricing). Pro is US-only for now.

Source: https://www.excellent.so/guides/playwright-mcp-server
