Playwright MCP server security

Which settings in the official Playwright MCP server restrict browser access, file access and secrets, and which of them the docs say are convenience defenses rather than security boundaries.

On this page

Playwright MCP server security: does it meet a browser-agent control requirement?

A security team deciding whether an AI agent may drive a browser through the Playwright MCP server from Microsoft will find built-in restriction options: a --caps capabilities flag, --allowed-origins and --blocked-origins lists, a file-access guardrail, a --secrets redaction option and a --sandbox / --no-sandbox toggle. The configuration docs, however, call the origin lists, the file guardrail and secrets redaction convenience defenses rather than security boundaries, because origin lists do not apply to redirects and can be worked around deliberately. Real isolation therefore has to come from client-level permissions and the environment the server runs in, not from these flags alone. Treat the flags as reducing accidental exposure, and treat the enforced boundary as something you build around them.

Start by deciding which tool groups the agent actually needs. The capabilities option enables optional groups (network, storage, testing, vision, pdf, devtools and config), so leaving the defaults in place is a decision too. Pair that with an explicit origin allowlist for the sites the work requires, and confirm how your client enforces its own permission prompts for each tool call. Then decide where the browser runs: a dedicated, low-privilege user account or container, with no access to corporate file shares, credential stores or internal networks the agent does not need. Plan for the gaps the docs leave open, including redirects that leave an allowed origin, the --init-script option that runs scripts on every page, and the --ignore-https-errors setting, which weakens transport checks and should be confirmed as off in any production-like profile.

The topic facts do not cover single sign-on, audit logging, role-based access control or central admin policy for the Playwright MCP server, so do not assume any of them exists in the server itself. Check the Playwright MCP configuration options page and the microsoft/playwright-mcp README for each control you need, and ask the maintainers or your client vendor where any missing control would come from. If you need an audit trail of what the agent clicked or typed, confirm whether it exists at the client, the host or the infrastructure layer before approval. Record the answers in the rollout decision, because the reviewer will ask which control enforces each requirement.

Playwright MCP security controls by capability

This table compares the Playwright MCP server settings that restrict browser access, file access, secrets and browser behavior. Read the documented status column first: several settings are convenience defenses rather than security boundaries, so they should not be the only control you rely on. Confirm any edition or plan differences with Microsoft or the Playwright project, since the docs we reviewed do not describe a paid tier for these options.

SettingWhat it doesDocumented statusWhere it is set
Capabilities (--caps)Enables optional tool groups: network, storage, testing, vision, pdf, devtools and configControl over which tools are exposed, not a guard on what enabled tools doCommand-line flag --caps or the capabilities option in configuration
Allowed and blocked originsSemicolon-separated origin lists; blocked origins are evaluated firstConvenience defense; does not cover redirects and can be worked around deliberately--allowed-origins and --blocked-origins flags or configuration
File access guardrailBlocks access outside workspace roots and file:// navigation by defaultConvenience defense; not a security boundaryEnabled by default; lifted only with --allow-unrestricted-file-access
Secrets (--secrets)Keeps values the LLM should not see in a dotenv file; matching text in tool responses is redactedConvenience, not a security boundary; redaction depends on text matching--secrets option pointing to a dotenv file
Browser sandbox (--sandbox / --no-sandbox)Enables or disables the browser sandboxBrowser-level isolation setting; confirm its interaction with your host OS and container setup--sandbox or --no-sandbox flags
Ignore HTTPS errorsAllows the browser to proceed past certificate errors, as listed in the config schemaWeakens transport checks; confirm whether any environment should ever enable itConfiguration schema option
Init script (--init-script)Adds scripts that run on every page the browser loadsRuns code in every page context; review each script like any code you deploy--init-script flag or configuration

How the server decides what the agent can reach

The Playwright MCP server runs as a local process that the MCP client starts, typically through npx with the @playwright/mcp package. Access is shaped by four components working together: the MCP client that sends tool calls, the server that exposes those tools, the browser the server drives, and the settings that filter requests and responses along the way. The capabilities option (--caps on the command line) decides which optional tool groups exist at all, including network, storage, testing, vision, pdf, devtools and config. A group that is not enabled never reaches the model, so turning groups off is the strongest reduction in reach the server offers. Before approving a deployment, confirm which groups the client configuration enables and whether any of them is needed for the intended task.

