CSS

The CSS MCP Server brings authoritative MDN CSS documentation and detailed stylesheet analysis directly into AI assistants like Claude Code, Gemini CLI, and Cursor AI.

You can get immediate answers about CSS syntax or browser compatibility and run a health check on your code without leaving your editor.

Features

  • πŸ“š Live MDN Documentation: Pulls the latest CSS documentation straight from MDN’s API, so you always have the most current information.
  • 🌐 Browser Compatibility Data: Checks browser support information from MDN’s Browser Compat Data (BCD).
  • πŸ“Š In-depth CSS Analysis: Provides over 150 metrics on your CSS, covering everything from selector complexity to code quality and performance.
  • 🎨 Design Pattern Detection: Identifies design patterns in your code, like color palettes, font sizes, and spacing units.
  • πŸš€ Smart Caching: Uses an SQLite-based cache to make repeat requests for documentation significantly faster.
  • πŸ“‚ Full Project Analysis: Scans all CSS files in a directory to give you a project-wide overview of your styles.

Use Cases

  • Quick Syntax & Compatibility Checks: Instead of switching to a browser to look up the syntax for grid or check if you can use the :has selector, you can ask your AI assistant directly in your editor.
  • Auditing Legacy CSS: When you inherit an old project with a massive, messy stylesheet, you can run analyze_project_css on the entire build directory. This gives you a high-level summary of selector complexity, redundant properties, and color usage to help plan a refactor.
  • Enforcing Design System Consistency: Before a major release, run a project-wide analysis to find all unique colors and font sizes. This helps you spot inconsistencies and ensure the code adheres to your established design system.
  • Code Reviews: Use the analyze_css tool on a specific file during a code review to get objective metrics on code quality. It can identify overly complex selectors or redundant code that might otherwise be missed.

Installation

For Claude Code:

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

For VS Code:

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

For Other MCP Clients (like Claude Desktop):

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

Available Tools

get_docs: This tool fetches CSS documentation for any property, selector, or concept.

  • slug (string): The name of the CSS feature (e.g., "flexbox", ":has") or a full MDN path.

Example:

get_docs({ slug: "grid" });

get_browser_compatibility: This fetches browser support data for a CSS feature.

  • bcd_id (string): The Browser Compat Data ID, like "css.properties.grid".

Example:

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

analyze_css: This tool analyzes a string of CSS code. By default, it returns a lightweight summary. For a full report with over 150 metrics, set summaryOnly to false.

  • css (string, required): The CSS code you want to analyze.
  • summaryOnly (boolean, optional): Set to false for the complete analysis. Defaults to true.

Example:

analyze_css({
  css: `
    .container {
      display: grid;
      color: #3b82f6;
    }
  `
});

analyze_project_css: This tool analyzes all CSS files within a specified path, which is useful for getting a complete overview of a project. It’s framework-agnostic and works on the final built CSS.

  • path (string, required): The directory, file path, or glob pattern to analyze.
  • includeFullAnalysis (boolean, optional): Set to true for the full 150+ metrics. Defaults to false.
  • exclude (array of strings, optional): Additional glob patterns to exclude from the analysis.

Example:

// Analyze all CSS in the 'dist' folder
analyze_project_css({ path: "dist" });

FAQs

Q: What is the main benefit of the server’s cache?
A: Speed. The first time you fetch documentation for a specific CSS property, it takes around 400-500ms. After that, any subsequent requests for the same property are served from the cache in about 100ms.

Q: Why does it need Node.js 20+?
A: The MCP server uses modern JavaScript features and native modules like better-sqlite3 that require a recent Node version for performance and compatibility.

Q: Can it analyze SCSS or LESS files?
A: No. It works on compiled CSS only. Pass it the output from your build step (e.g., dist/styles.css), not source preprocessor files.

Q: What if MDN’s API is down?
A: The server falls back to its local cache if available. If no cached entry exists and the network request times out (after 10 seconds), it returns an error.

Q: How accurate is the selector complexity analysis?
A: It uses the same algorithm as CSS linters: counts ID, class, pseudo-class, and tag selectors per rule. A .nav li a:hover selector has complexity 4.

Q: Does it work offline?
A: Only for previously cached documentation. CSS analysis works fully offline since it runs locally.

Latest MCP Servers

Notion

Notion's official MCP Server allows you to interact with Notion workspaces through the Notion API.

Log Mcp

An MCP server that provides 7 tools for log analysis, including error fingerprinting, pattern comparison, and ML classification.

Apple

An MCP package that provides AI assistants with direct access to Notes, Messages, Mail, Contacts, Reminders, Calendar, and Maps via AppleScript and EventKit.

View More MCP Servers >>

Featured MCP Servers

Notion

Notion's official MCP Server allows you to interact with Notion workspaces through the Notion API.

Claude Peers

An MCP server that enables Claude Code instances to discover each other and exchange messages instantly via a local broker daemon with SQLite persistence.

Excalidraw

Excalidraw's official MCP server that streams interactive hand-drawn diagrams to Claude, ChatGPT, and VS Code with smooth camera control and fullscreen editing.

More Featured MCP Servers >>

FAQs

Q: What exactly is the Model Context Protocol (MCP)?

A: MCP is an open standard, like a common language, that lets AI applications (clients) and external data sources or tools (servers) talk to each other. It helps AI models get the context (data, instructions, tools) they need from outside systems to give more accurate and relevant responses. Think of it as a universal adapter for AI connections.

Q: How is MCP different from OpenAI's function calling or plugins?

A: While OpenAI's tools allow models to use specific external functions, MCP is a broader, open standard. It covers not just tool use, but also providing structured data (Resources) and instruction templates (Prompts) as context. Being an open standard means it's not tied to one company's models or platform. OpenAI has even started adopting MCP in its Agents SDK.

Q: Can I use MCP with frameworks like LangChain?

A: Yes, MCP is designed to complement frameworks like LangChain or LlamaIndex. Instead of relying solely on custom connectors within these frameworks, you can use MCP as a standardized bridge to connect to various tools and data sources. There's potential for interoperability, like converting MCP tools into LangChain tools.

Q: Why was MCP created? What problem does it solve?

A: It was created because large language models often lack real-time information and connecting them to external data/tools required custom, complex integrations for each pair. MCP solves this by providing a standard way to connect, reducing development time, complexity, and cost, and enabling better interoperability between different AI models and tools.

Q: Is MCP secure? What are the main risks?

A: Security is a major consideration. While MCP includes principles like user consent and control, risks exist. These include potential server compromises leading to token theft, indirect prompt injection attacks, excessive permissions, context data leakage, session hijacking, and vulnerabilities in server implementations. Implementing robust security measures like OAuth 2.1, TLS, strict permissions, and monitoring is crucial.

Q: Who is behind MCP?

A: MCP was initially developed and open-sourced by Anthropic. However, it's an open standard with active contributions from the community, including companies like Microsoft and VMware Tanzu who maintain official SDKs.

Get the latest & top AI tools sent directly to your email.

Subscribe now to explore the latest & top AI tools and resources, all in one convenient newsletter. No spam, we promise!