Playwright MCP Server

Geometric vision for AI agents: bounding boxes, occlusion, viewport reflow

Local serverstdioTypeScript

What is the Playwright MCP server?

Playwright MCP server is a locally run integration for AI assistants that speak the Model Context Protocol. Geometric vision for AI agents: bounding boxes, occlusion, viewport reflow.

What you get

An MCP server that gives AI agents geometric spatial awareness of web page layouts using Playwright.

Setting it up

Installation goes through your MCP client rather than a global install: point it at playwright-spatial-layout-mcp on npm and it is fetched when the client starts. The copy-paste blocks for Claude Desktop, Claude Code and Cursor are further down this page.

What the assistant can call

Once Playwright is connected, these are the calls the assistant has available:

  • extract_bounding_boxes — Returns position, size, z-index, and viewport visibility for one or more elements
  • detect_visual_occlusion — Checks if one element physically overlaps another by computing bounding box intersection
  • verify_spatial_relationships — Validates a set of layout rules and returns pass/fail with a human-readable reason per rule
  • compute_viewport_reflow — Measures how element positions and sizes change across multiple viewport sizes

Before you rely on it

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the playwright mcp server does with a few real requests.

Choosing this one

This sits in the browser automation group, where several servers overlap in what they claim to do but differ sharply once you actually set them up. Playwright's toolset — extract_bounding_boxes, detect_visual_occlusion, verify_spatial_relationships and 1 more — is a fair guide to whether it matches your workflow.

This entry was verified against Playwright's own documentation before publication; SyncDev keeps the directory reviewed rather than auto-generated.

Available tools

ToolWhat it does
extract_bounding_boxesReturns position, size, z-index, and viewport visibility for one or more elements.
detect_visual_occlusionChecks if one element physically overlaps another by computing bounding box intersection.
verify_spatial_relationshipsValidates a set of layout rules and returns pass/fail with a human-readable reason per rule.
compute_viewport_reflowMeasures how element positions and sizes change across multiple viewport sizes.

How to install the Playwright MCP server

{
  "mcpServers": {
    "playwright-spatial-layout-mcp": {
      "command": "npx",
      "args": ["-y", "playwright-spatial-layout-mcp"]
    }
  }
}

Configuration as documented by the project. Restart the client after saving.

Example prompts to try

  • Use Playwright to extract bounding boxes.
  • Use Playwright to detect visual occlusion.
  • Use Playwright to verify spatial relationships.

Frequently asked questions

It connects Playwright to MCP-compatible AI assistants such as Claude and Cursor, exposing 4 tools (extract_bounding_boxes, detect_visual_occlusion, verify_spatial_relationships, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Playwright directly.