Origin lists are applied to navigation requests made through the browser. --allowed-origins and --blocked-origins take semicolon-separated lists, and blocked origins are evaluated first, so an origin on both lists is refused. The documentation is explicit that these lists do not cover redirects, so a permitted page that redirects to a blocked origin can still reach it. The same applies to the file-access guardrail, which blocks file access outside the workspace roots and file:// navigation unless --allow-unrestricted-file-access is set. Treat both as convenience defenses. The documentation says they can be worked around deliberately and advises relying on client-level permissions for real isolation, so the review should record which client controls approve tool use and where the browser process itself is allowed to run.

Secret redaction works on tool responses. Values the model should not see are kept in a dotenv file passed through the --secrets option, and matching text is redacted before it reaches the LLM. The docs call this a convenience, not a security boundary, so secrets should never be placed in pages the agent can browse to in the first place. The --sandbox and --no-sandbox options control the browser's own sandbox, and the --init-script option injects scripts into every page, which changes what the browser exposes to the agent. Ask the team to confirm the sandbox setting for each host and to list any init scripts in use, since neither appears in the default client configuration.

Decisions to make before approving the server

Each decision below changes what an agent can reach in a browser and on disk. The docs treat several of these settings as convenience defenses, so the approval decision depends on how each one is backed by client permissions or a separate isolation layer.

Capability groups to enable

The --caps option turns on optional tool groups: network, storage, testing, vision, pdf, devtools and config. Each group adds reach that the default setup does not need. Keep network, storage and devtools off unless a specific workflow requires them, since storage exposes browser state and devtools exposes page internals. Confirm the exact group names against the current configuration page before writing them into a client config, and record which groups each approved team uses.

Configuration options

Origin allowlist and redirect risk

The --allowed-origins and --blocked-origins settings are semicolon-separated lists, and blocked origins are evaluated first. The docs say these lists are a convenience defense, not a security boundary, because they do not account for redirects and can be worked around on purpose. Decide which domains the agent needs, then pair the list with client-level permissions and network controls outside the server. Test whether a permitted page can redirect to a blocked origin before you rely on the list.

Origin options

Workspace roots and unrestricted file access

By default, file access outside the workspace roots and file:// navigation are blocked. The --allow-unrestricted-file-access flag removes that guardrail, and it lets the agent read and write local files the browser can reach. Treat this flag as a decision that needs a named owner and a written reason. For most reviews, the answer is to leave it unset and confirm which workspace roots the client passes to the server.

File access options

Ownership of the secrets dotenv file

The --secrets option points to a dotenv file whose values the LLM should not see. Matching text in tool responses is redacted, but the docs call this a convenience, not a security boundary. Decide where the file sits, who can write to it, and which credentials belong in it. Keep it out of the repository, restrict its file permissions to the developer or service account that runs the server, and test that a known test value does not appear in a tool response.

Secrets option

Browser sandbox or container isolation

The --sandbox and --no-sandbox options enable or disable the browser sandbox, and the config schema also includes an ignore-HTTPS-errors option and --init-script for scripts that run on every page. Turning the sandbox off, or ignoring certificate errors, weakens the browser's own isolation. Decide whether the server runs on a developer laptop, in a container, or on a separate host with its own network policy. Ask the team to state which layer provides isolation, because the docs do not present the browser sandbox as a complete boundary.

Sandbox options

Client permissions that gate tool use

The docs advise relying on client-level permissions for real isolation, so the MCP client's approval prompts and tool allowlists become the main control. Decide which tools require a human approval step, which run without one, and whether teams can change this setting themselves. Ask each client vendor how its permissions are enforced and whether an administrator can set them centrally. Record the answers so the approval covers the client that staff actually use.

Project README

How the answer changes by situation

Most staff will meet the server through the default local setup, where the client starts @playwright/mcp@latest with npx on the employee's own machine. The browser runs under that user's operating system account, so the server can reach whatever that account can reach, including open sessions and saved profiles. The controls that matter most here are the ones the employee's client enforces and the ones you pin centrally.

  • Version pinning: the standard configuration uses @latest, so each start can pull a new release. Ask whether your teams will pin a specific version.
  • Origin lists: --allowed-origins and --blocked-origins narrow navigation, but the docs say they are not a security boundary.
  • File access: confirm that file access stays limited to workspace roots and that --allow-unrestricted-file-access is not set.
  • Capabilities: keep optional groups such as network, storage and devtools off unless a task needs them, using --caps.
  • Node.js version: the README and the getting started page disagree on the minimum, so confirm the current requirement before standardizing.

Confirm with your client vendor how it stores and approves MCP server configuration, and whether employees can add servers that you have not reviewed.

Order of work before production use

