Skip to main content

CSS analysis and documentation MCP server for FastBlocks ecosystem

Project description

CSS MCP Server

CSS Analysis and Documentation MCP Server for the FastBlocks ecosystem.

Features

  • CSS Analysis: 150+ metrics 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 Enable debug mode

Available Tools

Tool Description
analyze_css Full CSS analysis with 150+ 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

Integration with FastBlocks

This server is designed for analyzing programmatically generated CSS from FastBlocks style adapters:

  • Kelp UI: Custom lightweight CSS framework
  • WebAwesome: Font Awesome's component library
  • Vanilla: Minimal semantic styling

Example: Analyze Generated CSS

from css_mcp.analyzer import CSSAnalyzer

# Analyze CSS generated by FastBlocks style adapter
analyzer = CSSAnalyzer()
metrics = analyzer.analyze(kelp_css)

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

# Get optimization suggestions
suggestions = analyzer.get_suggestions()

Metrics

The analyzer provides 150+ metrics 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

MIT

Project details


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.1.1.tar.gz (234.8 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.1.1-py3-none-any.whl (27.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: css_mcp-0.1.1.tar.gz
  • Upload date:
  • Size: 234.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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.1.1.tar.gz
Algorithm Hash digest
SHA256 cb3b6578fbe7442be05312a34d127d92c7e047f662f2c6195036d654332a8800
MD5 89235ea16a3c42b846e174a37e2ae5dc
BLAKE2b-256 abaa7cc1211f73a3947ba589601184487c8fa07ab908c8ce3c9c5a408f406828

See more details on using hashes here.

File details

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

File metadata

  • Download URL: css_mcp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 27.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5597c1c7ca232c5cf08eb581875f14d2cc882af4c82567597b984896d399e764
MD5 6a6dad32e5d48cd6f75b12f6b7327b4f
BLAKE2b-256 5bd3b03b4813938ecf1e56418f046654e67a23593adbe7bcee0a9bda4f2b6843

See more details on using hashes here.

Supported by

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