Skip to main content
Glama

style-agent

Portable style verification toolkit (Chrome CDP + JSON specs).
Works as a CLI, and optionally as an MCP server for any MCP client (Cursor, Claude Code, etc.). Not a Cursor-only plugin.

You: define acceptance + final review
Agent / you: find → inspect → fix CSS → re-check
Channel: Chrome DevTools Protocol (no browser extension required)

Quick start (CLI)

git clone https://github.com/jtrslar/style-agent.git
cd style-agent
npm install
chmod +x launch-chrome.sh

# 1) Start debug Chrome (independent profile)
./launch-chrome.sh http://127.0.0.1:8080/your-page
# or: ./launch-chrome.sh   then navigate manually

# 2) Probe CDP / run a demo spec (adapt selectors to your DOM)
node cli.mjs status
node cli.mjs inspect demo-modal-shell.json

Demo specs under specs/examples/ use neutral class names (.demo-modal, …). Copy them into your app repo and edit selectors — do not treat examples as a product baseline.


Related MCP server: browser-devtools-mcp

Optional: MCP client

Register the server with your client. Cursor example:

See examples/mcp.cursor.json.example (replace the absolute path).

Optional Cursor rule sample: examples/cursor/style-agent.mdc.

Then refresh MCP in the client settings.


MCP tools

Tool

Purpose

style_status / style_tabs

CDP + open tabs

style_inspect

JSON spec check (failures only by default)

style_find

text / css / testid / role → uid

style_styles

computed-style subtree

style_click / style_hover / style_wait

interact then measure

style_spacing / style_dialogs / style_highlight

helpers

style_eval

advanced page expressions

No screenshots in the default path — structured JSON only.


Where specs live

Kind

Location

Project specs

Your app repo, e.g. style-specs/ or .kiro/style-specs/

This repo specs/examples/

Format demos only

Details: SPECS.md.

node cli.mjs inspect /absolute/path/to/your-app/style-specs/foo.json
# or
export STYLE_AGENT_SPECS_DIR="/absolute/path/to/your-app/style-specs"

Layout

index.mjs              MCP server entry (optional)
cli.mjs                CLI
launch-chrome.sh       debug Chrome on CDP
lib/cdp.js             CDP connect
inject/page-runtime.js page-side find + inspect
SPECS.md               project vs example specs
UPGRADE.md             optional Pixelmatch roadmap
specs/examples/        neutral demos only
examples/              MCP / Cursor samples

Environment (optional)

Variable

Default

Meaning

STYLE_AGENT_CDP_URL

http://127.0.0.1:9222

CDP endpoint

STYLE_AGENT_SPECS_DIR

./specs/examples

Spec search dir (point at your app in real use)


Upgrade path

UPGRADE.md: optional Pixelmatch gate + style-agent targeted fixes.
When style_status reports upgradeStatus=proposed, ask once whether to adopt it.


Notes

  • Log in / CAPTCHA in the debug Chrome window yourself when needed

  • Does not replace human visual taste checks; it provides structured diffs for fixing CSS

Available Tools

12 tools
style_clickB

点击 uid(开下拉/弹层)。也可传 selector 走 Playwright 真实点击。

Inputs: uid, index, scroll, timeout, +3 more.

style_dialogsC

列出 dialog / aria-modal。

Inputs: index, urlIncludes, titleIncludes.

style_evalA

页面内执行 JS 表达式(高级;优先其它工具)。

Inputs: expression (required), index, urlIncludes, titleIncludes.

style_findB

按文案/CSS/testid/role 查找元素,返回 uid(供 style_styles / style_click)。

Inputs: css, role, text, index, +4 more.

style_highlightB

高亮 uid(确认定位)。

Inputs: uid (required), index, urlIncludes, titleIncludes.

style_hoverC

悬停 uid(hover 才展开的菜单)。

Inputs: uid (required), index, scroll, urlIncludes, +1 more.

style_inspectA

按 JSON spec 跑样式/布局检查(setup+nodes+relations)。默认只返回失败项。有验收标准时优先用。

Inputs: spec, index, specJson, urlIncludes, +2 more.

style_spacingC

两 uid 元素间距。

Inputs: uidA (required), uidB (required), index, urlIncludes, +1 more.

style_statusA

检查 CDP 是否连通、列出标签。闭环开始时先调。

Inputs: no named parameters.

style_stylesA

读取模块 computed style 子树(uid 或 css)。探索/对稿时用;有 spec 优先 style_inspect。

Inputs: css, uid, depth, index, +3 more.

style_tabsB

列出调试 Chrome 中的页面标签。

Inputs: no named parameters.

style_waitC

等待元素出现(css/text/testId/role)。默认最多返回 3 条;优先用 css。

Inputs: css, role, text, index, +6 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 12 tools

    Disambiguation4/5

    Tools are mostly distinct with clear roles: find vs wait, click vs hover, styles vs inspect. However, style_status and style_tabs both list tabs, and style_styles vs style_inspect overlap in reading computed styles, creating minor confusion.

    Naming Consistency4/5

    All tools share the 'style_' prefix and are lowercase snake_case, forming a recognizable pattern. Some use verbs (find, click, wait) while others use nouns (tabs, dialogs, styles), deviating from a strict verb_noun convention but remaining predictable.

    Tool Count5/5

    With 12 tools, the set is well-scoped for a style/UI inspection purpose. Each tool covers a needed action without redundancy, fitting comfortably within the ideal 3-15 range.

    Completeness4/5

    The toolset covers the core lifecycle: health check, locating elements, reading styles, spacing, interactions, waiting, dialog listing, and spec-based inspection. Minor gaps such as missing screenshot or scroll capabilities are workarounds, but the surface is robust for style verification.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables CSS layout verification and debugging by extracting deterministic, diffable rendered layout from a browser, allowing agents to inspect, explain, and diff CSS changes.
      14 npm
      2
      MIT