This sequence moves the Playwright MCP server from a default local install to a configuration that a reviewer can approve. Each step narrows what the agent can reach, and each retest confirms that the previous restriction still holds.

  1. Confirm the Node.js version first

    The platform or tooling owner checks the current requirement before anything is pinned. The repository README lists Node.js 18 or newer, while the Playwright getting started page lists Node.js 20 or newer, so the two sources conflict. Ask Microsoft or confirm on the live pages which version is current, then record the chosen runtime in the deployment notes. The step is done when one version is written down and every test machine runs it.

  2. Set the capability groups

    The engineering lead enables only the optional tool groups the use case needs, using the capabilities option (the --caps flag). The available groups are network, storage, testing, vision, pdf, devtools and config, and each one adds tools the agent can call. Start from the smallest set that completes the task, and treat any group that touches storage or network as a separate review item. The step is done when the launch configuration lists the groups and a reviewer has signed off on each one.

  3. Define origin lists and test redirects

    The security reviewer sets allowed and blocked origins using --allowed-origins and --blocked-origins. Blocked origins are evaluated first, and the lists are semicolon-separated. Then the tester attempts navigation to blocked hosts directly and through redirects from allowed pages. The docs state these lists are a convenience defense, not a security boundary, because they do not cover redirects and can be worked around deliberately. The step is done when a redirect test to a blocked origin fails, and the result is recorded with the expectation that network egress controls will still be required.

  4. Set workspace roots and file access

    The engineer defines the workspace roots the server may read and write and confirms that --allow-unrestricted-file-access is not set. By default, file access outside the workspace roots and file:// navigation are blocked. The tester tries to read a file outside the roots and to open a file:// URL through the agent. The step is done when both attempts are refused in the logs, and the flag is absent from every launch configuration.

  5. Create a secrets file for test credentials only

    The engineer creates a dotenv file for the --secrets option that holds only test credentials, never production passwords or session tokens. The docs say matching text in tool responses is redacted, but they describe this as a convenience, not a security boundary, so the file should contain nothing that would cause harm if it leaked. The tester runs a flow that uses a test login and checks that the value does not appear in agent output. The step is done when the file is scoped to a test account and the redaction check passes.

  6. Decide the browser sandbox setting

    The platform owner chooses whether to use --sandbox or --no-sandbox, which enables or disables the browser sandbox, and records the reason. Review the ignore-HTTPS-errors option and --init-script as well, since an init script runs on every page and an ignored certificate error weakens transport checks. Confirm that neither is enabled unless a documented need exists. The step is done when the chosen settings and their justifications appear in the configuration review record.

  7. Enforce client-level tool approvals

    The IT administrator configures the MCP client, such as VS Code, Cursor, Claude Desktop or another client named in the README, so that tool calls require approval or are limited to a reviewed list. The docs advise relying on client-level permissions for real isolation, so this step carries the main enforcement. The tester confirms that a navigation or file action outside the approved list is blocked or prompts a user. The step is done when a client-side denial is demonstrated and documented for each client in use.

  8. Retest after each change

    The security team reruns the same test set after every change to capabilities, origins, file roots, secrets or client permissions, and again after any server version update. Because the server is installed with @playwright/mcp@latest in the standard configuration, a version change can alter behavior without a config change, so pin the version the team approved. The step is done when the test results match the approved baseline and the findings, fixes and retest outcomes are recorded for the rollout decision.

What reported incidents would test in this server

The researched facts for this server list no reported security incident, advisory or CVE, so this page cannot tell you that the Playwright MCP server has or has not been exploited. Treat that gap as a finding in itself. Before approval, search the microsoft/playwright-mcp README and the repository's issues, security advisories and release notes for the package @playwright/mcp, and ask Microsoft or the Playwright project in writing whether they hold any private security reports. Record the date of the search and the versions you reviewed, because the README's npx setup runs @playwright/mcp@latest, which means the code you tested may not be the code that runs next week. Pin a version in your own configuration once you have chosen one.

The attack class a reviewer should assume is prompt injection from web page content. The agent reads pages it did not choose, so any page can carry instructions aimed at the model. Test the controls in the order that matters for this threat. First, --allowed-origins and --blocked-origins: confirm that a page on a blocked origin cannot be reached by a redirect, a link or a scripted navigation, and remember that the docs say these lists do not affect redirects and can be worked around deliberately. Second, the file guardrail: confirm that a page cannot cause navigation to file:// URLs or reads outside the workspace roots, and that --allow-unrestricted-file-access is absent from the launch command. Third, --secrets: plant a test value in the dotenv file, have a page ask the agent to echo it, and check whether it appears in tool output or outbound traffic. The docs call redaction a convenience, so a miss there is expected behavior, not a bug.

