classmcp
Provides semantic class names for Bootstrap 5, enabling AI to generate concise, SSR-safe HTML components with minimal class strings, and supports custom patterns and minification.
Generates semantic class names for Tailwind CSS, reducing token usage by replacing long utility class strings with short, readable names like btn-primary or card, with SSR safety awareness and optional minification.
Supports UnoCSS by offering pre-defined semantic class names and patterns, allowing AI to produce compact, readable code that is SSR-safe and can be minified for maximum token savings.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@classmcp get btn-primary class for tailwind"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
classmcp
Multi-Framework MCP Server for AI-Optimized CSS Generation
Stop wasting tokens on long utility class strings. Let AI generate code with semantic class names like btn-primary and card - with full SSR safety awareness and optional minification.
Supports Tailwind CSS, Bootstrap 5, UnoCSS, and Tachyons.
The Problem
When AI generates utility-first CSS code, it creates verbose class strings:
<button class="inline-flex items-center justify-center px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors">
Click me
</button>This wastes:
AI tokens - longer context = higher costs
Your time - harder to read and debug
Bundle size - repeated patterns bloat HTML
SSR safety - easy to accidentally use client-only patterns
Related MCP server: Design-MCP
The Solution
classmcp provides semantic class names to AI assistants:
<!-- Semantic -->
<button class="btn-primary">Click me</button>
<!-- Or ultra-minified for maximum savings -->
<button class="a">Click me</button>The AI queries available patterns, uses short names, and you get clean, readable code that's SSR-safe.
Installation
For Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"classmcp": {
"command": "npx",
"args": ["classmcp"]
}
}
}For other MCP clients
npx classmcpFeatures
Multi-Framework Support
Switch between CSS frameworks instantly:
set_framework: "tailwind" # Default
set_framework: "bootstrap" # Bootstrap 5
set_framework: "unocss" # UnoCSS
set_framework: "tachyons" # TachyonsSSR Safety
Every pattern is marked for server-side rendering compatibility:
get_ssr_info: "modal-overlay"
→ Status: ⚠️ Requires Client JS
→ Warning: Modal visibility controlled by JS
→ Recommendations: Use useEffect to add client-only classesFilter for SSR-safe patterns only:
list_classes: { ssrSafeOnly: true }Minification
Generate ultra-short class names for maximum token savings:
get_class: { name: "btn-primary", minified: true }
→ Class: "a" (saves 11 chars per usage)Custom Patterns
Define your own semantic class names by creating a .classmcp.json file in your project root:
Simple format:
{
"customPatterns": [
{ "id": "brand-btn", "classes": "px-4 py-2 bg-brand-600 text-white rounded-lg font-semibold" },
{ "id": "pricing-card", "classes": "p-8 border-2 border-gray-100 rounded-2xl shadow-xl" }
]
}With states and metadata:
{
"customPatterns": [
{
"id": "brand-btn",
"category": "buttons",
"description": "Brand-colored primary button",
"classes": {
"base": "px-4 py-2 bg-brand-600 text-white rounded-lg font-semibold",
"hover": "hover:bg-brand-700 hover:shadow-md",
"focus": "focus:ring-2 focus:ring-brand-300"
}
}
],
"overrideBuiltins": false,
"defaultFramework": "tailwind"
}Config options:
Option | Description |
| Array of custom pattern definitions |
| If |
| Default framework to use (tailwind, bootstrap, unocss, tachyons) |
Pattern options:
Field | Required | Description |
| Yes | Unique identifier (e.g., "brand-btn") |
| Yes | CSS classes (string or state object with base/hover/focus/active/disabled) |
| No | Category for organization (defaults to "custom") |
| No | Human-readable name (defaults to id) |
| No | Description of when to use |
| No | Limit to specific frameworks (e.g., ["tailwind"]) |
| No | Whether pattern is SSR-safe |
Alternative config locations:
.classmcp.json(recommended)classmcp.config.jsonpackage.jsonunder"classmcp"key
After modifying your config, use the reload_config tool to apply changes without restarting.
Available Tools
Tool | Description |
| Set CSS framework (tailwind, bootstrap, unocss, tachyons) |
| Get utility classes for a semantic name |
| List available classes (filter by category, SSR-safe) |
| Search for classes by name or description |
| Generate CSS file with all class definitions |
| Get complete HTML component examples |
| Check SSR/hydration safety for a pattern |
| List all available frameworks with statistics |
| Reload custom patterns from config file |
| List all user-defined custom patterns |
Class Categories
buttons - btn-primary, btn-secondary, btn-danger, btn-ghost, btn-outline
cards - card, card-bordered, card-header, card-body, card-footer
forms - input, input-error, label, select, checkbox, textarea, toggle
badges - badge-primary, badge-success, badge-warning, badge-danger
alerts - alert-info, alert-success, alert-warning, alert-error
avatars - avatar-sm, avatar-md, avatar-lg
layout - container, flex-center, flex-between, stack, row, grid-2, grid-3
typography - heading-xl, heading-lg, heading-md, text-body, text-muted
navigation - nav, nav-link, nav-link-active
modals - modal, modal-overlay, modal-header, modal-body, modal-footer
tables - table, table-header, th, td, tr-hover
lists - list, list-item, list-item-hover
loading - spinner, skeleton, skeleton-text, skeleton-avatar
dividers - divider, divider-vertical
Usage Example
Ask Claude:
"Create a card with a user profile, showing avatar, name, email, and action buttons"
Claude will use classmcp to generate:
<div class="card">
<div class="flex-start space-x-4">
<div class="avatar-lg">JD</div>
<div class="stack">
<h3 class="heading-sm">John Doe</h3>
<p class="text-muted">john@example.com</p>
</div>
</div>
<div class="card-footer">
<button class="btn-primary">Message</button>
<button class="btn-secondary">Profile</button>
</div>
</div>Setup Your Project
Generate the CSS:
# Ask Claude to use the generate_css tool, or:
npx classmcp generate-css > src/classmcp.cssImport in your CSS:
Tailwind:
@import "tailwindcss";
@import "./classmcp.css";Bootstrap:
@import "bootstrap/dist/css/bootstrap.min.css";
@import "./classmcp.css";Token Savings
Component | Without classmcp | With classmcp | Minified | Savings |
Button | 180 chars | 12 chars | 1 char | 99% |
Card | 85 chars | 5 chars | 1 char | 99% |
Input | 145 chars | 6 chars | 1 char | 99% |
Modal | 200+ chars | 12 chars | 1 char | 99% |
Over a full page with 50+ components, this adds up to thousands of tokens saved.
SSR Safety Guide
Safe for SSR (no JS needed)
All button variants (hover/focus are CSS pseudo-classes)
All card patterns
Form inputs (base styling)
Typography patterns
Layout utilities
Badges, alerts
Requires Client JS (may cause hydration issues)
modal-overlay- visibility needs JStoggle- checked statespinner- animation timingalert-dismissible- close button
Use ssrSafeOnly: true or check with get_ssr_info when building Next.js/Nuxt/Remix apps.
Framework Statistics
Framework | Patterns | SSR-Safe | Categories |
Tailwind CSS | 70+ | 65+ | 14 |
Bootstrap 5 | 70+ | 65+ | 14 |
UnoCSS | 70+ | 65+ | 14 |
Tachyons | 70+ | 65+ | 14 |
How It Works
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Claude │────▶│ classmcp │────▶│ Your Code │
│ │ │ (MCP) │ │ │
│ "Make a │ │ │ │ <button │
│ button" │ │ get_class │ │ class= │
│ │◀────│ btn-primary │ │ "btn- │
│ │ │ (SSR-safe) │ │ primary"> │
└─────────────┘ └─────────────┘ └─────────────┘AI asks classmcp for available classes
classmcp returns semantic names + SSR safety info
AI generates code using short class names
You add the generated CSS to your project
Your CSS framework compiles it
Related: classpresso
classmcp = AI layer (development time) - helps AI generate clean code
classpresso = Build layer (build time) - optimizes existing code
They're complementary:
Use classmcp when writing new code with AI
Use classpresso to optimize existing/legacy code
License
MIT
Links
Available Tools
10 toolsgenerate_cssB
Generate CSS that defines all semantic classes. Add this to your project's CSS file to use the semantic class names.
Inputs: categories, minified, includeStates.
get_classB
Get the full utility classes for a semantic class name. Returns the CSS classes you should use in your HTML. Supports SSR-safe filtering.
Inputs: name (required), minified, ssrSafe, includeStates.
get_componentB
Get a complete HTML component example using semantic classes. Great for seeing how classes work together.
Inputs: component (required), minified.
get_ssr_infoA
Get SSR/hydration safety information for a class pattern. Use this when building SSR/Next.js/Nuxt/Remix applications to avoid hydration mismatches.
Inputs: name (required).
list_classesA
List all available semantic class names, optionally filtered by category. Use this to discover available patterns.
Inputs: category, ssrSafeOnly.
list_custom_patternsA
List all custom (user-defined) patterns loaded from your config file.
Inputs: framework.
list_frameworksA
List all available CSS frameworks and their statistics.
Inputs: no named parameters.
reload_configA
Reload custom patterns from the config file (.classmcp.json). Use this after modifying your config file.
Inputs: no named parameters.
search_classesA
Search for classes by name, description, or category. Use when you're not sure of the exact class name.
Inputs: query (required).
set_frameworkA
Set the CSS framework to use for all subsequent operations. Choose based on your project's CSS framework. DEFAULT: tailwind
Inputs: framework (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Each tool has a clearly distinct purpose: generating CSS, retrieving class details, getting component examples, SSR info, listing classes, custom patterns, frameworks, configuration reload, searching, and framework setting. No overlap or ambiguity.
All tool names follow a consistent verb_noun snake_case pattern (e.g., generate_css, list_classes, set_framework). No mixing of conventions or vague verbs.
10 tools is well-scoped for a CSS utility server, covering all necessary operations without overloading or underprovisioning.
The tool surface covers generation, discovery, configuration, framework selection, and SSR compatibility. No obvious gaps for the domain.
Maintenance
Related MCP Connectors
Unified 15-tool SEO, SERP, clean Markdown & GEO (LLM citation Share-of-Voice) MCP server.
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
MCP server that lets your AI assistant build and deploy apps, hosting each one at a live URL.
LLM cost optimization gateway, repo token-waste auditor & model arbitrage MCP server.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA comprehensive MCP server providing TailwindCSS utilities, documentation, conversion tools, and template generation to assist AI in TailwindCSS development.43 npm1MIT
- FlicenseNot gradedqualityBmaintenanceAn MCP server that enables AI agents to semantically retrieve premium UI components from Awwwards and adapt them into clean React + Tailwind code.1-
- FlicenseNot gradedqualityDmaintenanceAn AI-powered MCP server that generates production-ready React + Tailwind UI, 3D components, and full-stack integrations from natural language prompts inside Claude Desktop.-
- AlicenseNot gradedqualityDmaintenanceAn MCP server that detects CSS cascade conflicts and Tailwind utility clashes, returning structured reports with risk scores for AI coding agents and CI pipelines.94 npmMIT