Logo van CSS MCP Server

CSS MCP Server

Community
stolinski

An MCP (Model Context Protocol) server that provides up-to-date CSS documentation from MDN and comprehensive CSS code analysis.

Uitgeverstolinski
Repositorycss-mcp
TaalJavaScript
Forks
11
Sterren
333
Beschikbare tools
4
Transporttypestdio
Categorieën
Links
  • Koppel tools aan AI-workflows

    CSS MCP Server biedt MCP-functionaliteit die compatibele AI-clients en agenten kunnen gebruiken.

  • 4 beschikbare tools

    Bekijk hieronder de aanroepbare acties, inclusief namen en beschrijvingen als de server die beschikbaar stelt.

  • Configuratie om direct te kopiëren

    Gebruik de installatievoorbeelden om deze server in je favoriete MCP-client te configureren.

  • Indicatoren van opensource-interesse

    333 sterren en 11 forks in de gekoppelde repository.

CSS MCP Server

An MCP (Model Context Protocol) server that provides up-to-date CSS documentation from MDN and comprehensive CSS code analysis.

Features

Documentation & Compatibility:

  • Official MDN Docs - Fetches documentation directly from MDN's API
  • Browser Compatibility - Includes browser support data from MDN's BCD
  • Simple API - Just pass CSS property names like "grid", "flexbox", or ":has"
  • Markdown Conversion - Converts HTML documentation to clean, readable markdown
  • Auto-normalization - Supports both simple slugs ("grid") and full paths ("Web/CSS/grid")
  • Smart Caching - SQLite-based cache with 7-day TTL for blazing-fast responses

CSS Analysis:

  • 150+ Metrics - Comprehensive analysis of stylesheet quality and complexity
  • Design Patterns - Detect color palettes, font sizes, spacing patterns
  • Code Quality - Selector complexity, specificity analysis, property usage
  • Performance Insights - Identify overly complex selectors and redundant code

Installation

For Claude Code

Install via the Claude Code CLI:

bash
claude mcp add css -- npx -y css-mcp

For VS Code

One click install:

Install in VS Code Install in VS Code Insiders

Install via VS Code CLI:

bash
code --add-mcp '{\"name\":\"css\",\"command\":\"npx\",\"args\":[\"-y\",\"css-mcp\"],\"env\":{}}'

For MCP Clients (Claude Desktop, etc.)

Add to your MCP settings configuration:

json
{
  "mcpServers": {
    "css": {
      "command": "npx",
      "args": ["-y", "css-mcp"]
    }
  }
}

For Development

bash
npm install -g css-mcp

Or use with npx:

bash
npx css-mcp --self-test

Requirements

  • Node.js 20+
  • Build tools for native modules (usually pre-installed on most systems)

Usage

Available Tools

get_docs

Fetch CSS documentation for any property, selector, function, or concept.

Parameters:

  • slug (string) - CSS feature name or MDN path

Examples:

javascript
// Simple slugs (auto-normalized)
get_docs({ slug: "grid" });
get_docs({ slug: ":has" });
get_docs({ slug: "flexbox" });
get_docs({ slug: "@media" });
get_docs({ slug: "::before" });

// Full MDN paths also work
get_docs({ slug: "Web/CSS/grid" });
get_docs({ slug: "en-US/docs/Web/CSS/border-radius" });

Returns:

json
{
  "source": "mdn-doc",
  "slug": "/en-US/docs/Web/CSS/grid",
  "url": "https://developer.mozilla.org/en-US/docs/Web/CSS/grid/index.json",
  "title": "grid",
  "mdn_url": "/en-US/docs/Web/CSS/grid",
  "summary": "The grid CSS property is a shorthand...",
  "body": [
    {
      "type": "prose",
      "title": "Syntax",
      "content": "The **`grid`** property is a shorthand..."
    }
  ]
}

get_browser_compatibility

Fetch browser compatibility data for CSS features.

Parameters:

  • bcd_id (string) - Browser Compat Data ID (e.g., "css.properties.grid")

Example:

javascript
get_browser_compatibility({ bcd_id: "css.properties.grid" });
get_browser_compatibility({ bcd_id: "css.selectors.has" });

analyze_css

