What is classmcp?
classmcp is an MCP server that hands AI assistants semantic class names like btn-primary and card instead of long utility strings. It supports Tailwind CSS, Bootstrap 5, UnoCSS and Tachyons, marks each pattern for server-side rendering safety, and can return minified one-letter names.
A single Tailwind button can run to 180 characters of utility classes. classmcp trades that for btn-primary, 12 characters, or a single letter when minified. The README table puts the saving at 99 percent for a button.
The model asks the server what patterns exist, writes code using short names, and you add one generated stylesheet to the project. Your normal CSS framework then compiles it.
How the loop runs
- The assistant asks classmcp for available classes.
- classmcp returns semantic names with SSR safety information.
- The assistant writes markup using those short names.
- You generate the CSS file with the
generate_csstool or the commandnpx classmcp generate-css > src/classmcp.css. - Import that file next to Tailwind or Bootstrap and the framework compiles it.
Pattern coverage
Each of the four frameworks ships 70 or more patterns across 14 categories, including buttons, cards, forms, badges, alerts, avatars, layout, typography, navigation, modals, tables, lists, loading states and dividers.
Custom patterns live in .classmcp.json at the project root, with optional hover, focus and disabled states, a category and a framework limit. Run reload_config to apply changes without a restart.
Fit and limits
Best for
- Projects that spend many tokens on repeated utility strings.
- Next.js, Nuxt or Remix work, where hydration safety matters and
get_ssr_infoflags patterns that need client JavaScript. - Teams that want their own named patterns in
.classmcp.json, with optional hover, focus and disabled states.
Not for
- Sites with a fixed brand system where class names must match existing CSS. Define those as custom patterns first.
- Projects that need a component library's own markup and styling. classmcp provides semantic class names, and
get_componentreturns HTML examples for them. For libraries, see Starwind UI, Flowbite or shadcn.
Use it with UiChemy
classmcp shortens the class names an agent writes. UiChemy Composer works differently, writing real HTML, CSS and JavaScript inside Elementor or Gutenberg. If you build on WordPress, click Get Started on uichemy.com to compare.
Connect classmcp: Give AI Short Semantic Class Names Instead of Utility Strings to your AI client
npx classmcpAdd it to Claude Desktop
Put the snippet above in claude_desktop_config.json. For other MCP clients, run npx classmcp as the server command.
Pick a framework
Call set_framework with tailwind, bootstrap, unocss or tachyons. Tailwind is the default.
Generate the stylesheet
Run npx classmcp generate-css > src/classmcp.css, or ask the assistant to use generate_css.
Import it into your CSS
With Tailwind add @import "tailwindcss"; then @import "./classmcp.css";. With Bootstrap import its stylesheet first, then your generated file.
Add custom patterns if needed
Create .classmcp.json at the project root, or classmcp.config.json, or a classmcp key in package.json.
Client configuration
{
"mcpServers": {
"classmcp": {
"command": "npx",
"args": ["classmcp"]
}
}
}Endpoints and ports
.classmcp.jsonRecommended location for custom patterns; classmcp.config.json also worksWhat you can do with it
- Four frameworks, one switchTailwind CSS, Bootstrap 5, UnoCSS and Tachyons share the same semantic names, and set_framework changes which utilities back them.
- Token savingsThe repository description claims 77 percent token savings, and the README table shows a button dropping from 180 characters to 12, or 1 when minified.
- SSR safety on every patternPatterns are marked safe or client-only. modal-overlay, toggle, spinner and alert-dismissible need client JS, and get_ssr_info explains why.
- Minified class namesAsk for minified output and a name like btn-primary becomes a single letter, saving 11 characters per use in the README example.
- Custom patterns with statesDefine your own ids in .classmcp.json with base, hover, focus, active and disabled classes, and optionally override built-ins.
- Fourteen built-in categoriesButtons, cards, forms, badges, alerts, avatars, layout, typography, navigation, modals, tables, lists, loading and dividers are covered.
- Component examplesget_component returns complete HTML examples, and generate_css writes the stylesheet that backs every name.
Tools it exposes
set_framework
Sets the CSS framework to tailwind, bootstrap, unocss or tachyons.
get_class
Returns the utility classes for a semantic name, with an optional minified form.
list_classes
Lists available classes, filterable by category and by SSR-safe only.
search_classes
Searches classes by name or description.
generate_css
Generates a CSS file with all class definitions.
get_component
Returns complete HTML component examples.
get_ssr_info
Checks server-side rendering and hydration safety for a pattern.
list_frameworks
Lists all available frameworks with statistics.
reload_config
Reloads custom patterns from the config file.
list_custom_patterns
Lists all user-defined custom patterns.
Frequently asked questions
What is classmcp?
classmcp is a multi-framework MCP server for AI-assisted CSS. It gives assistants semantic class names such as btn-primary and card instead of long utility strings, supports four CSS frameworks, and flags which patterns are safe for server-side rendering.
How do I install classmcp?
For Claude Desktop, add an mcpServers entry that runs npx with the argument classmcp. For any other MCP client, run npx classmcp. Then generate the stylesheet with npx classmcp generate-css and import it next to your framework's CSS.
Which CSS frameworks does it support?
Tailwind CSS, Bootstrap 5, UnoCSS and Tachyons. Tailwind is the default, and the set_framework tool switches between them. The README lists 70 or more patterns, 65 or more of them SSR-safe, across 14 categories for each framework.
Does it work with Claude Code and Cursor?
The README documents a Claude Desktop config and says other MCP clients can run npx classmcp. The repository topics include Cursor and Claude. Check your own client's MCP settings, since only the Claude Desktop setup is spelled out.
Is the generated code safe for Next.js or Nuxt?
Each pattern is marked for SSR compatibility. Buttons, cards, typography, layout, badges and alerts are safe. A modal overlay, toggle, spinner and dismissible alert need client JavaScript, so use ssrSafeOnly or get_ssr_info in server-rendered apps.
How much does it save?
The README table shows a button going from 180 characters to 12, or 1 when minified, and a card from 85 to 5. The repository description summarizes the benefit as 77 percent token savings.
Can I add my own class names?
Yes. Create .classmcp.json at the project root with customPatterns, each with an id and classes, and optionally states, category, description and a framework limit. Run reload_config to apply the changes without restarting the server.
What is classpresso?
The README names classpresso as a related build-time tool. classmcp helps an AI write clean code during development, while classpresso optimizes existing or legacy code at build time, and the two are described as complementary.


