What is Playwright MCP?
Playwright is an MCP server from Microsoft Playwright. It turns browser actions into structured tools that an AI application can call, including:
- Opening and navigating web pages.
- Clicking buttons and entering text.
- Taking screenshots.
- Reading an accessibility snapshot of a page.
It does not have to understand a page from screenshots alone. A structured accessibility snapshot lets an read page elements and content before choosing its next action, without requiring a vision model.
Source: Playwright MCP documentation.
A simple example
Open the website
↓
Find the sign-up button
↓
Click it
↓
Fill in the form
↓
Submit
↓
Read the page state
↓
Report the problemThis only shows that the AI has gained browser-control capabilities. It does not guarantee that the AI will complete every web task correctly.
Playwright MCP vs Playwright CLI
Both interfaces let AI work with a browser, but they connect in different ways and suit different workflows. A uses shell commands; MCP uses structured tool calls.
MCP tool definitions and page snapshots can enter the model's . Playwright's comparison describes its and context cost as relatively higher. CLI output is more compact, and Skills can be loaded when needed. We do not claim a specific percentage difference.
Swipe horizontally to compare both options →
| What matters | Playwright MCP | Playwright CLI |
|---|---|---|
| Primary interface | MCP tools | Shell commands |
| Best fit | Exploratory agent loops | Coding agents |
| Context overhead | Relatively higher | Relatively lower |
| Browser sessions | Well suited to persistent sessions | Supports sessions and a persistent process |
| How the AI works | Calls structured tools | Runs commands |
| Setup | Configure an MCP client | Install a CLI |
| Codex / Claude Code | Use when needed | Consider first |
| Unfamiliar-site exploration | Especially well suited | Capable |
| Requires MCP | Yes | No |
Qualitative comparison of documented workflows. No token benchmark or universal compatibility claim.
These distinctions are based on Playwright's MCP and CLI comparison and CLI session documentation. "Consider the CLI first in Codex or Claude Code" is our editorial advice for coding-agent workflows, not a measured ranking for every client or task.
Choose by workflow. The CLI is not universally better than MCP.
How we choose
If you mainly build websites with Codex or Claude Code
Try Playwright CLI first.
- Coding agents already know how to run shell commands.
- The CLI is lighter.
- There is one less MCP server to maintain.
- It fits fixed development and testing workflows well.
If your agent does not have convenient shell access
Playwright MCP is more useful. An MCP-capable client can give the agent browser actions through standard tools.
If the AI frequently explores unfamiliar websites
Playwright MCP is worth considering. It is a strong fit when the agent needs to inspect a page, reason about its structure, and continue interacting over several steps.
If MCP already works well for you
Do not remove it just because the CLI exists. If the workflow is reliable and context overhead is not a practical problem, keep using it.
Install less. Keep what actually helps.
Do not add a tool merely because someone calls it essential.
Check before installing
This verified article uses Node.js 20+, following Playwright's current prerequisites.
Check your installed version:
node -vThe commands below are shown for you to review and copy. This website never runs them automatically.
Install in Codex
Add Playwright MCP:
codex mcp add playwright npx "@playwright/mcp@latest"List configured MCP servers:
codex mcp listSources: Playwright MCP README and the Codex CLI source for list and remove.
For the complete workflow, see How to add an MCP server to Codex.
Install in Claude Code
claude mcp add playwright npx @playwright/mcp@latestSource: Playwright's Claude Code instructions.
Install in Cursor
Open Cursor's MCP settings and add a new MCP server. Use this command:
npx @playwright/mcp@latestSource: Playwright's Cursor instructions.
Standard MCP configuration
For clients that accept standard MCP configuration:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"]
}
}
}Source: Playwright installation configuration.
Headed and headless modes
Playwright MCP can open a visible browser window by default. To run it in the background, add:
--headlessFor example:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest", "--headless"]
}
}
}Source: Playwright's headed-mode documentation.
How to check that it works
After installing, refresh or restart your MCP client. Then ask the AI to perform a harmless browser task:
Open https://example.com and tell me the page title.
If the MCP server starts, the browser opens, and the agent calls Playwright tools, the basic connection is working.
That is not a guarantee that every website or workflow will succeed, and it is not a complete compatibility test.
How to remove it
Remove the Playwright server entry from Codex:
codex mcp remove playwrightThis removes the server configuration entry. It does not mean that every browser file or local cache is deleted.
Source: Codex MCP remove subcommand.
Where Playwright MCP is strong
Structured page understanding
It can use accessibility snapshots to read page structure instead of relying only on screenshots.
Multi-step browser interaction
It suits continuous navigation, clicking, form filling, and screenshot tasks.
Exploratory agent work
When the AI does not know a site's structure and must inspect as it goes, Playwright MCP can be a good fit.
An MCP-based toolset
It fits users who already manage several capabilities through an MCP client and want a consistent browser-tool interface.
The capabilities come from the official Playwright MCP documentation. The suggested use cases are our editorial interpretation of those capabilities.
What it costs you
More context
MCP tool schemas and page structure use model context. The official comparison lists the token cost as higher than the CLI's, but we do not infer or claim a percentage.
Another component to maintain
You need to account for Node.js, the MCP server, client configuration, and the browser environment.
Many tasks do not need MCP
For fixed web tests, CI, pass/fail checks, or scripted flows, Playwright CLI or Playwright Test may be more direct. The agent does not need to rediscover a known page every time.
What users say in practice
Common arguments for the CLI
- Lower context overhead.
- Coding agents already use the shell.
- One less MCP server to maintain.
- Simpler fixed workflows.
Common arguments for MCP
- More direct inside an IDE or MCP client.
- More natural for exploring unfamiliar pages.
- Structured tools suit some agent loops.
- A reliable existing MCP workflow does not need to be removed just because another interface exists.
Sources: MCP vs CLI discussion and repeatable browser checks and agent workflows.
We do not quote unverified token-saving percentages or turn community opinion into an official recommendation.
Frequently asked questions
Is Playwright MCP free?
Playwright MCP is part of the open-source Playwright ecosystem. The AI product, model, or cloud environment you use it with may charge separately, so this does not make the whole workflow cost-free.
Is Playwright MCP the same as Playwright Test?
No. Playwright Test is a testing framework. Playwright MCP lets an AI agent operate a browser through MCP.
Does every Codex user need it?
No. If a coding agent already works well with Playwright CLI, try the CLI first. Consider MCP when you need exploratory interaction or a unified MCP tool workflow.
Can it take screenshots?
Yes. The official server includes browser screenshot functionality.
Does it require a vision model?
Not necessarily. Playwright MCP can provide structured page information through accessibility snapshots.
Still unsure about MCP, CLI, and API?
An is an interface through which software can use another system's capabilities. If these terms are new to you, start with the published glossary entries linked below before choosing an integration.
Related terms
Continue with these published explanations.
Sources & last checked
Checked against official documentation and community review. Community opinions are not official conclusions or runtime test results.
Official documentation
01Community discussions
Community opinions, not official conclusions.
06Last checked: September 3, 2026
official-docs + community-review