Cssgraph logo

Cssgraph

Indexes CSS and code references locally, then exposes style context, cascade, usage, and impact analysis through MCP tools.

Install Cssgraph

Pick your client, then add it in one click or paste the config.

No confirmed install command yet

We only publish a config when the install details come from the project itself — its README, its docs, or a verified owner. We haven’t found those for cssgraph, and we’d rather show nothing than a guess you’d paste into your client.

Open setup steps on GitHub

Overview

The cssgraph MCP server builds a local graph of CSS selectors, properties, variables, at-rules, and code references. It parses CSS-family files and scans JSX, TypeScript, CSS-in-JS, CSS Modules, and view templates into SQLite with full-text search. Agents can query style definitions, cascade relationships, callers, unused selectors, and change impact through 13 MCP tools. Use it when an agent needs repository-wide CSS context without reconstructing relationships through repeated file searches.

Use cases

  • Inspect a class selector's properties and overrides
  • Trace components and templates that reference a class
  • Estimate files affected by changing a selector
  • Find unused class selectors
  • Diagnose static height-chain issues

Key features

  • Local SQLite CSS knowledge graph
  • Cascade and specificity analysis
  • Class and selector impact analysis
  • JSX, TypeScript, and template reference scanning
  • Incremental file-change synchronization
  • MCP tools for CSS search and diagnostics

Tools13

What Cssgraph lets your agent do. Expand a tool for its parameters.

Self-reported~229 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

14/14 checks healthy over the last 68d

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars2Stargazers on the source repository.
Last commit2mo agoMost recent push to the default branch.
Tools exposed13Callable tools this server registers over MCP.

How Cssgraph works

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:

Terminal
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.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Cssgraph

cssgraph is an MCP server that connects AI coding agents to a local graph of CSS files, code references, and templates. Its main tools explore styles, search selectors, trace callers, inspect cascade paths, diagnose height chains, find unused classes, and estimate the impact of class or selector changes.

Install it globally with npm, run `cssgraph init` in the project, then start it with `cssgraph serve --mcp`. Node.js 22.5.0 or newer is required. You can run `cssgraph mcp-install` to configure supported agents automatically, or add the stdio command manually.

Yes, cssgraph can configure Cursor through `cssgraph mcp-install`. The command detects Cursor and writes the MCP server configuration, instructions block, and agent skill. Manual configuration uses the `cssgraph serve --mcp` command over stdio.

cssgraph watches the project for file changes and incrementally updates the local graph by default. Native operating-system file events and debouncing handle edits, additions, and deletions to CSS and related files. The CLI also provides a `cssgraph sync` command for an explicit incremental update.

cssgraph indexes CSS, SCSS, Less, and Sass, along with JSX, TSX, JavaScript, TypeScript, CSS-in-JS, CSS Modules, ERB, Haml, and HTML references. These scans support class callers, selector impact analysis, and related graph queries.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewCssgraph AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/cssgraph?style=directory)](https://allmcps.com/mcp/cssgraph)
HTML Embed
<a href="https://allmcps.com/mcp/cssgraph"><img src="https://allmcps.com/api/badge/cssgraph?style=directory" alt="Cssgraph on AllMCPs" /></a>