Repository navigation
playwright mcp vs cli
Short answer: the CLI executes a script you already wrote; the MCP server lets a model decide the next step while the page is open. They are different points in the same workflow, and the reason the comparison keeps getting searched is that both are marketed as "browser automation" and neither page says what the other is for.
The Playwright CLI (npx playwright test, playwright codegen,
playwright show-trace) is a test runner and its tooling. You give it a file of
assertions. It runs them, in parallel, headless, deterministically, and tells
you which failed with a trace you can step through. It has no model in it and no
opinion about what to do next.
Playwright MCP is a server that speaks the Model Context Protocol. An assistant connects to it and gets tools: open a tab, snapshot the page, click, type, press a key. The model calls those one at a time and looks at what came back before deciding the next call. Microsoft ships it at microsoft/playwright-mcp, Apache-2.0, 36.9k stars when read on 2026-09-13, and it exposes the page to the model as an accessibility tree rather than a screenshot, so the model reads structure instead of pixels.
The load-bearing difference is who decides the next action. In the CLI, you did, when you wrote the file. In MCP, the model does, now, having seen the page.
| You are | Use | Why |
|---|---|---|
| Writing regression tests | CLI | Determinism and parallelism are the whole point, and a model in the loop destroys both |
| Running the same known flow nightly | CLI | It is a script. A model would re-derive the same steps every night and charge you for it |
| Exploring a site you have never seen | MCP | The step after the next one depends on what the page says |
| Debugging why a selector broke | MCP first, then CLI | Ask the model what the page looks like now, then fix the test |
| Handling a flow that changes shape between runs | MCP | This is the case the CLI cannot express |
| Turning a manual flow into a test | Both | Drive it once over MCP, then write the CLI test from what worked |
codegen is the third thing, and it confuses this comparison.
playwright codegen records your clicks and prints a script. That is the CLI
family, not the MCP family: it produces code from a human, where MCP produces
actions from a model. If what you wanted was "watch me do it once and write it
down", codegen is the cheaper answer and it costs no tokens.
Using MCP for a nightly job. Every run pays for the model to rediscover a flow that has not changed. It is slower, more expensive and less repeatable than the script it should have become after the first successful run. Use MCP to find the flow, then commit the flow.
Using the CLI for a page whose structure moves. If your test file is mostly
try blocks and retries because the site keeps changing, you are hand-rolling
the thing the model does natively. That is the case MCP exists for.
Expecting MCP to be faster. It is not. Each step is a round trip through a model. A CLI test doing forty steps finishes while an MCP session is still on step five. Speed is not why you would pick it.
invisible_playwright_mcp is the MCP shape, not the CLI shape, with one difference from Microsoft's server that matters only in one situation: the browser underneath is a Firefox patched at the C++ source rather than a stock automation build. That changes what a defended site sees, and nothing else. It does not make the model smarter, it does not make the steps faster, and for writing tests you still want the CLI.
If you are choosing between MCP servers rather than between MCP and the CLI, choosing an MCP server for browser automation is the comparison, and the MCP server has our config block and tool list.
Is Playwright MCP a replacement for Playwright? No. It is a way for a model to drive Playwright. The library and the test runner are unchanged underneath.
Can I run Playwright MCP in CI? You can, and usually should not. CI wants a deterministic script; if a model picks the steps, a green run does not prove the same thing twice.
Is Playwright MCP free? The server is Apache-2.0 and costs nothing. The model calls it makes are billed by whoever provides your model.
Which is better for scraping? Neither, alone. See MCP for web scraping: the honest pattern is a model to work out the shape and plain code to do the repetition.
Does Playwright MCP work with Firefox? Yes, --browser firefox is one of
its documented options, alongside chrome, webkit and msedge.
See also: Playwright MCP best practices, when a Playwright MCP session gets blocked, and the browser is already in use for the error most people hit in their first hour.
- microsoft/playwright-mcp, retrieved 2026-09-10: licence, stars, browser options, and the accessibility-tree design.
- Playwright's own documentation for what the test CLI does.
Written while maintaining an MCP browser server, so the row that says "use the CLI" is the one to check us on. It is there because it is right more often than the row that recommends us.
- OpenAI Operator alternatives
- Open-source Operator-style agents
- Is OpenAI Operator still available?
- OpenAI Operator vs Claude computer use
- browser-use alternatives
- Choosing an AI browser agent
- Open-source AI browser agents
- Open-source computer-use agents
- What is an AI web agent?
- AI browser agents vs traditional scraping
- Cloud browser infrastructure for AI agents, explained
- Browserbase alternatives
- Firecrawl vs an AI browser agent
- Skyvern alternatives
- Stagehand vs browser-use
- Project Mariner is gone: what replaced it
- Manus alternatives
- Gemini computer use vs Claude computer use
- A stealth browser MCP, reviewed honestly by its own wiki
- AI browser vs AI browser agent: which one do you want?
- AI browser agent vs RPA: which one fits the job
- AI browser agent vs n8n, Zapier and Make
- Vercel agent-browser alternatives, compared honestly
- What is an agentic browser? Definition and the two kinds
- Open-source agentic browsers: the three layers, compared
- Choosing an MCP server for browser automation: four axes
- Stealth MCP servers compared: Camoufox, nodriver, Patchright
- Playwright MCP alternatives, and the three you don't need
- Autonomous browser agents: the four rungs of autonomy
- What is actually free in the AI browser agent stack
- browser-use on GitHub: what the repo actually gives you
- Playwright MCP vs Chrome DevTools MCP: different jobs
- How to choose among MCP servers: a map by category
- Which MCP servers are worth adding to Claude Code
- MCP on GitHub: finding servers and judging them fast
- MCP vs an API: the decision, and what the wrapper costs
- MCP alternatives: when the protocol is the wrong shape
- Why does my AI agent get blocked?
- The timing signal AI agents give off
- Agent retry loops trip rate limits, not fingerprints
- Claude computer use detected as a bot
- browser-use getting blocked: what you can and cannot change
- Playwright MCP session blocked: four causes, four fixes
- Playwright MCP and captchas: what actually gets you past
- Cloudflare and a browser MCP server: what is being read
- Can an AI agent solve a captcha? The honest answer
- Getting an AI agent to fill out forms
- The best model for an MCP browser agent, and what it really costs
- Browser problem or model problem?
- How to use a Playwright MCP server with Claude Code
- Extracting data to a CSV with an AI agent
- Monitoring a page for changes with an AI agent
- How to let Claude Desktop control a browser
- How to add a browser to Cursor as an MCP server
- Using an AI agent to hunt for apartments
- Getting website data into Google Sheets with an AI agent
- Using an AI agent to download invoices from portals
- AI agents for web research
- Using an AI agent to test your own website
- How to add a browser to Cline as an MCP server
- Posting to social media with an AI agent
- Posting to Facebook with an AI agent
- Posting to Instagram with an AI agent
- Posting to X with an AI agent
- Automating LinkedIn posts: read this first
- Appointment bots: what they are and what an agent can legitimately do
- Track prices across sites with an AI agent
- Build a lead list with an AI browser agent
- Run an AI browser agent on a schedule
- AI browser agent with a local LLM: what changes
- Should you log your AI agent into your accounts?
- How to write a task an AI browser agent can follow
- Move data between two web apps with an AI agent
- The MCP server
- How the tools are shaped, and why
- Playwright MCP vs the Playwright CLI: which fits when
- Playwright MCP: browser is already in use, and the fix
- Playwright MCP best practices: four decisions that matter
- Playwright MCP with a proxy, and the three leaks it leaves
- A browser MCP server in GitHub Copilot: setup and limits
- Using a browser MCP server for web scraping: the pattern
- Which LLM for browser automation: the four properties
- How to build a browser agent, and what to take instead
- Getting an AI agent to log into a website: three routes
- MCP tools, resources and prompts: who controls each
- How many MCP tools is too many? The context arithmetic
- How to build an MCP server: the decisions, not the scaffold
- Local or remote MCP server: what changes, and what does not
- Writing an MCP client in Python: the thirty-line version
- Self-hosted AI agent: what one actually costs to run
- How long an AI browser agent takes per step, measured
- Text, HTML, snapshot or screenshot: what the agent should read
- Giving an AI browser agent a stopping condition
- Keeping an AI browser agent out of destructive actions
- Why did the AI agent click the wrong thing
- When the page changes under the AI agent
- Running one AI agent task across a list of sites
- Seeing a page as it appears in another country
- Getting data out of a dashboard with no export button
- Two browsers in one session: main and support
- Finding the dead links on a site with an AI agent
- Filling a CRM record from a company's website
- One form submission per spreadsheet row, with an AI agent
- Dated screenshots of a page as evidence
- Checking order and delivery status with an AI agent
- Reading a PDF that opens inside the browser
- Summarising a long page or thread with an AI agent
- Collecting every image on a page with its caption
- Collecting event and course listings with an AI agent
- Cancelling a subscription with an AI agent
- What an AI agent can and cannot do inside an iframe
- Shadow DOM and an AI agent: you can click it, you cannot read it
- How to add a browser to Codex as an MCP server
- What a page snapshot costs, per control
- How to let Gemini CLI use a browser
- Native selects and the ones that only look like selects
- Clicking by selector or by coordinates
- How long the agent waits before it gives up
- What a second browser costs
- Uploading a file with an AI agent, and why this one cannot
- Watching the agent work, and when it is worth it
- When not to use an AI browser agent
- Agent or script: deciding once instead of every time
- Using the keyboard instead of the mouse
- Secrets in an agent task: where they end up
- What an agent run should log
- Deduplicating what an AI agent collects
- Normalising values across sites
- Validating an AI agent's output
- Reading a table with an AI agent
- Driving a site's own search and filters
- The task works headed and fails headless
- How to let the AdaL CLI use a browser