# cssgraph [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/mack-peng/cssgraph  
**GitHub Stars:** 2  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/cssgraph

## Description
CSS intelligence for AI coding agents — surgical style context, fewer tool calls. 100% local.

## Tools
Capabilities this server exposes over MCP:

- **cssgraph_explore** — PRIMARY**: Full style context for a className — properties, overrides, specificity, callers
- **cssgraph_search** — Search for className selectors by name
- **cssgraph_callers** — Find JSX components referencing a className
- **cssgraph_impact** — Blast radius of changing a className
- **cssgraph_rule** — Blast radius of a full CSS selector (exact match + loose/strict file impact)
- **cssgraph_impact_selector** — Find code files (JS/TS/JSX/TSX) affected by a CSS selector
- **cssgraph_details** — O(1) exact selector lookup (no edges, lightweight)
- **cssgraph_unused** — Find class selectors with no incoming references
- **cssgraph_cascade** — Visualize the cascade path for a className
- **cssgraph_diagnose** — Static anchor diagnosis for scroll/height issues — classifies height declarations as DEFINITE / INDEFINITE / UNVERIFIABLE along the ancestor chain
- **cssgraph_property** — Search selectors by CSS property value
- **cssgraph_files** — Indexed style file tree
- **cssgraph_status** — Index health check

## Claude Desktop Quick Installation
No confirmed install details yet, so no config is published. Follow the setup steps in the repository above.

## Documentation

## What cssgraph MCP server does

The cssgraph MCP server gives coding agents structured access to CSS relationships in a project. It can locate class selectors, return their properties and specificity, show selectors that override them, identify JSX or template callers, and estimate the files affected by a style change. It also supports selector-level lookups, property-value searches, cascade inspection, unused-class detection, and static diagnosis of height-related scroll or anchor problems.

The index covers CSS, SCSS, Less, and Sass stylesheets. During initialization it also scans JSX, TSX, JavaScript, TypeScript, CSS-in-JS, CSS Modules, and view templates such as ERB, Haml, and HTML. This lets impact and caller queries include both component files and supported template references.

## How it works

cssgraph parses styles with PostCSS and stores the extracted data in a local SQLite database at `.cssgraph/cssgraph.db`. SQLite FTS5 provides full-text search. The graph records relationships such as selectors containing properties, nested selectors, specificity-based overrides, stylesheet imports, code references to class names, and CSS properties linked to variables.

File discovery starts with `git ls-files` when the project is a Git repository and falls back to a filesystem scan otherwise. Parsing can run across worker threads, while results are written in file order. After initialization, native file events and debouncing support incremental synchronization as files change. The cssgraph MCP server therefore works from a local project index rather than a remote service.

## Setup and configuration

Install the package globally with npm, then run initialization from the project directory:

```bash
npm i -g cssgraph
cd your-project
cssgraph init --workers 8
```

The `--workers` value controls parallel parse threads; the documented default is the number of CPU cores minus one. Node.js 22.5.0 or newer is required because the project uses `node:sqlite`.

Start the MCP endpoint with:

```bash
cssgraph serve --mcp
```

For manual client configuration, use a standard stdio entry with `cssgraph` as the command and `serve --mcp` as its arguments. The `cssgraph mcp-install` command can write configuration for supported agents including Claude Code, Cursor, Codex CLI, and Gemini CLI. It also installs an instructions block and an agent skill describing tool workflows and known pitfalls. Auto-sync is enabled by default after setup.

## Tools and capabilities

The primary `cssgraph_explore` tool combines properties, overrides, specificity, and callers for a class name. Other tools provide narrower operations:

- Search class selectors, exact selectors, or selectors by property value.
- Find code and template callers for a class name.
- Calculate class-name and full-selector impact, including loose or strict file impact.
- Show the cascade path or identify unreferenced class selectors.
- Diagnose definite, indefinite, or unverifiable height declarations along an ancestor chain.
- Browse the indexed style-file tree and check index health.

The cssgraph MCP server also exposes lightweight exact selector lookup through `cssgraph_details`, which omits graph edges for a smaller query, and `cssgraph_impact_selector`, which reports affected code files for a selector.

## Limitations and notes

The diagnosis tool performs static analysis of height declarations; its classifications are DEFINITE, INDEFINITE, or UNVERIFIABLE and should not be treated as runtime layout measurement. The repository documents support for macOS, Linux, and Windows, but does not describe browser execution or remote indexing. Initial indexing time and graph size vary with the project: the README gives approximately 15 seconds for a small project and three to five minutes for an 11,000-file production monorepo.

_Full upstream README: https://allmcps.com/mcp/cssgraph/readme_