Last, test the controls the docs treat as real isolation: client-level permissions and the browser sandbox set by --sandbox or --no-sandbox. Confirm that the client asks for approval before the agent navigates, types, uploads or runs script, and that the --caps groups (network, storage, testing, vision, pdf, devtools and config) are limited to what the task needs. Ask whether --init-script is in use, since those scripts run on every page. Record each result with the exact configuration and client version so the retest after any fix is comparable. A reviewer who sees the origin lists and secrets handling pass in isolation, but cannot show that the client blocks the action, should not sign off.

Evidence a security reviewer asks to see

This table lists the artifacts a reviewer should collect for a Playwright MCP deployment, where each one comes from, and who produces it. Use it as a checklist before approval: the launch configuration, client permissions, secrets handling, sandbox setting and Node.js version should all be written down and versioned, and the bypass tests should be run against the exact build in use. The main takeaway is that the origin lists and file-access guardrail are convenience controls, so the client-level permission record carries the real isolation evidence.

Evidence itemWhere it comes fromWho produces it
Exact launch configuration, including the capabilities list and origin listsClient config file and the server flags it passes (--caps, --allowed-origins, --blocked-origins)Platform or IT team that wrote the client config
Client permission setting for each MCP toolClient approval settings for the Playwright MCP tools, exported or screenshotted with the dateSecurity reviewer, checked against the client admin console
Secrets file location, owner and read rulesThe file passed to --secrets, its file system permissions and the list of users with accessSystem administrator, confirmed by the security team
Workspace roots and file-access settingServer flags for workspace roots, and confirmation that --allow-unrestricted-file-access is not setPlatform engineer, verified by a test run
Browser sandbox settingThe --sandbox or --no-sandbox flag in the launch configuration, with the reason for the chosen valuePlatform engineer who owns the host image
Pinned package version and Node.js versionLockfile or pinned version in the config instead of @latest, and the Node.js version on the host (the README and getting started page list different minimums)Platform team, recorded in the change record
Redirect bypass test resultsTest log showing a blocked origin reached through a redirect, run against the pinned buildSecurity engineer performing or reviewing the test
File-access bypass test resultsTest log showing attempts to read outside workspace roots or open file:// URLs, with the resultSecurity engineer performing or reviewing the test

Questions buyers ask before approving the Playwright MCP server

Does the Playwright MCP server support SSO with our identity provider?

The Playwright MCP server is a local tool that runs under the operating system account of the person who starts it, and the configuration documentation does not describe an SSO or identity provider integration for it. Access to the browser is therefore governed by the machine, the MCP client and the accounts the user signs into in the browser, not by a central login. Confirm with Microsoft and your MCP client vendor whether any identity layer applies to your setup, and check the current Playwright MCP configuration options page for any authentication settings. If your policy requires SSO for every tool that touches internal sites, decide that requirement before approval, because the server does not provide it on its own.

Can we block specific sites by origin?

Yes, the server accepts origin lists through --allowed-origins and --blocked-origins, which take semicolon-separated values, and blocked origins are evaluated first. Build the lists from the internal and external domains your agents must never reach, and test them against the sites your users actually browse. The documentation presents these lists as convenience defenses, not a security boundary, because they do not apply to redirects and can be worked around on purpose. Treat origin lists as a guardrail that reduces accidental navigation, and pair them with client-level permissions and network controls if a site must be unreachable.

Is the Playwright MCP server a security boundary?

No. The configuration documentation says the origin lists and the file-access guardrail are convenience defenses, not a security boundary, and it advises relying on client-level permissions for real isolation. The same caution applies to --secrets, where matching text in tool responses is redacted but the docs describe this as a convenience. Browser sandboxing is controlled separately through the --sandbox and --no-sandbox options, so review that setting explicitly rather than assuming a default. Plan your isolation around the MCP client's permission model, the account the server runs under and the network boundaries around the machine.

What does the Playwright MCP server cost?

The server is published as the npm package @playwright/mcp in Microsoft's repository, and the README gives the standard client setup, so the package itself is the starting point for cost review. Costs depend on the MCP client you choose, on the hosting environment and on whether a third-party client or model plan adds licensing, so the server's own price is only part of the picture. Ask the client vendor which plan includes MCP access and what admin controls that plan offers, and ask your internal platform team what it will cost to operate the machines or runners where the server runs. Confirm licensing and cost with the vendor and your procurement team for your specific client and environment.

