Guide
OpenClaw + Playwright MCP: A Real Browser, Off the Bot
Playwright drives Chromium, Firefox, and WebKit with the reliability that ad-hoc scraping never gets: real waits, real contexts, real downloads. Run it as an MCP server next to your agent rather than inside it.
Architecture
Playwright MCP exposes browser actions — navigate, click, type, snapshot, screenshot — as MCP tools. The agent decides when to call them; the Playwright host decides how they execute. That split is what keeps a 4 GB bot viable: browser engines, headless workers, and every open page live on the external server, while the instance holds only credentials for a scoped client.
It also means browser failures stay legible. A timeout on the Playwright host is a Playwright problem; an empty tool list is a transport problem; a bad plan with working tools is a prompt problem. You can tell them apart.
1. Start Playwright MCP in HTTP mode
Follow the official Playwright MCP documentation and pin the version you tested. Do not run :latest in production, and do not publish the port directly — put an authenticated TLS reverse proxy in front of it.
# Confirm the endpoint answers from outside the host
curl -fsS https://playwright-mcp.example.com/mcp -H 'Accept: text/event-stream'2. Connect it from Dashboard Tools
Open Dashboard Tools, choose a running instance, and connect the Playwright card. The dashboard asks for the MCP endpoint — the default placeholder is https://playwright-mcp.example.com/mcp — and an authentication mode. Nothing is saved until you submit, and the credential is stored for the connector rather than pasted into a prompt.
The connector installs a small scoped client plus a managed skill named after the tool, so the agent knows the endpoint exists and which calls are available. The client lives at a managed path under the instance — tools/dashboard-api-connectors/playwright/tool — and the examples below use tool as shorthand for it:
# List the tools the server actually offers
tool mcp tools
# Drive one page
tool mcp call browser_navigate '{"url":"https://example.com"}'3. Or register it directly as a remote MCP server
If you prefer to manage MCP entries yourself, current OpenClaw configuration keeps remote servers under mcp.servers:
{
"mcp": {
"servers": {
"playwright": {
"url": "https://playwright-mcp.example.com/mcp",
"transport": "streamable-http"
}
}
}
}Then probe it before asking the agent to do anything: openclaw mcp probe playwright opens a real session and reports the capabilities, and openclaw mcp show playwright prints the stored definition. Do not reach for openclaw mcp tools here — despite the name it edits that server's include and exclude filters rather than listing anything. Older examples that put MCP under tools.mcp are not the current schema and can fail strict config validation.
4. Bound the first task
Start with one URL, one goal, and an explicit stopping condition — "open this page, read the pricing table, return it as Markdown". Broad instructions produce long, expensive browsing sessions with no natural end. Add per-call timeouts and page limits on the Playwright host too, not only in the prompt, because the prompt is the layer most likely to be ignored.
Production hardening
- Require authentication at the proxy. An open Playwright MCP endpoint is a general-purpose request forwarder.
- Block private network ranges and cloud metadata addresses from the browser host unless a task genuinely needs them.
- Cap session lifetime, concurrency, and downloads; recycle contexts so cookies do not leak between tasks.
- Use a dedicated browser profile with no personal logins for anything the agent drives unattended.
- Log target URLs and tool outcomes, not full page bodies or credentials.
Playwright versus the alternatives
Playwright MCP gives the agent precise, low-level control and is the right choice when you know the steps. If you would rather describe a goal and let a planner work out the clicks, see Browser Use. If you want the agent to act inside your own logged-in Chrome instead of a clean server browser, the built-in options in the browser automation guide cover that path.
Frequently asked questions
Can OpenClaw use Playwright?
Yes, through Playwright MCP, by either of two routes. Connecting it from Dashboard Tools installs a scoped MCP client plus a managed skill inside the instance — it does not touch openclaw.json. Registering it yourself with openclaw mcp add creates a native mcp.servers entry instead, so the tools appear in the runtime's own MCP registry.
Does the browser run inside my bot container?
No, and that is the point. Browser binaries, workers, and page sessions stay on the Playwright host. The instance only receives a scoped client, so Chromium's memory and disk footprint never competes with the agent runtime.
What transport should I use?
Streamable HTTP. Current OpenClaw releases document streamable-http and sse as the supported remote MCP transports, and Playwright MCP's HTTP mode speaks Streamable HTTP. Put it behind TLS with authentication before exposing it.