Automation
Playwright MCP Token Cost: 2026 Benchmarks, CLI Trade-Offs & 6 Production Fixes
Early-2026 benchmarks claimed Playwright MCP burned 114,000 tokens per task, yet a 19-release audit shows page loads dropped 99.5% to 79 tokens after v0.0.69. Here is what 1 session actually costs in November 2026—and 6 flags in v0.0.86 to cut your bill.
11 min read
Playwright MCP Token Cost: 2026 Benchmarks, CLI Trade-Offs & 6 Production Fixes
Browser automation is one of the fastest ways to blow through an AI coding agent's token budget—not because the browser is slow, but because every click and navigation can dump thousands of lines of accessibility-tree text back into the model's conversation history. Widely cited early-2026 benchmarks warned that a single Playwright MCP session burned 114,000 tokens compared to 26,800 for the Playwright CLI, yet a November 20, 2026 benchmark across 19 releases by TestDino and the November 18, 2026 release of @playwright/mcp v0.0.86 (GitHub Releases) show a very different picture in production.
Executive Summary
- Page-Load Response Dropped 99.5%: Since
@playwright/mcpv0.0.69(March 30, 2026),browser_navigatewrites the page accessibility snapshot to a.ymlfile on disk and returns a compact file link—cutting a Hacker News page-load response from15,317tokens (v0.0.68) to79tokens (v0.0.69–v0.0.85) (TestDino). - Turn Count Beats Idle Context Size: In a controlled e-commerce add-to-cart benchmark (OpenCode
1.18.35), current Playwright MCP0.0.85processed266,247tokens (12–13requests,~$0.08on Claude Sonnet 5.5), outperforming both Playwright CLI0.1.24(554,973tokens across20requests,~$0.15) and legacy MCP0.0.68(673,253tokens,~$0.17) (TestDino). - Latest Release Requires Node.js 20+:
@playwright/mcpv0.0.86(released November 18, 2026 under Apache-2.0) raises the minimum runtime floor to Node.js 20+, ships an Ubuntu Noble + Node.js 26 Docker image, adds Linux ARM64 Chrome support, and introduces resumable extension tab groups (GitHub Releases). - Operational Takeaway: Token spend is now governed by whether your agent calls full
browser_snapshot, how many round-trips it takes, and whether you convert stable agent-discovered flows into zero-tokennpx playwright testspecs.
What Changed: From Inline DOM Dumps to File-Linked Snapshots
Microsoft's Playwright MCP server (@playwright/mcp, 40,000+ GitHub stars, Apache-2.0 license) lets LLMs drive Chromium, Firefox, or WebKit using structured accessibility trees rather than pixel screenshots. Through v0.0.68 (February 14, 2026), every action tool call returned the entire accessibility tree inline inside the JSON-RPC response. Because LLM agents replay full conversation history on every subsequent turn, a single 15,000-token snapshot was re-read by the model on every remaining step of the workflow.
Starting with v0.0.69 (March 30, 2026), the server silently adopted the same disk-offload pattern used by the Playwright CLI: action responses write the snapshot to .playwright-mcp/page-<timestamp>.yml and return a lightweight Markdown link alongside the executed Playwright code. Then, in v0.0.78 (July 9, 2026), Microsoft added browser_find—a targeted search tool that queries the accessibility tree by text or regex and returns only matching nodes with a few lines of surrounding context (GitHub Releases).
sequenceDiagram
participant Agent as LLM Agent (Claude Code / OpenCode)
participant MCP as @playwright/mcp (v0.0.86)
participant Disk as Workspace (.playwright-mcp/*.yml)
Agent->>MCP: browser_navigate(url)
MCP->>Disk: Write full accessibility tree (8k-22k tokens)
MCP-->>Agent: Return 79-97 token link + generated JS
Agent->>MCP: browser_find(text="Add to cart")
MCP-->>Agent: Return 168-397 token matching refs
Agent->>MCP: browser_click(ref)
MCP-->>Agent: Return 27-86 token confirmationFixed vs. Variable Token Spend
A Playwright MCP session consumes tokens in four distinct places (TestDino):
- Tool Definitions (Fixed Per-Request Overhead): By
v0.0.85, the default set grew from21tools (2,203tokens inv0.0.41) to25tools (3,919tokens)—a 78% increase—and enabling every optional capability (--caps=vision,pdf,devtools, etc.) expands the schema to72tools (8,391tokens). Clients like Claude Code defer MCP tool schemas at session start (loading only names and server instructions), whereas clients like OpenCode send full definitions on the first request (+4,607tokens observed). - Page Snapshots (Largest Variable Item): While
browser_navigatenow returns79–97tokens, an explicitbrowser_snapshotcall still returns the full tree inline—ranging from8,331to22,279tokens across real-world pages (o200k_basetokenizer). Claude Code warns whenever a single MCP tool output exceeds10,000tokens and caps output at25,000tokens by default (MAX_MCP_OUTPUT_TOKENS). - Screenshots & Console Logs: On Anthropic's vision pricing (
ceil(width / 28) * ceil(height / 28)), a1280x720screenshot consumes1,196visual tokens. - Conversation Replay (Compounding Multiplier): Every tool response stays in the message history and is re-processed as cached or uncached input on every subsequent request.
Minimal Production Configuration (v0.0.86)
For headless CI or local coding agents, pair the leanest runtime flags with explicit workspace rules so the agent defaults to browser_find instead of full snapshots:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@0.0.86",
"--headless",
"--isolated",
"--image-responses",
"omit"
]
}
}
}
Reliability, Cost & Performance Analysis
19-Release Page-Load & Snapshot Telemetry
Testing 19 releases side-by-side on headless Chrome (1280x720, counted with o200k_base on November 17, 2026) highlights the exact architectural inflection point at v0.0.69 (TestDino):
| Version | Release Date | Hacker News (browser_navigate) |
Playwright Docs | GitHub Repo | Wikipedia Article |
|---|---|---|---|---|---|
0.0.41 |
Oct 1, 2025 | 15,219 tokens |
8,634 tokens |
19,727 tokens |
16,670 tokens |
0.0.68 |
Feb 14, 2026 | 15,317 tokens |
8,633 tokens |
19,729 tokens |
16,295 tokens |
0.0.69 |
Mar 30, 2026 | 79 tokens (-99.5%) |
79 tokens |
97 tokens |
90 tokens |
0.0.85 |
Nov 9, 2026 | 79 tokens |
79 tokens |
97 tokens |
90 tokens |
Note that the underlying browser_snapshot payload itself barely shrank (15,203 -> 13,544 tokens on Hacker News; 20,120 -> 22,279 on a GitHub repo page) even after v0.0.78's snapshot distillation. Clients that lack filesystem access (such as pure web chat UIs) cannot read .yml disk links and are still forced onto the full-snapshot path—though v0.0.82 added --file-paths=absolute for agents without a workspace root (GitHub Releases).
Real-Task Benchmark: MCP 0.0.85 vs. CLI 0.1.24 vs. MCP 0.0.68
Microsoft's own README recommends playwright-cli + SKILLs over MCP for coding agents to avoid loading tool schemas and accessibility trees. However, when TestDino ran an identical multi-step e-commerce task (navigate to products, select Dell XPS 13, add to cart, verify cart summary) twice per tool using OpenCode 1.18.35, total tokens processed (fresh input + cache reads) flipped the conventional wisdom (TestDino):
| Tool & Run | Requests | First Request | Peak Context | Tokens Processed | Wall Time |
|---|---|---|---|---|---|
MCP 0.0.68 (Run 1 / Run 2) |
13 / 22 |
14,702 |
47,907 / 52,512 |
505,633 / 840,872 |
71 s / 116 s |
CLI 0.1.24 (Run 1 / Run 2) |
20 / 20 |
11,723 |
34,236 / 45,838 |
421,118 / 688,827 |
103 s / 107 s |
MCP 0.0.85 (Run 1 / Run 2) |
13 / 12 |
16,330 |
31,674 / 30,275 |
291,135 / 241,358 |
48 s / 65 s |
Why did MCP 0.0.85 beat the CLI by 52% on average tokens processed (266,247 vs. 554,973)? Two operational mechanics explain it:
- Fewer Round-Trips: MCP
0.0.85completed the task in12–13requests using3–4targetedbrowser_findcalls, whereas the CLI needed20shell-command requests—re-reading the conversation history 7–8 extra times. - Skill-File Parity: Once loaded, the CLI skill file (
3,760tokens) nearly matched the25MCP tool definitions (3,919tokens), though the CLI retains an idle advantage (47-token header before loading) for code-heavy sessions that rarely open a browser.
Dollar Cost at Scale (November 2026 Anthropic Pricing)
Applying Anthropic's November 2026 rates (where cache reads on Sonnet 5.5 cost $0.10/1M vs. $2.00/1M fresh input—a 95% discount—and accounted for 90.8% of processed tokens in MCP 0.0.85 runs) yields the following modeled per-session and monthly team costs (TestDino):
| Tool (Average Usage) | Fresh Input | Cache Read | Output | Haiku 5.5 | Sonnet 5.5 | Opus 5.5 |
|---|---|---|---|---|---|---|
MCP 0.0.85 |
24,583 |
241,664 |
693 |
$0.005 |
$0.08 |
$0.16 |
CLI 0.1.24 |
36,061 |
518,912 |
2,136 |
$0.010 |
$0.15 |
$0.29 |
MCP 0.0.68 |
45,157 |
628,096 |
1,492 |
$0.012 |
$0.17 |
$0.34 |
Without prompt caching, the average MCP 0.0.85 session on Sonnet 5.5 would jump from $0.08 to $0.54. At a modest CI scale of 200 agent-driven browser flows per day over 22 working days, MCP 0.0.85 models to $353/month on Sonnet 5.5 or $706/month on Opus 5.5—making prompt caching and flow-to-test conversion essential before scaling. (For context, Anthropic's Claude Code cost docs put average enterprise developer spend around $13/day.)
Security Boundaries & v0.0.86 Operational Gotchas
Before deploying @playwright/mcp v0.0.86 in shared or CI environments, note three verified constraints:
browser_run_code_unsafeIs RCE-Equivalent: As highlighted in DataImpulse's November 20, 2026 audit and Microsoft's docs, the defaultbrowser_run_code_unsafetool executes arbitrary JavaScript in the Playwright server process with full access to that process's environment and permissions. Never expose it to untrusted prompts or unauthenticated network endpoints.--allowed-originsIs Not a Security Boundary: Microsoft explicitly documents that--allowed-originsand--blocked-originsdo not cover HTTP redirects and do not constitute a security boundary (GitHub README). Enforce egress restrictions at the container or proxy layer.- Node.js 20+ Floor & Extension Breakage in
v0.0.86:v0.0.86drops Node.js 18 support, refuses browser-wide cookie-clearing/permission-granting calls from extension clients, and limits CDP attachment on unresponsive tabs to10seconds (GitHub Releases).
Practical Implementation & Trade-Offs
6 Verified Settings to Cut Playwright MCP Token Spend
Every optimization below is built into @playwright/mcp v0.0.85+ and verified against TestDino's Wikipedia and demo-store runs (TestDino):
| Optimization | Mechanism / Flag | Measured Before | Measured After |
|---|---|---|---|
| 1. Search Instead of Snapshot | Call browser_find instead of browser_snapshot |
17,226 tokens |
397 tokens (-97.7%) |
| 2. Scope Snapshot Depth | Pass depth: 3 or target to browser_snapshot |
17,226 tokens |
415 tokens (-97.6%) |
| 3. Save Snapshots to Disk | Pass filename parameter to browser_snapshot |
17,226 tokens |
46 tokens (-99.7%) |
| 4. Trim Action Responses | Pass --snapshot-mode none --codegen none |
86 tokens/click |
27 tokens/click (-68.6%) |
| 5. Omit Inline Screenshots | Pass --image-responses omit (or filename on screenshot) |
1 image + 122 tokens |
122 text tokens |
| 6. Limit Loaded Capabilities | Use default 25 tools instead of all capabilities (72 tools) |
8,391 tokens |
3,919 tokens (-53.3%) |
(Caution: Keep --codegen enabled—its default typescript output—when your goal is to turn an exploratory agent session into a repeatable .spec.ts file. Also test --mobile on your own app before assuming savings: while Microsoft's README notes mobile views are usually lighter, only 1 of 4 pages shrank meaningfully in testing.)
Decision Framework: MCP vs. CLI vs. Deterministic Specs
- Use Playwright MCP (
v0.0.86) when the agent needs persistent browser state, interactive exploration, self-healing locator repair, or multi-tab extension workflows (--extensionwith--session-nameand--background), and your client supports local workspace file reads. - Use Playwright CLI + Skills when your coding agent spends 90%+ of its turns editing large codebases and only occasionally checks a UI—especially in clients that do not defer MCP tool schemas—so you avoid paying the
3,919-token schema tax on every non-browser turn. - Compile to
npx playwright testImmediately: An agent session burns tokens on every run; a generated Playwright spec runs in CI for $0 in LLM tokens. Use MCP once to explore and generate the spec, then execute the spec deterministically in CI.
Frequently Asked Questions
How many tokens does Playwright MCP use per page load in 2026?
On @playwright/mcp v0.0.69 through v0.0.85+, a browser_navigate call returns 79 to 97 tokens because the accessibility snapshot is written to a .yml file on disk. Only an explicit browser_snapshot call returns the full tree inline (8,331 to 22,279 tokens on tested pages).
Why do people still cite 114,000 tokens for Playwright MCP?
That figure comes from a February 6, 2026 Playwright CLI vs. MCP demo video recorded before v0.0.69 (March 30, 2026). Releases up to v0.0.68 returned the full accessibility tree inline on every action response, rapidly inflating context size.
Is Playwright CLI always cheaper than Playwright MCP?
No. While the CLI has a smaller idle footprint (47-token header vs. 3,919 tokens for 25 MCP tool definitions), TestDino's November 2026 benchmark found MCP 0.0.85 processed fewer total tokens (266,247 avg) than CLI 0.1.24 (554,973 avg) on a multi-step checkout flow because MCP finished in 12–13 requests instead of 20.
What changed in @playwright/mcp v0.0.86?
Released on November 18, 2026, v0.0.86 requires Node.js 20+, updates the Docker image to Ubuntu Noble with pinned Node.js 26, adds Linux ARM64 Chrome installation, introduces resumable and color-coded extension tab groups (--session-name, --session-color), and caps unresponsive CDP tab attachment at 10 seconds.
How can I measure my own Playwright MCP token usage?
In Claude Code, run /context and /usage inside a session; in OpenCode, run opencode export <session-id> to inspect per-request provider token logs. You can also connect directly to @playwright/mcp via @modelcontextprotocol/sdk and count listTools() and callTool() outputs locally with js-tiktoken (o200k_base).
Sources
- TestDino: Playwright MCP Token Cost: Real 2026 Numbers and Fixes — Published November 20, 2026; verified November 22, 2026 (19-release token benchmark, OpenCode
1.18.35MCP vs. CLI comparison, Anthropic November 2026 pricing model, and 6 optimization flags). - GitHub Releases:
microsoft/playwright-mcp—v0.0.86released November 18, 2026; verified November 22, 2026 (Node.js 20+ requirement, Docker Ubuntu Noble/Node 26, extension tab groups,v0.0.85,v0.0.78browser_find, andv0.0.69snapshot offloading). - GitHub Repository:
microsoft/playwright-mcp& npm@playwright/mcp— Updated November 18–19, 2026; verified November 22, 2026 (Apache-2.0 license, CLI vs. MCP guidance, and CLI flags). - Claude Code Docs: Connect Claude Code to tools via MCP & Manage costs effectively — Updated November 20–21, 2026; verified November 22, 2026 (
10,000-token warning,25,000-token default MCP output cap, deferred tool loading, and$13/dayenterprise developer average). - DataImpulse: Playwright MCP: Set Up and Verify Browser Traffic — Published November 20, 2026; verified November 22, 2026 (
browser_run_code_unsafeRCE-equivalent risk and--allowed-originssecurity boundary caveats).