Can our team configure the Playwright MCP server alone?

A developer or platform engineer can run the server locally with the standard npx command and the @playwright/mcp@latest argument, so a basic setup needs no vendor involvement. The harder part is the restrictions: choosing capabilities with --caps, setting origin lists, deciding file-access rules and placing secrets in a dotenv file for --secrets. These choices need a written baseline that your security team approves, and the runtime version should be checked first because the README and the Playwright getting started page list different Node.js minimums. If your organization wants a documented review of those choices before rollout, DeployOpen runs AI agent rollout security reviews that test tool and file permissions, credential handling and admin settings, and delivers findings with fixes and a retest, under a fixed scope agreed in writing.

What changes if we use Claude Code or Cursor as the MCP client?

The Playwright MCP server stays the same, but the client sets the permission model, the approval prompts and the admin features you can rely on, so each client needs its own review. The README lists Claude Code-adjacent clients such as Claude Desktop and Cursor among the MCP clients that can use the server, and it gives setup steps for other clients, so confirm which one your staff will install. Check what each client lets an administrator enforce, how it asks users to approve tool calls and whether its own sandbox or permission settings apply to browser actions. Because the docs direct real isolation to client-level permissions, the client you pick is often the most important control in the chain. The Claude Code and Cursor pages in this series cover their own plans, sandboxes and admin controls.

Should we use the MCP server or the Playwright CLI for coding agents?

The README says the CLI with skills is more token-efficient for coding agents, while MCP suits long-running loops that need persistent browser state. For a security review, the choice matters because a persistent MCP session keeps more browser state, cookies and page content available to the agent over time. Ask which workflows your teams need, then compare the capabilities each option exposes and the data each would hold. Record the decision and the reason in the approval, so the next reviewer knows why the MCP path was accepted.

Where to check each claim

The fastest way to verify any setting discussed on this page is the configuration options reference published by Playwright. Open it before approving a configuration and confirm each flag you plan to use: the --caps capability groups, --allowed-origins and --blocked-origins, --allow-unrestricted-file-access, --secrets, --sandbox and --no-sandbox, --init-script, and the ignore-HTTPS-errors option in the config schema. Read the notes beside each option, not only its name. The reference states which controls are convenience defenses and which are not, and that wording should appear in your own risk record, word for word, so reviewers know which controls you are relying on and which you are not. Playwright MCP configuration options is the page to start with.

The Microsoft repository README is the second source to check, mainly for installation details and the supported client list. Confirm the package name @playwright/mcp and the npx arguments in the standard client configuration, and check the Node.js requirement, because the README and the Playwright getting started page do not agree on the minimum version. Pin the version your security team has tested rather than the @latest tag shown in the example, and repeat this check whenever you upgrade, since both pages change over time. Record the commit or package version you reviewed in your approval so a later reviewer can tell whether the documented controls changed. microsoft/playwright-mcp README lists the client setup steps and the comparison with the CLI workflow.

How DeployOpen helps teams roll out browser agents safely

DeployOpen plans, tests and hardens self-hosted platforms inside the client's own infrastructure, and runs security testing that covers AI systems and agents. For Playwright MCP server security, that means turning the browser's reach, the server's restriction settings and the team's client permissions into a written scope, a tested configuration and a handover the security review can check.

How we scope

  • Agree in writing which browsers, client tools and sites the Playwright MCP server may reach
  • Map which tool capability groups are needed and which should stay disabled
  • Define the review of origin lists, file access, secrets handling and sandbox settings
  • Confirm engagement scope, deliverables and timelines before any work starts

How we build

  • Configure the server with approved origin lists, workspace-only file access and disabled risky capabilities
  • Set up secrets handling so credentials stay out of tool responses and prompts
  • Test prompt injection, redirect handling and file navigation against the configured setup
  • Record client-level permission settings that provide the isolation the docs say the server does not

How we hand over

  • Deliver a findings report with severity, fixes and the reasoning behind each setting
  • Document the approved configuration, the storage and profile locations and the retest results
  • Provide a review pack the security and compliance team can check against their own policy
  • Walk the internal owners through the configuration and the items they must maintain

How we support

  • Retest the configuration after Playwright MCP server upgrades or changes to the client setup
  • Continue testing for new browser agent risks as part of an ongoing retainer
  • Keep documentation current when teams add origins, capabilities or new MCP clients
  • Ask for a fixed-scope quote from written requirements, since DeployOpen publishes no price list

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.