ChromeDevTools / ChromeDevTools/chrome-devtools-mcp

Feature Request: Support for computed styles

Open
#86 9 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

collecting-feedback confirmed feature
Dominant language
TypeScript
Stars
52.3k
Forks
4.3k
Avg merge
2d 7h
Merged PRs (30d)
83

Description

Summary

Please add first-class support for retrieving computed CSS styles through the Chrome DevTools MCP server. Today the MCP surface lets an AI agent inspect DOM/attributes and take screenshots, but it cannot read the browser’s computed styles, which are essential for reliable layout/debugging automation.

Why this matters
  • LLMs need ground-truth layout data (final box model, visibility, z-index, display/position, resolved colors/margins/paddings) to diagnose “element not visible,” overlap, off-screen placement, or cascade/specificity issues.
  • Visual diffs alone miss subtle regressions (1–2px shifts, collapsed margins, inherited font changes).
  • Computed styles enable deterministic before/after comparisons during HMR or CI visual checks.
Requested capabilities (minimum viable)
  • Get computed styles for a node: resolved values for all properties (option to filter list).
  • Get box model metrics: content/padding/border/margin, client/offset/bounding rect, device-pixel-rounded values.
  • Visibility diagnostics: isVisible (accounting for display/visibility/opacity/clip/path, 0×0, off-viewport, overflow hidden).
  • Inheritance/precedence hints: which rule “wins” (selector + stylesheet URL/line), optional list of overridden declarations.
  • Batch mode: request multiple node IDs in one call for perf.
  • Diff helper (optional): server returns changed computed properties between two snapshots.
Sketch of API (illustrative)
  • dom.getComputedStyles({ nodeId, properties?: string[] }) -> { computed: Record<string,string>, sourceMap?: RuleOrigin[] }
  • dom.getBoxModel({ nodeId }) -> { content, padding, border, margin, clientRect, boundingRect }
  • dom.getVisibility({ nodeId }) -> { isVisible, reasons: string[] }
  • dom.getComputedStylesBatch({ nodeIds: string[] }) -> {...}
Example use cases
  • Verify a fix: “Confirm the button’s clickable area is ≥44×44 CSS px and vertically centered in its parent.”
  • Root-cause: “Why is .toast not visible after CSS changes?” (visibility + winning rule).
  • Regression diff in CI: “List computed properties that changed for #header vs. previous build.”

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing Chrome DevTools MCP tools for DOM or attribute inspection and screenshots; the issue does not name specific files or tests. Compare their node-ID handling and response shapes with the proposed computed-style, box-model, visibility, batch, and optional diff capabilities. Done means the agreed minimum API is implemented with coverage for its returned layout and visibility data.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend-api-design, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.