Analyze CSS code for quality, complexity, and design patterns. Returns curated summary by default (lightweight, ~1-2k tokens). Use summaryOnly: false for complete 150+ metrics (uses ~10k+ tokens).

Parameters:

  • css (string, required) - CSS code to analyze
  • summaryOnly (boolean, optional) - Return summary instead of full analysis. Default: true

Examples:

javascript
// Summary mode (default, lightweight)
analyze_css({
  css: `
    .container {
      display: grid;
      color: #3b82f6;
    }
  `
});

// Full analysis with all 150+ metrics
analyze_css({
  css: "...",
  summaryOnly: false
});

Returns (default summary):

json
{
  "analysis": {
    "stylesheet": {
      "sourceLinesOfCode": 5,
      "size": 72
    },
    "rules": { "total": 1 },
    "selectors": {
      "total": 1,
      "averageComplexity": 1.0,
      "maxComplexity": 1
    },
    "colors": {
      "unique": 1,
      "uniqueColors": ["#3b82f6"]
    }
  },
  "note": "Summary metrics only. Use summaryOnly: false for complete 150+ metrics."
}

analyze_project_css

Analyze all CSS files in a project. Finds CSS files recursively, combines them, and provides project-wide analysis. Framework-agnostic - works with built CSS from any framework (SvelteKit, React, Vue, etc.).

Returns curated summary metrics by default (lightweight, ~1-2k tokens). Use includeFullAnalysis: true for complete data (uses ~10k+ tokens).

Automatically excludes:

  • **/node_modules/**
  • **/*.min.css

Parameters:

  • path (string, required) - File path, directory, or glob pattern
  • includeFullAnalysis (boolean, optional) - Return full 150+ metrics instead of summary. Default: false
  • exclude (array of strings, optional) - Additional glob patterns to exclude

Examples:

javascript
// Analyze all CSS in a directory (summary - default, lightweight)
analyze_project_css({ path: "dist" });

// Full analysis with all 150+ metrics (uses more tokens)
analyze_project_css({
  path: "dist",
  includeFullAnalysis: true
});

// Exclude additional patterns
analyze_project_css({
  path: "dist",
  exclude: ["**/vendor/**", "**/*.legacy.css"]
});

// Analyze specific file
analyze_project_css({ path: "public/styles.css" });

// Use glob patterns
analyze_project_css({ path: "dist/**/*.css" });

Returns (default summary):

json
{
  "files": {
    "total": 5,
    "analyzed": 5,
    "errors": 0,
    "list": [
      { "path": "/path/to/style.css", "size": 2048 },
      { "path": "/path/to/theme.css", "size": 1024 }
    ]
  },
  "summary": {
    "stylesheet": {
      "sourceLinesOfCode": 450,
      "size": 12800
    },
    "rules": { "total": 85 },
    "selectors": {
      "total": 120,
      "averageComplexity": 1.4,
      "maxComplexity": 5
    },
    "colors": {
      "unique": 12,
      "uniqueColors": ["#3b82f6", "#10b981", ...]
    },
    "fontSizes": {
      "unique": 8,
      "uniqueSizes": ["1rem", "1.5rem", ...]
    }
  },
  "note": "Summary metrics only. Use includeFullAnalysis: true for complete data."
}

Cache Management

The server automatically:

  • Creates cache at ~/.cache/css-mcp/cache.db
  • Cleans up expired entries on startup
  • Tracks hit counts for each cached entry
  • Uses WAL mode for better concurrent performance

To clear the cache:

bash
rm -rf ~/.cache/css-mcp/

Self-Test

Verify the server is working correctly:

bash
npm test
# or
css-mcp --self-test
# or
npx css-mcp --self-test

Expected output:

docs ok (simple slug): { input: 'grid', slug: '/en-US/docs/Web/CSS/grid', ... }
docs ok (pseudo-selector + markdown): { input: ':has', ... }
bcd ok: { bcd_id: 'css.properties.grid', has_compat: true, ... }

Example: Using with Claude Code

Once configured, you can ask Claude Code:

Documentation & Compatibility:

"Use the CSS MCP to get documentation for flexbox"

"What browser support does :has selector have?"

"Explain how CSS grid works"

CSS Analysis:

"Analyze this CSS and tell me what could be improved"

"What colors are used in my stylesheet?"

"Check the complexity of my selectors"

Project Analysis:

"Analyze all CSS in my dist folder"

"What's the total complexity of my project's CSS?"

"Show me all colors used across my entire project"

Claude will automatically use the MCP to fetch the latest MDN documentation and analyze CSS code.

Development

bash
# Clone the repository
git clone https://github.com/stolinski/css-mcp.git
cd css-mcp

# Install dependencies
npm install

# Link for local development
npm link

# Run tests
npm test

Performance & Limits

Caching:

  • First fetch: ~400-500ms (network + cache write)
  • Cached fetch: ~100ms (~5x faster)
  • Cache size: ~390KB for typical usage

Input Limits:

  • Max file size: 10MB per CSS file
  • Max total size: 50MB combined
  • Max files: 500 CSS files per analysis
  • Network timeout: 10 seconds for MDN API calls

Troubleshooting

"Module did not self-register"

This usually means native modules need rebuilding:

bash
npm rebuild better-sqlite3

Cache not working

Check cache directory permissions:

bash
ls -la ~/.cache/css-mcp/

Should show cache.db, cache.db-shm, and cache.db-wal files.

Contributing

This is an experimental MCP server for CSS documentation tooling, let's work on tools that make AI better at CSS

Installatie

TypingMind
Vereisten:

Node.js 18+

{
  "mcpServers": {
    "stolinski-css-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "css-mcp"
      ]
    }
  }
}

Beschikbare tools

  • get_docs

    Fetch official MDN documentation for any CSS property, selector, function, or concept. Use this tool PROACTIVELY whenever the user mentions CSS features. Supports simple slugs (auto-normalized): "grid", "flexbox", ":has", "::before", "@media", "container-queries", "calc". Also accepts full paths: "Web/CSS/grid". Always fetch docs when analyzing, fixing, or implementing CSS code.

  • get_browser_compatibility

    Get browser support data for CSS features. Use this tool when the user needs to know browser compatibility, or when suggesting modern CSS features that may need fallbacks. Format: "css.properties.grid", "css.selectors.has", "css.properties.container-type".

  • analyze_css

    Analyze CSS code for quality, complexity, and design patterns. Returns curated summary by default (lightweight, ~1-2k tokens) or full 150+ metrics with summaryOnly: false. Use this to identify issues, suggest improvements, or audit CSS codebases.

  • analyze_project_css

    Analyze all CSS files in a project directory. Finds all .css files recursively, combines them, and analyzes as a whole. Accepts: single file path, directory path, or glob pattern (e.g., "dist/**/*.css"). Framework-agnostic - analyzes built CSS output from any framework (SvelteKit, React, Vue, etc.). Automatically excludes node_modules and .min.css files. Returns file list + curated summary metrics by default (lightweight). Use includeFullAnalysis: true for complete 150+ metrics (uses more tokens).

Gebruik CSS MCP Server MCP met meerdere AI-modellen

TypingMind koppelt MCP-tools aan de werkruimte. Zodra CSS MCP Server is verbonden, kun je deze dus met verschillende AI-modellen in TypingMind gebruiken, zonder de verbinding voor elk model apart in te stellen. Deze MCP-integratie draait lokaal via de TypingMind MCP-connector op je apparaat.

Installatiehandleiding voor de lokale connector

Gebruik dit als de MCP-server toegang nodig heeft tot lokale bestanden, apps of privébronnen op je computer.

1

Open de MCP-instellingen

Ga in TypingMind naar Instellingen, Geavanceerde instellingen en vervolgens Model Context Protocol. Kies daar Connector instellen.

  1. Open TypingMind in je browser.
  2. Klik op het pictogram Instellingen.
  3. Ga naar Geavanceerde instellingen.
  4. Open het gedeelte Model Context Protocol.
  5. Klik op Connector instellen en kies Dit apparaat.
Instelscherm voor de TypingMind MCP-connector met Dit apparaat geselecteerd
2

Voer de connectoropdracht uit

