Skip to main content

CSS MCP Server

Code style: crackerjack Runtime: oneiric Framework: FastMCP uv Python: 3.14+

Universal CSS Analysis and Documentation MCP Server. Analyze any CSS with ~150 derived metrics (built on ~78 CSSMetrics fields plus selector/property counters) for complexity, specificity, and quality.

Features

  • CSS Analysis: ~150 derived metrics (78 CSSMetrics fields plus selector/property counters) for CSS complexity, specificity, and quality
  • MDN Documentation: Fetch CSS property docs from MDN Web Docs
  • Browser Compatibility: Check cross-browser support for CSS properties
  • Project Analysis: Analyze all CSS files in a project

Installation

# Using uv
uv pip install css-mcp

# Using pip
pip install css-mcp

Usage

Start Server

# Via CLI
css-mcp

# Via Python module
python -m css_mcp.server

Environment Variables

Variable Default Description
CSS_MCP_HTTP_PORT 3050 Server port
CSS_MCP_HTTP_HOST localhost Server host
CSS_MCP_DEBUG false Inherited Oneiric debug flag; sets the field on CSSMCPSettings but has no local behavioral effect (no code path in css_mcp/ reads settings.debug yet). Wire-up is tracked as a follow-up.

Available Tools

Tool Description
analyze_css Full CSS analysis with ~150 derived metrics
analyze_css_summary Quick CSS summary (faster)
get_docs MDN documentation for CSS properties
get_browser_compatibility Check browser support for properties
search_properties Search for CSS properties
get_properties_by_category Get properties by category
analyze_project_css Analyze all CSS in a project
list_capabilities List available capabilities
health_check Check server health

Programmatic Usage

Use the analyzer directly in Python for any CSS:

Example: Analyze Any CSS

from css_mcp.analyzer import CSSAnalyzer

# Analyze any CSS content
analyzer = CSSAnalyzer()
metrics = analyzer.analyze(css_content)

# Get complexity score
print(f"Complexity: {metrics.complexity_score}/100")

# Get optimization suggestions
suggestions = analyzer.get_suggestions()

Metrics

The analyzer provides ~150 derived metrics (built from 78 CSSMetrics fields plus selector and property counters), including:

Basic Metrics

  • Total rules, selectors, properties
  • File size (bytes, gzipped)
  • Lines of code

Selector Metrics

  • ID, class, element, universal selectors
  • Pseudo-classes and pseudo-elements
  • Combinators (descendant, child, sibling)
  • Selector depth

Specificity Metrics

  • Average, min, max specificity
  • High specificity rules
  • Specificity distribution

Property Metrics

  • Unique properties
  • Category distribution (layout, typography, etc.)
  • Vendor prefixes
  • !important usage
  • CSS custom properties

Quality Metrics

  • Duplicate selectors
  • Duplicate properties
  • Empty rules
  • Complexity score
  • Efficiency scores

Browser Compatibility

Built-in compatibility data for common CSS properties across:

  • Chrome
  • Firefox
  • Safari
  • Edge

Development

# Install dev dependencies
uv sync --group dev

# Run tests
pytest

# Type check
mypy css_mcp

# Lint
ruff check css_mcp

Installation via Claude Code marketplace

The css plugin is published through the www-mcp-servers marketplace. Register the marketplace once, install the plugin, and the css-mcp HTTP server becomes available as mcp__css__* tools alongside three slash commands (/css-audit-project, /css-analyze, /css-check-compat). The plugin manifest lives at .claude-plugin/plugin.json and the server is registered in the colocated .mcp.json at http://localhost:3050/mcp — start the css-mcp server first, then run claude plugin install css --marketplace www-mcp-servers from a fresh session.

License

BSD-3-Clause

Built on Oneiric for runtime configuration and mcp-common for the FastMCP baseline. Crackerjack gates every commit.

Metadata

Release files for css-mcp 0.5.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for css-mcp 0.5.4
File Size Uploaded
css_mcp-0.5.4.tar.gz 835.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for css-mcp 0.5.4
File Interpreter ABI Platform
css_mcp-0.5.4-py3-none-any.whl Python 3 none any Details

Total release size: 868.8 kB

Release files / css_mcp-0.5.4.tar.gz

Download URL css_mcp-0.5.4.tar.gz
Size 835.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6b48f3b4fe5dbd301155e4273714a296d7ee9ffc54f4c39d0888e56b8d5b14e7
BLAKE2b-256 checksum
How to use checksums
c1fc0642828f605a43b8af3813a5fe50568d846f8dcd0b68ede2fc9488e9cf5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / css_mcp-0.5.4-py3-none-any.whl

Download URL css_mcp-0.5.4-py3-none-any.whl
Size 33.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c993a0c22f157ee28e7fb52be4512e1d9b44ce33397aa9484534153d2d4c9cfa
BLAKE2b-256 checksum
How to use checksums
d9732644dd8aaf0b565b3f0126c1a07ad2bcb6fb52e0922076062156180158c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.5.4 This release

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page