tailwind-mcp
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., "@tailwind-mcp diagnose p-4 flex bg-red-501 mt-[16px] p-2 p-4 shadow-sm"
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.
tailwind-mcp
A Model Context Protocol server that asks Tailwind itself. No hand-written class lists, no stale snapshots — the server loads your project's own
tailwindcssand queries the real engine, so every answer matches the code you actually build.
Tools | 9 read-only tools ( |
Engine | your project's own |
Class list | 23 000+ real utilities, straight from the engine that generates them |
Latency | 13–340 ms per call, no network, no database |
Dependencies | one runtime dependency tree from the official SDK |
Reload | config edits are picked up automatically — no restart, ever |
Why this exists
An LLM writing Tailwind makes three mistakes, all of them the same mistake: it invents classes that do not exist.
<div class="bg-gray-600 p-4 shadow-lg">
<!-- does this class exist in THIS project? -->
<div class="bg-red-550 mt-[16px]">
<!-- typo, and a magic number instead of a token -->
<div class="p-2 p-4 text-sm text-lg"><!-- which of these two actually wins? --></div>
</div>
</div>Every existing "Tailwind MCP" answers this by shipping a class list copied from a documentation snapshot. That list is wrong the moment you use a custom theme, a plugin, or a version newer than the copy — and it cannot tell you which of two conflicting classes wins, because that depends on your project's own configuration.
This server has no list. It loads the tailwindcss package from your node_modules and asks
the engine:
your project → your tailwindcss → the real engine → the real answerthe class list contains exactly the utilities your project can build, including custom theme values,
@utilityblocks and plugin classes;the version is yours, so v3 and v4 projects each get the truth for their own generation;
which class wins a conflict is decided by Tailwind's own class order, not by a guess;
when you edit your config, the server notices and rebuilds itself — no restart.
Related MCP server: TailwindCSS MCP Server
Install
Requires Node.js ≥ 20.
git clone https://github.com/vitkuz573/tailwind-mcp.git
cd tailwind-mcp
npm ci
npm run buildConnect a host
OpenCode
opencode mcp add tailwind -- node /absolute/path/to/tailwind-mcp/dist/index.jsOr by hand:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"servers": {
"tailwind": {
"type": "local",
"command": ["node", "/absolute/path/to/tailwind-mcp/dist/index.js"],
"timeout": { "startup": 60000, "execution": 120000 },
},
},
},
}The server finds the project by walking up from its working directory until it finds a
node_modules/tailwindcss. Every tool also takes an optional project argument with an absolute
path, for when the Tailwind project is not the current directory.
Claude Code
claude mcp add tailwind -- node /absolute/path/to/tailwind-mcp/dist/index.jsAny other MCP client
node dist/index.js # stdio transportThe tool surface
tailwind_diagnose — start here
One call, every problem with a class list.
{ "candidates": ["p-4 flex bg-red-501 mt-[16px] p-2 p-4 shadow-sm"] }Finding | Meaning | Example |
unknown | the class does not exist, with spelling suggestions |
|
arbitrary | an arbitrary value where a theme token would do |
|
conflicting | one class silently overrides another |
|
migration | a v3 class whose meaning changed in v4 |
|
Suggestions come from the real class list, so a missing shade is completed too: bg-brand becomes
bg-brand-500 when your project defines that scale.
The rest
Tool | Answers |
| Do these classes exist, and what CSS do they produce? |
| What is the exact name of the utility I need? |
| Which design tokens does this project define? |
| Which variants does this project understand? |
| Which of these two classes wins? |
| How should this class list be written? |
| What does this v3 class become in v4? |
| Is this text readable on that background? |
Details worth knowing
Which class wins. Tailwind sorts the utilities it generates, and at equal specificity the later
rule wins. The server asks the engine for that order rather than guessing, so p-4 beating p-2
is a fact, not a heuristic. Shorthands are expanded, so p-4 and pl-2 are correctly seen to
fight over the left padding.
The v3 trap. In v4 the whole shadow, radius and blur scale shifted. shadow-sm still exists —
and now means what shadow-xs used to mean. The server flags that as meaning-changed, because the
class compiles and the bug is silent.
Contrast. Tailwind v4 stores colours as oklch(). The server converts to sRGB following
CSS Color 4, including the chroma reduction needed for colours outside the sRGB gamut, and reports
the WCAG AA and AAA verdicts.
Reloading. The set of files that feed the design system is discovered by following @import,
@config and @plugin, and a size/mtime fingerprint of those files decides whether the engine
has to be rebuilt. Edit any of them and the next call sees the change.
Package imports. A real stylesheet imports more than itself: the framework's own sheet,
packages that ship utilities (tw-animate-css), and sub-paths of packages (shadcn/tailwind.css).
All three are resolved through the package's exports map, preferring the style condition, and
plugins are loaded from packages too (@plugin "@tailwindcss/typography"). Nothing has to be
rewritten or stubbed out.
Performance
Measured against a real project with a custom theme, on the first call after a server start:
Tool | Latency |
| 13 ms |
| 16 ms |
| 17 ms |
| 21 ms |
| 126 ms |
| 305 ms |
| 344 ms |
There is no network call, no database and no cache to go stale. The engine is rebuilt when your configuration changes, so the first call after an edit pays the reload cost once.
Tailwind's own
canonicalizeCandidatesis deliberately not used: it builds an index of every class on first use, which takes seconds and blocks the event loop. The same two rules are applied locally against your theme instead, which answers in milliseconds.
Development
npm run verify # format check, typecheck, tests, build
npm test # vitest
npm run inspect # MCP inspectorThe tests run against real Tailwind installations in temporary project fixtures — v3 and v4, with custom themes, TypeScript configs and plugins. Nothing is mocked.
Status
Tailwind Labs does not ship an official Tailwind MCP server. This is an independent implementation built on the official MCP SDK and Tailwind's own public engine API.
License
MIT
Available Tools
9 toolstailwind_canonicalizeCanonicalise a Tailwind class listARead-only
Rewrite a class list into Tailwind's canonical form and order: arbitrary values that match a theme token become that token, deprecated spellings are renamed, and the classes are sorted the way prettier-plugin-tailwindcss would sort them.
Inputs: candidates (required), project.
tailwind_conflictsFind conflicting Tailwind classesARead-only
Report which class wins when several set the same CSS property, and which ones are silently overridden. The winner follows Tailwind's own class order.
Inputs: candidates (required), project.
tailwind_contrastCheck Tailwind colour contrastARead-only
Compute the WCAG contrast ratio of two colours and whether they pass AA or AAA. Colours may be theme tokens such as 'red-500' or 'white', or literal CSS colours.
Inputs: background (required), foreground (required), project.
tailwind_diagnoseDiagnose a Tailwind class listARead-only
Check a class list for every problem at once: classes that do not exist (with spelling suggestions), classes that use an arbitrary value where a theme token would do, classes that override each other, and v3 classes that need migrating to v4. This is the tool to call before writing or editing markup.
Inputs: candidates (required), project.
tailwind_migrateMigrate Tailwind v3 classes to v4ARead-only
Map v3 class names to their v4 equivalents, including the scale renames whose meaning changed silently (shadow-sm, rounded, blur and the rest). Use this when porting v3 code to v4.
Inputs: candidates (required), project.
tailwind_search_classesSearch Tailwind classesARead-only
Search the project's real Tailwind class list. Use when you know the intent but not the exact utility name. Returns utility names and the modifiers they accept.
Inputs: limit, query, offset, prefix, +1 more.
tailwind_themeRead Tailwind themeBRead-only
Read the project's design tokens: colors, spacing, breakpoints, fonts and any custom theme values. Use the project's own token names instead of generic ones.
Inputs: limit, query, offset, project, +1 more.
tailwind_validateValidate Tailwind classesARead-only
Check whether candidate Tailwind classes exist in this project and return the CSS they generate. Accepts variants (md:hover:bg-red-500) and arbitrary values (w-[37px]). Use before writing markup to avoid emitting classes that do not exist.
Inputs: candidates (required), project.
tailwind_variantsList Tailwind variantsARead-only
List the variants this project understands, such as hover:, md:, dark: or data-[state=open]. Use this to check that a variant exists before using it.
Inputs: limit, query, offset, project.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Most tools have clearly distinct purposes (search, theme, variants, migrate, contrast). However tailwind_validate and tailwind_diagnose overlap significantly, since diagnose also detects non-existent classes, and both are pitched as the thing to run before writing markup, creating a real risk of misselection.
Every tool follows the same tailwind_<verb/noun> snake_case pattern and reads consistently. No mixing of conventions.
Nine tools is well-scoped for a Tailwind helper surface; each covers a distinct facet (validate, search, theme, variants, diagnose, conflicts, canonicalize, migrate, contrast) with no obvious filler.
The surface covers the main lifecycle: discovery (search/theme/variants), validation, diagnostics, conflict resolution, canonicalization, migration, and accessibility. Only minor gaps remain, such as full stylesheet generation or config-editing operations.
Related MCP Connectors
Tailwind CSS palettes (50-950) from any color, the closest Tailwind color, and Tailwind's defaults
Run accessibility, contrast, and design token audits and file QA issues from your AI coding tool.
Canonicalize Tailwind classes to their short form, and search LunarWerx free dev tools.
Serves your design system and coding standards to coding agents, so they stop guessing.
Related MCP Servers
- AlicenseBqualityDmaintenanceExposes TypeScript Language Server Protocol functionality to AI agents, enabling them to query types at specific positions, find definitions and references, get diagnostics, run type tests, and type-check inline code just like in an IDE.9297 npm3MIT
- AlicenseBqualityDmaintenanceProvides comprehensive tools for TailwindCSS development including utility class retrieval, CSS-to-Tailwind conversion, and color palette generation. It enables AI assistants to search documentation, generate component templates, and provide framework-specific installation guides.83,057 npm40MIT
- AlicenseAqualityDmaintenanceLoads your project's Tailwind CSS config and exposes tools for AI agents to query actual design tokens and validate class names, preventing hallucination of non-existent utilities.754 npmMIT
- FlicenseNot gradedqualityBmaintenanceEnables AI coding agents to inspect a project's design tokens and component catalog, audit React/Tailwind files against seven static UI quality rules, score overall UI health, and apply auto-fixes that are re-audited and reverted on regression. It works both locally over filesystem access and remotely on raw TSX/JSX or CSS snippets passed directly as strings.-