
pxtree
io.github.alabsi91Published by GitHub account alabsi91v0.1.2Updated Oct 24, 2026
Measures how a webpage actually renders and prints it as compact text for AI coding agents.
Overview
Loads a page in headless Chromium and returns its rendered layout as a compact text tree with measurements and findings, so an assistant can check UI layout…
- What you can do
- Measure a page's rendered layout as a compact text tree of boxes, sizes, padding, gaps and text metrics
- List threshold-based findings such as misaligned siblings, inconsistent widths or heights, and uneven gaps
- Compare a run with the previous run of the same URL or diff key to see what changed
- Add an accessibility (aria) snapshot and an optional PNG screenshot to the same call
- Narrow the output to findings only, a summary, changes only, or the facts line only
- Read a built-in guide explaining the output grammar, tags and limits
- When to use it
- Useful when an assistant edits front-end code and needs to verify how a page actually renders at several viewport sizes and color schemes, or to confirm a layout fix changed the numbers. It suits layout and spacing debugging where numeric CSS-pixel measurements are more useful than a screenshot.
- Requirements
- Runs locally over stdio via npx, so Node 20 or newer is needed. Playwright's Chromium must be installed once (about 150 MB), or an installed Chrome can be used instead. No accounts, API keys or environment variables are declared. The page must be reachable, either a local dev server, a file under the server's working directory, or a URL.
Installation
In SourceWeft
- Open pxtree in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
pxtree
Loads a webpage in headless Chromium and prints what actually rendered as a compact text tree, so an AI coding agent can check a layout without a screenshot.
A dev server page with a row of three cards, a row of three plans, a list of steps, a row of stats, an article, a form, a column of prices and a row of tiles:
The first line is the facts line: viewport, color scheme, device pixel ratio, direction, scroll position out of the maximum, document size, and painted to, the lowest painted pixel. since last run compares with the previous run of the same URL and settings, or of the same --diff-key name. That history lives in ~/.cache/pxtree, never in your project, and --no-diff skips it.
The ul.cards line says the "Choose" buttons in the three cards have tops from 64 px to 136 px below the top of their card. The li.plan.featured "Lifetime" line says that plan is 212x56 at x 432 in its row, 12 px wider than the width its siblings share. Findings are measurements with a threshold, never verdicts. The agent decides from the code whether they are intended.
Why not a screenshot
- It gives numbers in CSS px, not pixels the model has to estimate.
- The agent reads it in one pass, as text, with the findings listed on top.
- One call covers several viewports and color schemes.
Install
pxtree drives Playwright's Chromium. Install it once, about 150 MB:
pxtree itself downloads nothing and never edits your project. --channel chrome uses an installed Chrome instead. Needs Node 20 or newer.
MCP server
OpenCode, opencode.json:
Other clients and config files
Any MCP client that reads mcpServers:
VS Code, .vscode/mcp.json:
Amp, settings.json:
Zed, settings.json:
MCP Registry name: io.github.alabsi91/pxtree. The server has two tools: measure, and read_me_first, which returns what the skill holds: how to use pxtree, how to report, and the reading guide. Its instructions tell the agent to call read_me_first once per session, so no skill install is needed.
measure takes target and the CLI flags as inputs: viewports, schemes, scroll, element, children, colors, wait, script, screenshot (true saves a PNG per run under the temp directory), timeout, maxChars (default 80000), diff, diffKey, report (tree, findings, summary, changes or none) and aria (true adds the aria tree). One call can return the report, the aria tree and a screenshot together. Inputs are bounded: viewport sides 1 to 10000, at most 10 viewports, timeout at most 120000. A file target must sit under the server's working directory. That rule prevents accidents and is not a security boundary: script is trusted code that runs as Node in the server process.
Skill
For agents that read Agent Skills, Codex included through .agents/skills:
Or link it by hand. ~/.agents/skills is read by Codex, Cursor, Copilot, Gemini CLI, OpenCode, Amp and Devin. Claude Code reads ~/.claude/skills.
Use <project>/.agents/skills or <project>/.claude/skills for one project only.
Shell-only agents
Tell the agent to run this. It prints the flags, the output grammar, every tag and finding, and the limits.
CLI
The screenshot is clipped to the --element match only when the selector matches exactly one element. Otherwise it is the whole viewport, and the facts line says how many matched.
--report picks how much of the measurement prints: tree (the default, everything), findings (the tree cut down to the lines with a finding and the names of their ancestors), summary (no tree), changes (the facts line and since last run, to check a fix) or none (the facts line only). A width alone in --viewport gets a matching height: 390x844, 768x1024, 820x1180, 1024x768, 1280x800, 1440x900, 1920x1080, and 800 for any other width. --aria adds Playwright's aria snapshot of the page, or of each --element match, after the report: roles, names, states and reading order, taken in the same state as the measurement. So one call can carry the findings, the accessibility tree and a screenshot.
npx -y pxtree@latest --help lists the flags. npx -y pxtree@latest guide explains how to read the output.
Limits
- Coverage is checked only inside the viewport.
- Declarative closed shadow roots are not walked.
- iframes are not walked. Measure the frame URL on its own.
- Pseudo-element ink is placed on the element's box.
- Clip paths count as their border box. Border radius is ignored.
- Inside a rotated or scaled box there are no overlap, centering or width findings. Its axis-aligned boxes do not say where things are.
- Contrast is not measured over images or gradients, where the
[text]tag sayson image, nor for a transparent text fill such as gradient text, where it saysfill transparent. small targetskips links inside a line of text and targets with enough spacing, as WCAG 2.5.8 allows.- pxtree does not guess intent. A full-bleed section, an avatar stack, an open popover or a collapsed panel prints its numbers like anything else.
- Desktop emulation only:
(hover: hover)and(pointer: fine)match. No touch. - Vertical writing modes print physical positions.
- Loading waits at most 2 s for
loadand 1.5 s for a quiet network, which files skip. Slower pages need--wait.
API
License
MIT
Source: README.md at commit 7ea7617
Tools
0Version history
2- v0.1.2LatestSep 24, 2026
- v0.1.0Sep 24, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts