stylespeak

v1.2.0
io.github.Patrizzos/stylespeak Checked 4 days ago Published 4 months ago

MCP server and CLI that makes CSS legible to AI agents — explains what applies and why.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

resolve_styles

Resolves what CSS actually applies to a given selector. Returns every property the selector would receive, which rule wins for each property, and which rules were overridden — with confidence levels (certain/likely/possible) since no real DOM is available. Call this before modifying styles for an element to understand the full cascade context first.

ParameterTypeDescription
selector *stringCSS selector to resolve, e.g. ".btn.primary", "#header a:hover"
componentFilesarrayOptional: absolute paths to JSX/TSX files. When provided, builds an AST component graph to upgrade selector confidence from possible to likely where ancestry is confirmed.
filesarrayAbsolute paths to CSS/SCSS files to analyze.
projectRootstringOptional: path to a project root. All CSS/SCSS files will be discovered recursively.

trace_property

Traces a CSS property across all provided files — finding every rule that sets it, grouping competing rules that target overlapping selectors, and showing who wins in each group. Use this to understand the blast radius of a property before changing it, or to find out why a property value isn't applying as expected.

ParameterTypeDescription
property *stringCSS property name to trace, e.g. "color", "background-color", "padding"
filesarrayAbsolute paths to CSS/SCSS files to analyze.
projectRootstringOptional: path to a project root. All CSS/SCSS files will be discovered recursively.

live_resolve

Resolves CSS for a selector by querying a live running browser via Chrome DevTools Protocol (CDP). Returns exact computed styles and every matched rule in cascade order — no static analysis, no heuristics, confidence is always exact. Requires Chrome or any Chromium browser (Edge, Brave, Arc) running with --remote-debugging-port=9222. Use this when you need ground truth. Fall back to resolve_styles when no browser is running.

ParameterTypeDescription
selector *stringCSS selector to resolve against the live DOM, e.g. ".btn.primary", "#header a"
portnumberCDP port (default: 9222). Change if you started Chrome with a different port.
tabUrlstringOptional URL substring to target a specific tab. If omitted, uses the first available tab.

impact_preview

Predicts the blast radius of a proposed CSS change before it is made. Given a selector, property, and optional new value, returns every competing rule in the codebase that would be affected — showing which selectors will see a different value, which are shielded by higher specificity, which cascade relationships are uncertain, and which downstream rules are affected through CSS variable chains or inheritance. Works without a browser. Use this before making any CSS change to understand the full impact.

ParameterTypeDescription
property *stringThe CSS property you are about to change, e.g. "background-color", "--color-primary"
selector *stringThe CSS selector you are about to change, e.g. ".btn", ":root"
filesarrayAbsolute paths to CSS/SCSS files to analyze.
newValuestringOptional: the new value you plan to set. Enables before/after comparison in variable chain impacts.
projectRootstringOptional: path to a project root. All CSS/SCSS files will be discovered recursively.

style_manifest

Builds a compressed, structured summary of a project's entire CSS knowledge — selectors, properties, variables, competition groups, and risk hotspots — that an agent can load ONCE at the start of a session and keep in context. Use this at the beginning of any CSS editing task to understand the landscape before querying individual selectors. Much faster than running resolve_styles on every selector. Follow up with resolve_styles, trace_property, or impact_preview for deep analysis of specific selectors surfaced in the manifest.

ParameterTypeDescription
filesarrayAbsolute paths to CSS/SCSS files to analyze.
maxSelectorsnumberMaximum selectors to include (default: 200). Hotspot selectors are prioritised when truncating.
projectRootstringPath to project root. All CSS/SCSS files discovered recursively.