Skip to main content

CSS MCP Server

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

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

License

BSD-3-Clause

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

css_mcp-0.3.2.tar.gz (260.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

css_mcp-0.3.2-py3-none-any.whl (29.0 kB view details)

Uploaded Python 3

File details

Details for the file css_mcp-0.3.2.tar.gz.

File metadata

  • Download URL: css_mcp-0.3.2.tar.gz
  • Upload date:
  • Size: 260.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","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}

File hashes

Hashes for css_mcp-0.3.2.tar.gz
Algorithm Hash digest
SHA256 3c8a7bb34b3a4f0ddb5ebcefd63149c54d4810e91789dcca52ad034ccbdfbbe2
MD5 b5f246b1eb93dc22400ed6ae36168504
BLAKE2b-256 69a3a06ff3469688b071e0da09f872d12e767aacfe8064a57435baf8f2fcda0e

See more details on using hashes here.

File details

Details for the file css_mcp-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: css_mcp-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 29.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","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}

File hashes

Hashes for css_mcp-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2b0a963807198f6ca107664916dd7b572445f83eb21febf3fcbc56d03dab1634
MD5 6188ff3d5901e1228637fcd3871eec69
BLAKE2b-256 cafd209cca46609700efbb01dc4a7f0bf1b48a552c6c035ef1132f4a2fb6c6d8

See more details on using hashes here.

Release history Release notifications | RSS feed

0.4.0

2 files

This release

0.3.2 This release

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page