Kies Dit apparaat, kopieer de opdracht uit TypingMind en voer deze uit in Terminal. Laat het proces draaien zolang je MCP gebruikt.

  1. Kopieer de installatieopdracht die TypingMind toont.
  2. Open Terminal op macOS of Windows Terminal op Windows.
  3. Plak de opdracht en voer deze uit.
  4. Keur de pakketinstallatie goed als Terminal vraagt of je wilt doorgaan.
  5. Laat het proces in het Terminal-venster draaien zolang je MCP-tools gebruikt.
3

Voeg CSS MCP Server toe als server

Klik op Servers bewerken zodra de connectorstatus Gereed is en plak de MCP-serverconfiguratie.

  1. Wacht tot de connectorstatus Gereed aangeeft.
  2. Klik op Servers bewerken.
  3. Plak de MCP-serverconfiguratie van CSS MCP Server.
  4. Sla de serverlijst op.
  5. Vernieuw om te controleren of de connector nog steeds klaar is voor gebruik.
MCP-instellingen van TypingMind met een actieve server en de knop Servers bewerken
{
  "mcpServers": {
    "stolinski-css-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "css-mcp"
      ]
    }
  }
}
4

Gebruik de verbinding met verschillende modellen

Sla de serverlijst op, open Plug-ins en schakel de MCP-tools van CSS MCP Server in. Selecteer vervolgens een ondersteund AI-model in TypingMind en gebruik de tools in de chat of wijs ze toe aan een AI-agent.

  1. Open de pagina Plug-ins in TypingMind.
  2. Schakel de MCP-tools van CSS MCP Server in.
  3. Start een chat en kies het AI-model dat je wilt gebruiken.
  4. Gebruik de MCP-tools in een chat of wijs ze toe aan een AI-agent.
  5. Schakel wanneer nodig over naar een ander AI-model zonder opnieuw verbinding te maken met MCP.
TypingMind-chat met ingeschakelde MCP-tools en een geselecteerd AI-model
Kun je CSS MCP Server gebruiken om me hiermee te helpen?
CSS MCP Server
Zeker. Ik heb het gelezen.
Dit vond ik met CSS MCP Server.

Veelgestelde vragen

Waarvoor wordt de MCP-server CSS MCP Server gebruikt?

CSS MCP Server is een MCP-server waarmee compatibele AI-clients verbinding kunnen maken met externe tools en context. In TypingMind hoef je deze MCP-server maar één keer toe te voegen om de tools beschikbaar te maken in je AI-werkruimte.

Kan ik CSS MCP Server MCP met meerdere AI-modellen in TypingMind gebruiken?

Ja. TypingMind verbindt MCP-tools op werkruimteniveau. Daardoor kun je CSS MCP Server gebruiken met verschillende AI-modellen, zoals Claude, ChatGPT, Gemini of andere modellen die je in TypingMind hebt ingesteld, zonder de MCP-server voor elk model afzonderlijk in te stellen.

Waarom CSS MCP Server MCP gebruiken met TypingMind?

TypingMind is een van de beste interfaces voor chats met LLM's, omdat het meerdere AI-modellen, prompts, plug-ins, AI-agenten, API-sleutels en MCP-tools samenbrengt in één werkruimte. Als CSS MCP Server verbonden is, kun je de MCP-tools ervan gebruiken met je favoriete modellen en je chatworkflow overzichtelijk houden in TypingMind.

Hoe verbind ik CSS MCP Server MCP met TypingMind?

CSS MCP Server werkt via de lokale MCP-connector van TypingMind. Dit is de beste optie als de MCP-server toegang nodig heeft tot lokale bestanden, desktopapps, opdrachtregeltools of privébronnen op je computer.

Welke tools biedt CSS MCP Server MCP in TypingMind?

CSS MCP Server biedt 4 MCP-tools die je kunt inschakelen via de pagina Plug-ins in TypingMind. Je kunt ze gebruiken in chats of toewijzen aan AI-agenten.

Moet ik mijn API-sleutels delen met TypingMind om CSS MCP Server MCP te gebruiken?

Nee. TypingMind werkt in de eerste plaats lokaal en laat je de controle houden over je modelaanbieders, API-sleutels, prompts en MCP-configuratie. Als CSS MCP Server authenticatie vereist, voeg je bij het maken van de verbinding de vereiste headers, OAuth-instellingen of lokale configuratie voor die MCP-server toe.

Gerelateerde MCP-servers

Toon alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