Skip to content
Cloudflare Docs

Playwright MCP

@cloudflare/playwright-mcp is a Playwright MCP server fork that provides browser automation capabilities using Playwright and Browser Rendering.

This server enables LLMs to interact with web pages through structured accessibility snapshots, bypassing the need for screenshots or visually-tuned models. Its key features are:

  • Fast and lightweight. Uses Playwright's accessibility tree, not pixel-based input.
  • LLM-friendly. No vision models needed, operates purely on structured data.
  • Deterministic tool application. Avoids ambiguity common with screenshot-based approaches.

Deploying

Follow these steps to deploy @cloudflare/playwright-mcp:

  1. Install the Playwright MCP npm package.
Terminal window
npm i -D @cloudflare/playwright-mcp
  1. Make sure you have the browser rendering and durable object bindings and migrations in your wrangler configuration file.
{
"name": "playwright-mcp-example",
"main": "src/index.ts",
"compatibility_date": "2025-03-10",
"compatibility_flags": [
"nodejs_compat"
],
"browser": {
"binding": "BROWSER"
},
"migrations": [
{
"tag": "v1",
"new_sqlite_classes": [
"PlaywrightMCP"
]
}
],
"durable_objects": {
"bindings": [
{
"name": "MCP_OBJECT",
"class_name": "PlaywrightMCP"
}
]
}
}
  1. Edit the code.
src/index.ts
import { env } from 'cloudflare:workers';
import { createMcpAgent } from '@cloudflare/playwright-mcp';
export const PlaywrightMCP = createMcpAgent(env.BROWSER);
export default PlaywrightMCP.mount('/sse');
  1. Deploy the server.
Terminal window
npx wrangler deploy

The server is now available at https://[my-mcp-url].workers.dev/sse and you can use it with any MCP client.

Alternatively, use Deploy to Cloudflare:

Deploy to Cloudflare

Check our GitHub page for more information on how to build and deploy Playwright MCP.

Using Playwright MCP

alt text

Cloudflare AI Playground is a great way to test MCP servers using LLM models available in Workers AI.

You can now start to interact with the model, and it will run necessary the tools to accomplish what was requested.

Try this sequence of instructions to see Playwright MCP in action:

  1. "Go to demo.playwright.dev/todomvc"
  2. "Create some todo entry"
  3. "Nice. Now create a todo in parrot style"
  4. "And create another todo in Yoda style"
  5. "Take a screenshot"

You can also use other MCP clients like Claude Desktop.

Check our GitHub page for more examples and MCP client configuration options and our developer documentation on how to build Agents on Cloudflare.