Claude Code add command
Fastest local add path when you want Claude Code to own the process.
claude mcp add playwright -- npx @playwright/mcp@latestBrowser Automation Operator Desk
Most Playwright MCP pages stop at one install snippet. That is not enough if you are deciding between local stdio, standalone HTTP, Docker, or extension mode with real browser state. This page is built as a utility-first setup desk so you can pick the right path, copy the exact block, and move into a working browser session fast.
The important operator question is not "can I install it?" The real question is which runtime model fits your workflow, auth needs, and ownership lane without creating avoidable browser-state pain later.
Best first step: prove one visible browser run before adding headless complexity.
Highest leverage: extension mode for flows blocked by auth churn.
Ops upgrade: standalone HTTP when one browser service should outlive one chat session.
Setup Workbench
Filter by workflow, browser state, and ownership. The workbench ranks the setup path that fits your lane, gives you the right copy block, and surfaces reusable prompts plus common fixes.
Primary job
Browser state
Operating model
Best-fit recommendation
Best first setup for Claude Code, Codex, Cursor, and VS Code when you want the fastest route from zero to a visible browser session.
Choose when
Avoid when
Selected path assets
Claude Code add command
Fastest local add path when you want Claude Code to own the process.
claude mcp add playwright -- npx @playwright/mcp@latestCodex CLI add command
Official local setup path for Codex CLI users.
codex mcp add playwright npx "@playwright/mcp@latest"Generic JSON config
Use this shape for clients that expect a direct stdio config block.
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"]
}
}
}Execution steps
Operator notes
Reusable workflow templates
Use this when you need the agent to verify one page, one CTA, and one core response after deploy.
Use Playwright MCP, not shell scripts. Open https://example.com, confirm the hero renders, click the primary CTA, capture the destination URL, and list any visible errors or broken navigation.Expected outcome
A quick post-deploy check with one clean success/fail summary instead of a vague browser walkthrough.
Runbook
Best for operator dashboards, internal tools, or SaaS billing panels that are painful to reauthenticate.
Use Playwright MCP in extension mode. Continue from my current browser session, confirm which account is active, open the billing or settings screen, and list the exact controls available before you take any write action.Expected outcome
The agent stays inside the right authenticated context and confirms the surface before acting.
Runbook
Turn a live competitor page into a structured note you can compare later.
Use Playwright MCP to open the target pricing or feature page, extract all visible plan names, prices, and CTA labels, then return a structured markdown table plus the top three positioning messages above the fold.Expected outcome
A reusable competitive snapshot without writing a custom scraper first.
Runbook
Troubleshooting desk
Likely cause
The first instruction was ambiguous, so the client chose a non-MCP execution path.
Fastest fix
Explicitly say "use Playwright MCP" on the first browser task in the session, then verify the MCP server is listed and active.
Likely cause
You are using a clean browser context while the workflow actually needs your current profile or cookies.
Fastest fix
Move that task to extension mode or another profile-aware lane instead of forcing a fresh sandbox run.
Likely cause
The flow depends on timing, auth prompts, or UI state that was never stabilized before moving into headless mode.
Fastest fix
Reconfirm the flow in local stdio first, then add headless only after one deterministic pass.
Likely cause
The client is pointed at the wrong port or endpoint shape, or the server never actually started in standalone mode.
Fastest fix
Rerun `npx @playwright/mcp@latest --port 8931`, then verify the client is targeting `http://127.0.0.1:8931/mcp`.
Mode Comparison
The four modes below all work, but they solve different operator problems. The wrong choice usually creates friction around browser state or transport, not installation itself.
| Mode | Transport | Browser state | Best use | Main caution |
|---|---|---|---|---|
| Local stdio | command / stdio | fresh or headed browser | first install, local debugging, one developer | not ideal for shared remote services |
| Extension mode | command / stdio | existing Chrome session | logged-in dashboards and real profile state | weak for reproducible CI runs |
| Standalone HTTP | remote URL | service-managed browser | shared endpoint or semi-remote ops lane | client must support remote MCP URLs |
| Docker | remote URL | clean containerized browser | CI and controlled isolated lanes | adds infra overhead too early if you have not proven the flow |
Execution Brief
Use this page as a rollout checklist, not just reference text.
Tool Mapping Lens
Catalog-oriented pages work best when users can map discovery, evaluation, and rollout in a clear path instead of reading an undifferentiated list.
Use this board for Playwright MCP Server before rollout. Capture inputs, apply one decision rule, execute the checklist, and log outcome.
Input: Objective
Deliver one measurable improvement with playwright mcp server
Input: Baseline Window
20-30 minutes
Input: Fallback Window
8-12 minutes
| Decision Trigger | Action | Expected Output |
|---|---|---|
| Input: one workflow objective and release owner are defined | Run preview execution with fixed acceptance criteria. | Go or hold decision backed by repeatable evidence. |
| Input: output quality below baseline or retries increase | Limit scope, isolate root issue, and rerun controlled test. | One confirmed correction path before wider rollout. |
| Input: checks pass for two consecutive replay windows | Promote to broader traffic with fallback path active. | Stable rollout with low operational surprise. |
tool=playwright mcp server objective= preview_result=pass|fail primary_metric= next_step=rollout|patch|hold
Playwright MCP Server is Microsoft's official browser automation bridge for MCP-compatible clients. Instead of writing or maintaining Playwright scripts by hand for every repetitive browsing task, you can ask an agent to navigate pages, click elements, extract data, or validate UI behavior directly through the server. That makes browser automation feel more like an operating surface than a testing library.
The important implementation detail is that Playwright MCP is not a single runtime shape. The official project supports direct stdio launches, standalone HTTP transport, Docker-based operation, and extension mode for inheriting a real Chrome session. Those four shapes are operationally different even though they point to the same capability set. Teams that ignore that distinction often end up with a working install but the wrong day-two behavior.
If you only need one developer to run visible browser tasks on a laptop, local stdio is usually the correct first move. If your workflow depends on existing cookies, logins, or extension state, extension mode is often the real answer. If the browser service should stay alive and reusable across tools, standalone HTTP is stronger. If reproducible headless isolation matters more than local convenience, Docker becomes the right lane.
That is why this keyword deserves a half-tool page instead of another long article. Users searching for "playwright mcp server" are usually not asking for abstract history. They are choosing a transport model, a browser-state strategy, and a first working config block.
Start by proving the simplest local path. Register Playwright MCP in Claude Code, Codex CLI, or your editor, then run one visible browser action on a public page. This step tells you whether the client is really talking to MCP, whether Playwright can launch correctly on your machine, and whether your workflow even needs anything more complex. Skipping this stage is how teams waste time debugging Docker, HTTP, or auth issues before they have confirmed the core toolchain works.
Next, choose your browser-state model. Use a fresh sandbox browser for public pages, post-deploy smoke tests, or deterministic automation. Switch to extension mode when the real value lies inside an already-authenticated browser session. A clean browser is better for reproducibility, but it is worse for complex internal tools that force repeated sign-in or device trust prompts. Extension mode is not more "advanced"; it is simply better aligned with a different problem.
Only after the local shape is stable should you move into standalone HTTP or Docker. Standalone HTTP is the best bridge when one browser runtime should serve multiple clients or outlive a single chat session. Docker is strongest when you want clean headless isolation and already know the flow is valid. Both are excellent, but neither should be your first debugging surface unless your environment truly requires it.
Finally, keep prompts narrow and operational. Tell the agent which page to open, which action matters, and what output format you want. Browser automation becomes useful fast when the setup model and the prompt model are both specific.
Treat this page as a decision map. Build a shortlist fast, then run a focused second pass for security, ownership, and operational fit.
When a team keeps one shared selection rubric, tool adoption speeds up because evaluators stop debating criteria every time a new option appears.
Outcome: You get a working browser validation path in minutes without building a custom smoke-test harness first.
Outcome: The agent stops wasting time on reauth and works inside the same authenticated surface you are already using.
Outcome: Browser automation becomes a reusable operations lane instead of a per-session setup chore.
Playwright MCP Server is Microsoft's official browser automation bridge for MCP-compatible clients. It lets Claude Code, Codex CLI, Cursor, and other supported tools open pages, click elements, fill forms, read structured page content, and run browser checks without writing Playwright scripts manually.
Pick local stdio first if you are one developer working on a local machine. It is the fastest path to a working browser session and the easiest mode to debug because you can watch the browser. Move to standalone HTTP or Docker only when you need remote access, headless infrastructure, or shared-service behavior.
Use extension mode when the agent must inherit the tabs, cookies, logins, or installed extensions of a real Chrome session. It is especially useful for logged-in SaaS flows or dashboards where a fresh sandbox browser would force you to sign in on every run.
Yes. You can pass `--headless` for local or server execution and combine it with standalone HTTP or Docker. Headless mode is better for CI or remote operators, but visible mode is better for first-time setup and debugging because you can observe every step.
Stdio is the default process model where your client starts the server directly with a command. Standalone HTTP runs Playwright MCP as a separate service and connects over a URL such as `http://127.0.0.1:8931/mcp`. HTTP is better when you want one server instance shared across tools or environments.
Yes. The official docs include a Codex CLI command using `codex mcp add playwright npx "@playwright/mcp@latest"`. If your workflow already lives inside Codex, that is the cleanest local path.
Send the exact workflow you are solving and we will prioritize a new comparison or rollout guide.