
Cssgraph
io.github.mack-pengPublished by GitHub account mack-pengv0.6.3Updated Oct 24, 2026
CSS intelligence for AI coding agents — surgical style context, fewer tool calls. 100% local.
Overview
Gives an AI coding assistant a local CSS knowledge graph so it can look up class definitions, cascade overrides, and affected files in one call.
- What you can do
- cssgraph indexes a project's stylesheets (CSS, SCSS, Less, Sass, PostCSS, CSS Modules, Tailwind) plus JSX/TSX and view templates into a local SQLite graph of classNames, properties, variables, at-rules, and edges such as contains, nests, overrides, imports, and references. Its 13 MCP tools answer questions like where a class is defined, what cascades over it, which components reference it, what a change would affect, which classes are unused, and how a cascade path runs. A file watcher keeps the index in sync as code changes.
- When to use it
- Useful when an assistant works on front-end styling in a real project and would otherwise grep and read files one at a time to reconstruct the cascade. It fits refactors, impact checks before changing a class, and finding unused or overridden selectors. It is static analysis only; runtime rendering questions need a separate browser-based tool.
- Requirements
- A local process started over stdio, installed from the npm package cssgraph. Requires Node.js >= 22.5.0 (for node:sqlite) and a project to index; run cssgraph init in the project first. No accounts, API keys, or environment variables are declared. Desktop only, not available as a web executable.
Installation
In SourceWeft
- Open Cssgraph in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
cssgraph
CSS Intelligence for AI Coding Agents
Surgical style context · fewer tool calls · faster answers · 100% local
[License: MIT] [Node.js] [npm version] [npm downloads] [GitHub stars]
Why cssgraph?
When an AI agent needs to understand CSS — where is .btn-primary defined, what properties does it have, which selectors cascade over it, which JSX components reference it — it discovers style the slow way: grep, glob, and Read, one file at a time, reconstructing the cascade by hand.
cssgraph hands the agent the exact style context it needs in one call. It's a pre-built knowledge graph of every className, CSS property, variable, and at-rule in your stylesheets — so instead of crawling files, the agent asks one question and gets back the properties, overrides, specificity, callers, and file-level impact in full.
Installation
For Humans
Copy and paste this prompt to your LLM agent (Claude Code, Cursor, Codex, etc.):
Or read the Installation Guide, but seriously, let an agent do it. Humans fat-finger configs.
For LLM Agents
Fetch the installation guide and follow it:
Quick Start
1. Initialize
Indexes all style files (CSS, SCSS, Less, Sass), JSX/TSX className references, CSS-in-JS, CSS Modules, and view templates (ERB/Haml/HTML) — enabling every MCP tool.
Pass --workers <n> to control parallel parse threads (default: cpu cores - 1).
Requires Node.js >= 22.5.0 (for node:sqlite).
2. Wire up your agent
Auto-detects and configures opencode, Claude Code, Cursor, Codex CLI, Gemini CLI,
Hermes Agent, Antigravity IDE, and Kiro. Writes MCP server config, instructions
block, and an Agent Skill (SKILL.md + references/pitfalls.md) that teaches
agents when to use each of the 13 cssgraph tools, how to chain them into
workflows, and what pitfalls to avoid.
Or add to any MCP agent manually:
3. No more syncing
Auto-sync is enabled by default. The MCP server watches your project and updates the graph on every file change — while your agent edits code, or you add/modify/delete CSS files. The index is never stale.
How It Works
- Extraction — PostCSS parses CSS/SCSS/Less/Sass into ASTs. CSS-in-JS (
styled.div), JSX className references, and template class attributes extracted from.jsx/.tsx/.erb/.hamlfiles. - Storage — Everything goes into a local SQLite database (
.cssgraph/cssgraph.db) with FTS5 full-text search. WAL-mode + batch commits for write performance. FTS triggers and unique indexes are deferred during bulk load for speed. - Graph — Edges connect related nodes:
contains(selector→property),nests(parent→child selector),overrides(higher specificity selector overrides lower),imports(file→imported file),references(JSX/view file→className, property→CSS variable). - Git-first scanning —
git ls-filesfor instant file discovery. Falls back to filesystem walk on non-git projects. - Parallel parsing — Files dispatched in batches to worker threads via
Promise.all. Parses complete concurrently; results flushed in file order for correctness. - Auto-Sync — Native OS file events, debounced, incrementally synced.
CLI Reference
JSX and View File Scanning (default)
cssgraph always scans:
- JSX/TSX/JS/TS/ES6 —
classNamereferences, CSS-in-JS, CSS Modules - View templates —
.erb,.haml,.htmlfiles forclass="..."attributes and Haml.classnameshorthand
This enables cssgraph_impact, cssgraph_callers, and cssgraph_rule to track both component files AND template files that reference each className.
MCP Tools
Complementary Tool: cssprobe-cli
cssgraph is a static analysis tool — it reads your source code and answers where a class is defined, what cascades over it, and what a change would affect. For runtime questions — what a page actually renders in a browser (overflow, scroll chains, computed height chains, containing block hijacks) — use cssprobe-cli, which opens a real browser and reads computed styles plus DOM metrics. The two tools complement each other:
Recommended workflow for a style problem — go static first, then verify at runtime:
Install: npm install -g cssprobe-cli (requires Node.js >= 22.5.0). See npm / GitHub.
Supported Languages
Production Scale
Project Configuration
Zero-config by default. Optional .cssgraph.json at your project root:
Built-in default excludes (always applied): **/*.test.*, **/*.stories.*, **/*.spec.*, **/*.min.*, **/__tests__/**, **/__snapshots__/**, **/__mocks__/**, **/generated/**, **/spec/**, **/vendor/**.
Supported Platforms
If cssgraph is useful
A ⭐ star helps other developers discover it — and tells us to keep shipping.
License
MIT
Source: README.md at commit 6f8726d
Tools
0Version history
1- v0.6.3LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts