CSSセレクタ、プロパティ、コンポーネントの参照に関するローカルなナレッジグラフをAIコーディングエージェントに提供し、正確なスタイルコンテキストを実現します。
別名 mack-peng/cssgraph
- スター
- 2
- ツール
- 13
- ダウンロード数(30日間)
- —
- 最新バージョン
- 0.6.3
- 最終コミット
- 2026年9月16日
- ライセンス
- MIT
cssgraph MCPとは
cssgraphはMCPサーバーです。 CSSセレクタ、プロパティ、コンポーネントの参照に関するローカルなナレッジグラフをAIコーディングエージェントに提供し、正確なスタイルコンテキストを実現します。. 13個のツールを提供しており、cssgraph_explore, cssgraph_search, cssgraph_callersなどがあります。
プロジェクトのREADMEから生成された概要
cssgraph MCP server について
cssgraphは、CSSセレクタ、プロパティ、およびコンポーネントの参照に関するローカルなナレッジグラフをAIコーディングエージェントに提供します。grepやglobコマンドを使用して手動でファイルをクロールすることなく、エージェントに正確なスタイルコンテキストを与えるように設計されています。スタイルシートやコンポーネントファイルをインデックスすることで、エージェントは単一のツール呼び出しで、カスケード、詳細度、およびスタイル変更の影響を理解できます。
このシステムはSQLiteデータベースを使用してローカルで動作し、Node.js version 22.5.0以上が必要です。CSS、SCSS、Less、Sass、CSS-in-JSに加え、JSX、TSX、およびERBやHamlなどのさまざまなビューテンプレートを含む幅広いフォーマットをサポートしています。ユーザーは cssgraph init コマンドでインデックスを初期化し、mcp-installユーティリティを使用してClaude Code、Cursor、またはCodexなどのエージェントに接続できます。
このサーバーは、ファイル変更を監視する自動同期を通じて、最新のインデックスを維持します。完全なスタイルコンテキストを取得するための cssgraph_explore や、クラス名の変更による影響範囲を特定するための cssgraph_impact など、13個の特化したツールを提供します。このローカルアプローチにより、エージェントはプロジェクト内の常に最新のスタイリング情報にアクセスできます。
プロジェクトの README から作成されています。すべてのユースケースは、その引用と照らし合わせて確認されています。
cssgraph MCPのインストール方法
フォーマット検証日 2026年11月10日Claude Codeにcssgraph MCPをインストール
$ claude mcp add cssgraph -- npx -y cssgraphCursorにcssgraph MCPをインストール
~/.cursor/mcp.json
{
"mcpServers": {
"cssgraph": {
"command": "npx",
"args": [
"-y",
"cssgraph"
]
}
}
}VS Codeにcssgraph MCPをインストール
.vscode/mcp.json
{
"servers": {
"cssgraph": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"cssgraph"
]
}
}
}Claude Desktopにcssgraph MCPをインストール
claude_desktop_config.json
{
"mcpServers": {
"cssgraph": {
"command": "npx",
"args": [
"-y",
"cssgraph"
]
}
}
}Codexにcssgraph MCPをインストール
~/.codex/config.toml
[mcp_servers.cssgraph] command = "npx" args = ["-y", "cssgraph"]
Gemini CLIにcssgraph MCPをインストール
~/.gemini/settings.json
{
"mcpServers": {
"cssgraph": {
"command": "npx",
"args": [
"-y",
"cssgraph"
]
}
}
}cssgraph MCPツール 13
READMEから検出cssgraph_explorecssgraph_searchcssgraph_callerscssgraph_impactcssgraph_rulecssgraph_impact_selectorcssgraph_detailscssgraph_unusedcssgraph_cascadecssgraph_diagnosecssgraph_propertycssgraph_files
| cssgraph_explore | — | |
| cssgraph_search | — | |
| cssgraph_callers | — | |
| cssgraph_impact | — | |
| cssgraph_rule | — | |
| cssgraph_impact_selector | — | |
| cssgraph_details | — | |
| cssgraph_unused | — | |
| cssgraph_cascade | — | |
| cssgraph_diagnose | — | |
| cssgraph_property | — | |
| cssgraph_files | — |
13個のツールをすべて表示ツールを折りたたむ
cssgraph_status
| cssgraph_status | — |
自動チェック
実行日 2026年11月14日詳細レポート →自動チェックに合格しました。これはセキュリティ監査ではありません。コードを読み、サーバーに必要最小限のアクセス権を与えてください。 チェックの仕組み
- ソースリポジトリがリンクされており、アクセス可能mack-peng/cssgraph is public and reachablegithub.com/mack-peng/cssgraph ↗合格
- パッケージがこのリポジトリをソースとして示しているcssgraph names mack-peng/cssgraph as sourcenpmjs.com/package/cssgraph ↗合格
- ビルドの来歴(Sigstore 証明)Sigstore attestation for cssgraphnpmjs.com/package/cssgraph/v/0.6.3#provenance ↗合格
- オープンソースライセンス (OSI)MITspdx.org/licenses/MIT.html ↗合格
- 過去1年以内にコミットまたはリリースありLast commit or release 2026-09-16github.com/mack-peng/cssgraph ↗合格
- OpenSSF Scorecard未チェック
- パッケージ名が有名なパッケージに酷似していないNo popular package one edit away from cssgraph合格
- パッケージと依存関係に重大なアドバイザリがない20 resolved dependencies checked; no critical advisoryosv.dev ↗合格
- モデルへの隠れた指示がない13 tool descriptions and the README read; no override phrases, credential paths or hidden characters合格
- 破壊的なツールがラベル付けされているNo tool named like delete, drop or exec合格
- リモート endpoint が MCP ハンドシェイクに応答する未チェック
README
GitHubで見るcssgraph
CSS Intelligence for AI Coding Agents
Surgical style context · fewer tool calls · faster answers · 100% local
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.):
Install and configure cssgraph by following the instructions here:
https://raw.githubusercontent.com/mack-peng/cssgraph/main/docs/guide/installation.md
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:
curl -s https://raw.githubusercontent.com/mack-peng/cssgraph/main/docs/guide/installation.md
Quick Start
1. Initialize
npm i -g cssgraph
cd your-project
cssgraph init --workers 8
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
cssgraph mcp-install
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:
{
"mcpServers": {
"cssgraph": {
"type": "stdio",
"command": "cssgraph",
"args": ["serve", "--mcp"]
}
}
}
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
┌───────────────────────────────────────────────────────────┐
│ AI Agent │
│ │
│ "What code files use .btn-primary?" │
│ calls cssgraph_rule — one tool call │
│ │ │
└─────────────────────────────┬─────────────────────────────┘
│
▼
┌───────────────────────────────────────────────────────────┐
│ cssgraph MCP Server │
│ │
│ rule · O(1) exact selector lookup · loose/strict impact │
│ explore · properties + overrides + specificity + callers │
│ │ │
│ ▼ │
│ SQLite knowledge graph │
│ classNames · properties · variables · at-rules │
│ edges · FTS5 full-text search │
└───────────────────────────────────────────────────────────┘
- 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
cssgraph init [path] [-w, --workers <n>] # Initialize + build graph
cssgraph index [path] [-w, --workers <n>] # Rebuild from scratch
cssgraph query <className> # Search for className selectors
cssgraph explore <query...> # Full style context for a className
cssgraph details <selector> # O(1) exact selector → file:line lookup
cssgraph rule <selector> [--strict] # Selector impact: exact + loose/strict files
cssgraph impact-selector <selector> # Code files affected by a selector
cssgraph impact <className> # Blast radius of changing a className
cssgraph unused # Find unreferenced class selectors
cssgraph cascade <className> # Visualize cascade path
cssgraph diagnose <className> [chain...] # Static anchor diagnosis (height/scroll)
cssgraph property <query...> # Search by CSS property value
cssgraph files [path] # Project style file tree
cssgraph status [path] # Index statistics
cssgraph sync [path] # Incremental update
cssgraph serve --mcp # Start MCP server
cssgraph mcp-install # Auto-wire to your AI agent (alias: install)
cssgraph skill-install # Install/update SKILL.md only (no MCP config changes)
cssgraph skill-uninstall # Remove SKILL.md only (no MCP config changes)
cssgraph mcp-uninstall # Remove from your AI agent (alias: uninstall)
cssgraph version # Print installed version
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.
| Project | Total files | First index | Nodes | Edges |
|---|---|---|---|---|
| Small | ~50 | ~15s | ~16K | ~50K |
| Production monorepo | ~11K | ~3-5m | ~780K | ~22M |
MCP Tools
| Tool | Purpose |
|---|---|
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 |
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:
| cssgraph (static) | cssprobe-cli (runtime) | |
|---|---|---|
| Analyzes | source code (CSS/SCSS/Less + JSX/TSX + templates) | live browser (computed styles + DOM) |
| Answers | where a class is defined, cascade, impact, unused CSS | actual rendered layout, overflow, scroll, height chains |
| When | before/without a browser | after static analysis, to verify at runtime |
| Usage | cssgraph init + explore/rule/impact |
open + inspect/layout/findings |
Recommended workflow for a style problem — go static first, then verify at runtime:
# 1. Static: find the definitions, cascade, and blast radius (cssgraph)
cssgraph explore .btn-primary
cssgraph cascade .btn-primary
# 2. Runtime: confirm what actually renders (cssprobe-cli)
npm i -g cssprobe-cli
cssprobe-cli open https://example.com
cssprobe-cli inspect .btn-primary
cssprobe-cli findings .btn-primary
Install: npm install -g cssprobe-cli (requires Node.js >= 22.5.0). See npm / GitHub.
Supported Languages
| Language | Extension | Extraction |
|---|---|---|
| CSS | .css |
PostCSS standard |
| SCSS | .scss |
postcss-scss plugin |
| Less | .less |
postcss-less plugin |
| Sass (indented) | .sass |
Compile → PostCSS |
| PostCSS custom | .pcss |
PostCSS standard |
| JSX / TSX | .jsx .tsx |
className + CSS-in-JS |
| JavaScript / TypeScript | .js .ts .es6 |
className + CSS Modules |
| ERB (Rails) | .erb |
class="..." extraction |
| Haml (Rails) | .haml |
.classname + {:class =>} extraction |
| HTML | .html |
class="..." extraction |
| CSS Modules | .module.css .module.scss .module.less |
Dynamic import resolution |
| Tailwind | tailwind.config.js + CSS @theme |
v3 JS config + v4 CSS config |
Production Scale
| Project | Total files | First index | Nodes | Edges |
|---|---|---|---|---|
| Small | ~50 | ~15s | ~16K | ~50K |
| Production monorepo | ~11K | ~3-5m | ~780K | ~22M |
Project Configuration
Zero-config by default. Optional .cssgraph.json at your project root:
{
"exclude": ["static/vendor/", "**/legacy/**"],
"extensions": {
".pcss": "css"
}
}
Built-in default excludes (always applied): **/*.test.*, **/*.stories.*, **/*.spec.*, **/*.min.*, **/__tests__/**, **/__snapshots__/**, **/__mocks__/**, **/generated/**, **/spec/**, **/vendor/**.
Supported Platforms
| Platform | Architectures | Install |
|---|---|---|
| macOS | x64, arm64 | npm |
| Linux | x64, arm64 | npm |
| Windows | x64, arm64 | npm |
If cssgraph is useful
A ⭐ star helps other developers discover it — and tells us to keep shipping.
License
MIT
cssgraph MCPのよくある質問
cssgraph MCPをClaude Codeに追加するには
ターミナルでclaude mcp add cssgraph -- npx -y cssgraphを実行します。すべてのプロジェクトで利用するには--scope userを追加します。
cssgraph MCPをCursorに追加するには
~/.cursor/mcp.jsonを開き、上記のインストールセクションに示すCursor設定を使ってmcpServersの下にサーバーを追加します。
cssgraph MCPが提供するツールは
13個のツールを提供しており、cssgraph_explore, cssgraph_search, cssgraph_callers, cssgraph_impact, cssgraph_ruleなどがあります。
cssgraphはどのファイルをインデックスしますか?
CSS、SCSS、Less、Sass、JSX/TSX、JavaScript、TypeScript、ERB、Haml、およびHTMLファイルをインデックスします。
cssgraphの動作にブラウザは必要ですか?
いいえ、cssgraphはソースコードを読み取る静的解析ツールです。ブラウザでのライブレンダリングを含む実行時の質問については、cssprobe-cliを使用してください。
ファイルの変更にはどのように対応しますか?
デフォルトで自動同期が有効になっており、MCP serverがプロジェクトを監視して、ファイルが変更されるたびにグラフをインクリメンタルに更新します。
システム要件は何ですか?
node:sqliteをサポートするために、Node.js version 22.5.0以上が必要です。