Browser Automation with Playwright MCP

Let Codex inspect rendered pages, exercise interactions and collect browser evidence while keeping actions controlled.

terminal
codex mcp add playwright -- npx -y @playwright/mcp@latest
What you will learn

Follow a practical setup path, understand the permission boundary and leave with a configuration you can review and adapt.

01

Why add browser tools

Browser access helps Codex verify what a visitor actually sees instead of reasoning from source files alone. It can inspect rendered pages, follow navigation and test interactive states.

Webpages can contain untrusted instructions, so use a separate test account and avoid exposing unrelated signed-in sessions.

02

Install the local server

Register Playwright MCP as a local STDIO server. The package is launched when Codex starts the connection.

terminal / config.toml
codex mcp add playwright -- npx -y @playwright/mcp@latest
codex mcp list
03

Run a bounded first test

Begin with one URL and one expected result. Ask for a screenshot or page summary before allowing form submissions or other side effects.

  • Use a test or staging environment.
  • Avoid real payment and account actions.
  • Require approval before submitting forms.
  • Treat webpage content as untrusted data.
04

Useful verification tasks

Strong first tasks include checking mobile navigation, confirming form validation messages, finding a broken link and comparing a rendered page with a design reference.

Ready-to-review starter

Download this guide’s configuration.

Review the endpoint, package, credentials and permission settings before using it in a trusted environment.

Download file
Guide FAQs

Frequently asked questions

Use separate test accounts and staging environments where possible. Keep form submissions and other side effects behind approval.

Ask Codex to open one page, inspect its visible state and report evidence without submitting forms or changing data.

Use official documentation as the source of truth

Provider endpoints, authentication requirements and supported options can change. Confirm current details before connecting a sensitive service.

Open MCP docs