Playwright Spatial Layout MCP logo

Playwright Spatial Layout MCP

Measures rendered web layouts with Playwright to detect occlusion, off-screen elements, spatial rule failures, and viewport reflow.

Install Playwright Spatial Layout MCP

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "playwright-spatial-layout-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "playwright-spatial-layout-mcp"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

We couldn’t confirm it starts correctly

The install command didn't complete successfully in our automated test.

npx -y playwright-spatial-layout-mcp

to update! npm notice npm ERR! code ECONNRESET npm ERR! network aborted npm ERR! network This is a problem related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings. npm ERR! network npm ERR! network If you are behind a proxy, please make sure that the npm ERR! network 'proxy' config is set properly. See: 'npm help config' npm ERR! A complete log of this run can be found in: /home/user/.npm/_logs/2026-10-18T11_26_56_015Z-debug-0.log

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked 5d ago.

Overview

playwright-spatial-layout-mcp MCP server uses Playwright to expose geometric information from rendered web pages to AI agents. It can return element bounding boxes, viewport visibility, z-index values, overlap measurements, spatial-rule results, and position changes across viewport sizes. Use it when DOM or accessibility data does not show whether an element is off-screen, covered, overlapping, or displaced by responsive layout changes.

Use cases

  • Detect elements hidden below the viewport
  • Check whether overlays cover interactive controls
  • Validate spatial relationships between page sections
  • Compare responsive layout changes across viewports

Key features

  • Extract element bounding boxes
  • Measure visual occlusion and intersection area
  • Verify spatial relationships
  • Compare element reflow across viewports
  • Report viewport visibility and z-index

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked 2d ago

Recent health check succeeded.

7/7 checks healthy over the last 45d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 8d ago via OSV.dev · playwright-spatial-layout-mcp (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

npm downloads168Package downloads in the last 30 days.
Last commit5mo agoMost recent push to the default branch.
Install checkInconclusiveInstall command did not finish in our automated test.
Directory activity1 viewsConfig copies, upvotes, and views on AllMCPs.

How Playwright Spatial Layout MCP works

What playwright-spatial-layout-mcp does

playwright-spatial-layout-mcp MCP server gives an AI agent measurements from the rendered page rather than relying only on DOM structure or accessibility information. It opens a supplied URL with Playwright and reports spatial facts about selected elements, including their coordinates, dimensions, viewport status, and z-index.

This is useful for diagnosing layout problems that can make an otherwise present element difficult or impossible to use. Examples include a call-to-action below the mobile viewport, a cookie banner covering a checkout control, navigation colliding with a hero section, or an element moving after a CSS change.

How it works

Each tool request supplies a URL and the selectors or layout rules to inspect. Some requests also provide a viewport size or a list of viewport sizes. Playwright renders the page at those dimensions, reads the resulting element geometry, and returns structured results for the agent.

The server compares bounding rectangles to calculate physical intersections. It can also compare element positions and sizes between several viewport configurations, making it possible to identify responsive changes such as horizontal or vertical movement and width or height changes.

Tools and capabilities

The available tools are:

  • extract_bounding_boxes: Returns the position, size, z-index, visibility, and viewport presence of one or more selected elements.
  • detect_visual_occlusion: Checks two selected elements for physical overlap and reports whether occlusion exists, along with the intersection ratio and covered area in pixels.
  • verify_spatial_relationships: Evaluates rules describing whether one element is left, right, above, or below another, whether one contains another, or whether two elements do not overlap. Each rule receives a pass/fail result and a human-readable reason.
  • compute_viewport_reflow: Compares selected elements across multiple viewport sizes and reports whether they shifted, including maximum changes in x position, y position, width, and height.

The playwright-spatial-layout-mcp MCP server fits browser-layout checks, responsive UI investigation, and analysis of Playwright test failures where rendered geometry is relevant.

Setup and configuration

Run the package directly with:

Terminal
npx playwright-spatial-layout-mcp

A global npm installation is also supported:

Terminal
npm install -g playwright-spatial-layout-mcp
npx playwright install chromium

The documented Claude Desktop configuration starts the server through npx, passing the package name as its argument:

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

Chromium must be installed when using the global-install path shown above. Requests identify the page with a URL and use CSS selectors for the elements under inspection.

Limitations and notes

The server reports geometry from the rendered page at the requested viewport sizes. It does not replace DOM or accessibility inspection; its purpose is to add spatial information that those representations may not expose. Results depend on the page state produced when Playwright loads the URL, including the layout at the selected viewport.

The documented relationship checks are limited to left_of, right_of, above, below, contains, and not_overlapping.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Playwright Spatial Layout MCP

playwright-spatial-layout-mcp is an MCP server that connects AI agents to Playwright-rendered web pages and provides tools for bounding boxes, visual occlusion, spatial relationship checks, and viewport reflow. It helps agents inspect geometry such as coordinates, dimensions, overlap, visibility, and responsive layout shifts.

Install it by running `npx playwright-spatial-layout-mcp`. You can also install it globally with npm and then run `npx playwright install chromium` to install the documented browser dependency.

Add an MCP server entry that uses `npx` as the command and passes `-y` and `playwright-spatial-layout-mcp` as arguments. The README provides a complete Claude Desktop JSON configuration using this setup.

It supports bounding-box extraction, visual occlusion detection, spatial relationship validation, and viewport reflow comparison. Relationship rules include left of, right of, above, below, contains, and not overlapping.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewPlaywright Spatial Layout MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/playwright-spatial-layout-mcp?style=directory)](https://allmcps.com/mcp/playwright-spatial-layout-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/playwright-spatial-layout-mcp"><img src="https://allmcps.com/api/badge/playwright-spatial-layout-mcp?style=directory" alt="Playwright Spatial Layout MCP on AllMCPs" /></a>