Install: npx @playwright/mcp@latest or add it to your MCP client config as a stdio server: { command: 'npx', args: ['@playwright/mcp@latest'] }
The server exposes tools such as browser_navigate, browser_click, browser_type, browser_snapshot, and browser_screenshot to the connected LLM
In the MCP client (e.g. Claude Desktop or a custom agent), the LLM calls browser_snapshot to receive a YAML accessibility-tree snapshot of the current page
The LLM selects an element by its ref from the snapshot and calls browser_click or browser_type with that ref
Chain calls iteratively: snapshot → decide → act → snapshot until the task is complete
For headless CI use, launch the server with --headless flag; for vision-capable models, pass --vision to enable screenshot-based tools
Known gotchas
Accessibility-tree snapshots use roughly 200–400 tokens per page; complex SPAs with deep DOM trees can push snapshots over 1,000 tokens and degrade context
Element refs are session-scoped ephemeral IDs; they change after any navigation or re-render, so always re-snapshot before referencing an element
The MCP server runs a single browser instance; concurrent tool calls from the LLM are serialised and do not run in parallel
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp