For AI agents: the index of this site is https://dejo.run/llms.txt, and every page is also served as markdown (add .md to its address, or send Accept: text/markdown).

dejo

Why Playwright MCP uses so many tokens

BlogBy Rohit Kashyap

I build Dejo, a browser MCP server that competes with Playwright MCP, so read this with that in mind. Every number below comes from one benchmark whose raw data is on GitHub, and I link it at the end.

Short answer: Playwright MCP uses a lot of tokens because every step is a model turn, and every turn re-sends the whole conversation. In our Claude Code runs the first turn alone was about 39,700 tokens before the model had seen any page. Page snapshots were smaller than people think (median 12,777 characters). So the bill follows the number of turns: a 2-call task cost about 164K tokens, a 20-call task about 1.36M.

What one turn costs

We ran 19 tasks on 11 real websites, each in a brand-new Claude Code session, with Playwright MCP as the only browser (Claude Sonnet 5, medium effort, @playwright/mcp 0.0.80). Claude Code records the context size of every turn.

The first turn was between 39,713 and 39,739 tokens in all 19 sessions. That is Claude Code's own instructions and its tool list, Playwright MCP's tools among them, plus the task. None of it is a web page. And the model reads all of it again on every turn, because each turn sends the conversation from the top.

After that, the context grew by a median of about 2,000 tokens per turn, as tool results piled up.

Snapshots are not the main cost

The usual story is "the accessibility snapshot is huge". In our runs it wasn't:

Playwright MCP calltimes calledmedian resultlargest result
browser_snapshot3212,777 characters47,491 characters
browser_navigate37308 characters697 characters
browser_find24529 characters9,292 characters
browser_click10388 characters640 characters

A 12,777-character snapshot is a few thousand tokens. The 39,700 tokens that ride along with every turn are ten times that.

So the bill follows the turns

Here is every task, sorted by how many browser calls Playwright MCP made:

browser callstaskstokens per task
26164K to 170K
3 to 45215K to 269K
5 to 74293K to 430K
15 to 204689K to 1,355K

The most expensive task was a college course catalog: filter by one subject, open one course, report its credits. Playwright MCP made 20 browser calls over 24 turns and used 1,355,021 tokens. The page was never the problem. The number of times the model had to look, decide and look again was.

What cuts the cost

Three things, from cheapest to most effective:

  1. Ask for the whole task at once. Every clarifying round trip is another 40K-token turn. To put a price on your own numbers, use the AI token cost calculator, or the Claude Code cost calculator for a plan against API billing.
  2. Use a tool that takes many steps per call. Fewer calls means fewer turns.
  3. Don't start from nothing. A new chat re-learns the site every time. A tool that remembers the route can replay it in one call.

That last one is what I built Dejo for. In the same benchmark, Dejo's repeat runs averaged 89K tokens, about two turns' worth, and 17 of the 19 tasks replayed in a single tool call. On the course catalog task above, the repeat run used 83,189 tokens instead of 1,355,021. The first run still costs real tokens (Dejo averaged 251K against Playwright MCP's 409K), because the agent has to learn the site once.

Playwright CLI, Microsoft's other option, saves snapshots to files instead of the conversation. In our Claude Code runs it still averaged 559K tokens per task, more than MCP on 16 of 19 tasks. I compared the two in Playwright MCP vs Playwright CLI vs memory.

How we measured

What this doesn't cover: other models, other agents than Claude Code, and newer Playwright MCP versions.

Related reading: browser agent token statistics, site memory on a website the agent already knows and why browser agents fail on real websites.

FAQ

Why does Playwright MCP use so many tokens?

Mostly because of turns, not page size. Every model turn re-sends the whole conversation, and in our Claude Code runs the first turn alone was about 39,700 tokens before any page was read. A task that takes 20 browser calls takes about 24 turns, so it costs over a million tokens even though each page snapshot was only about 12,800 characters.

How many tokens does one Playwright MCP task use?

In our test of 19 tasks on 11 real websites, Claude Code with Playwright MCP used 409K tokens on average per task. The cheapest took 2 browser calls and about 164K tokens; the most expensive took 20 calls and about 1.36M.

How big is a Playwright MCP page snapshot?

Across 32 browser_snapshot calls in our test, the median result was 12,777 characters and the largest 47,491. That is a few thousand tokens each: real, but much smaller than the fixed cost of each turn.

How do I reduce Playwright MCP token usage?

Cut the number of turns. Ask for the whole task in one message, avoid extra snapshot calls, and for tasks you repeat, use a tool that remembers the route so the next run is one call. In our test Dejo's repeat runs averaged 89K tokens, about two turns' worth.