tailwind-context-resolver-mcp
Provides tools for querying resolved Tailwind CSS theme tokens, validating class names against the project's actual config, detecting CSS conflicts, and summarizing the design system.
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-context-resolver-mcp What custom colors are in our Tailwind theme?"
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-context-resolver-mcp π¨πΈ
An MCP server that loads your project's tailwind.config.ts/js and exposes its actual design system to AI agents β so they stop hallucinating class names.
π€ The Problem
AI agents generate Tailwind classes based on training data β the default Tailwind docs. Your project is not the default docs.
You have a custom color palette. A non-standard spacing scale. Maybe a prefix like tw-. Brand tokens like bg-brand-primary. The agent doesn't know any of this. It guesses.
The result:
// Agent confidently generates this:
<div className="bg-primary-500 text-brand p-18 tw-flex-center">
// Your project has:
// - bg-brand-primary (not bg-primary-500)
// - no "text-brand" token
// - spacing.18 = 4.5rem (ok actually)
// - no "flex-center" utility
// - no "tw-" prefixThe agent can't validate what it writes because it has no access to your resolved config. It's working from memory of the default theme β not yours.
Related MCP server: TailwindCSS MCP Server
β The Fix
This MCP server runs the Tailwind resolver locally and gives agents a typed, queryable interface to your actual config. Before writing a component, the agent can ask:
"What brand colors exist in this project?"
"Is
p-18a valid spacing value here?""Does this project use a custom prefix?"
"Is
bg-brand-primary flex grida valid class string?"
π οΈ Tools
resolve_theme_tokens
Query any namespace in the resolved Tailwind theme. Returns all design tokens as flat key-value pairs.
namespace: "colors.brand" β { primary: "#3b82f6", secondary: "#8b5cf6", danger: "#ef4444" }
namespace: "spacing" β { "1": "0.25rem", "2": "0.5rem", "18": "4.5rem", ... }
namespace: "fontFamily" β { sans: ["Inter", "sans-serif"], mono: [...] }Use before generating components to discover what tokens actually exist.
validate_class_string
Validates a Tailwind className string against the project's resolved config. Returns valid classes, invalid (hallucinated) classes, and conflict warnings.
{
"valid_classes": ["bg-brand-primary", "text-white", "p-4", "hover:bg-brand-secondary", "flex"],
"invalid_classes": ["bg-fake-token", "text-brand"],
"warnings": ["Conflicting multiple layout models: flex, grid"],
"config_prefix": ""
}Use to catch hallucinated design tokens before writing code.
detect_css_conflicts
Detects conflicting Tailwind utilities β e.g. flex + grid, or absolute + fixed on the same element.
{
"conflicts": [{ "classes": ["flex", "grid"], "reason": "multiple layout models" }],
"has_conflicts": true
}get_config_summary
Returns a compact overview: Tailwind version, prefix, which theme sections are customized, active plugins.
{
"tailwind_version": "3.4.19",
"prefix": "",
"theme_extensions": ["colors", "spacing", "fontFamily"],
"total_colors": 142,
"total_spacing": 34,
"plugins": ["@tailwindcss/forms"]
}Use first to understand the project's design system before querying specific tokens.
π Setup
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"tailwind-context-resolver": {
"command": "npx",
"args": ["-y", "tailwind-context-resolver-mcp"]
}
}
}Cursor / VS Code / Any MCP client
{
"tailwind-context-resolver": {
"command": "npx",
"args": ["-y", "tailwind-context-resolver-mcp"]
}
}π Requirements
Tailwind CSS v3 β v4 uses a CSS-based config format and is not supported (the server will tell you clearly)
Node.js 18+
A
tailwind.config.jsortailwind.config.tsin your project
π§ How It Works
The server uses the same config loading strategy as the Tailwind CLI:
jitiloads yourtailwind.config.tsat runtime β nots-noderequiredtailwindcss/resolveConfigmerges your config with Tailwind defaults to produce the full resolved themeTools perform token-based class validation β checking that
bg-brand-primarymaps to an actualcolors.brand.primarytoken β without running the full PostCSS/JIT pipeline
This approach is fast, stable, and works with any Tailwind v3 project without additional configuration.
π Agent Workflow Example
1. get_config_summary β understand the project's design system
2. resolve_theme_tokens β query specific namespaces before writing classes
(namespace: "colors.brand", "spacing")
3. validate_class_string β validate the className string before committing it
4. detect_css_conflicts β final sanity check for conflicting utilitiesπΈ Part of the MCP Toolbelt
Built alongside:
playwright-network-chaos-mcp β network fault injection for Playwright tests
v8-cpu-profile-decoder-mcp β V8 CPU profile analysis for AI agents
License
MIT
Available Tools
7 toolsaudit_theme_usageA
Identifies dead design tokens by scanning the project files. Checks each CSS custom property defined in @theme blocks to see if it is referenced anywhere in the source code.
Inputs: css_path (required), project_root (required), scan_dirs.
detect_css_conflictsA
Detects conflicting Tailwind utility classes in a className string β e.g. applying both 'flex' and 'grid', or multiple position utilities. Use to prevent silent CSS bugs before generating or reviewing component code.
Inputs: config_path (required), class_string (required).
get_config_summaryA
Returns a compact overview of the project's Tailwind configuration: version, prefix, which theme sections have been customized, and what plugins are active. Use first to understand the project's design system before querying specific tokens.
Inputs: config_path (required).
resolve_theme_tokensA
Queries the resolved Tailwind CSS theme for a specific namespace and returns all design tokens. Use before generating components to discover what colors, spacing, or font values actually exist in this project. Example namespaces: 'colors', 'colors.brand', 'spacing', 'fontFamily', 'fontSize', 'screens'.
Inputs: namespace (required), config_path (required), filter.
resolve_v4_theme_variablesA
Parses the project's root CSS file (Tailwind CSS v4) and extracts all design tokens defined in @theme blocks. Returns a flat map of CSS custom properties (e.g., --color-primary-500 -> oklch(...)).
Inputs: css_path (required).
simulate_jit_compilationA
Validates Tailwind utility classes against the JIT engine by programmatically compiling them. Supports complex arbitrary values, JIT modifiers, and custom plugin classes. Returns the generated CSS rules.
Inputs: class_string (required), css_path, config_path.
validate_class_stringA
Validates a Tailwind CSS className string against the project's actual config. Returns valid_classes, invalid_classes (hallucinated tokens), possibly_valid_classes (plugin-generated β cannot verify without PostCSS), and conflict warnings. Handles variants (hover:, dark:, lg:), important (!), opacity modifiers (/50), negative values (-mt-4), and arbitrary values ([32rem]). Use to catch hallucinated design tokens before writing code.
Inputs: config_path (required), class_string (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 7 tools
Each tool targets a distinct aspect of Tailwind CSS context: config overview, theme variable extraction, dead-token auditing, class compilation simulation, theme token querying, class string validation, and conflict detection. There is no meaningful overlap; even the two token-related tools are clearly differentiated by their source (CSS @theme vs resolved theme).
All tool names follow a consistent verb_noun pattern using lowercase with underscores (get_, resolve_, audit_, simulate_, validate_, detect_). Though the verbs differ, they accurately reflect the unique action each tool performs, and the pattern is uniform throughout.
Seven tools is well within the ideal range and each tool directly serves the server's purpose of resolving and validating Tailwind CSS context. No redundant tools and no missing essential operations for a read-only context resolver.
The toolset covers the full lifecycle of working with Tailwind design tokens and classes: config summary, theme token extraction and querying, dead-token auditing, class validation, conflict detection, and JIT simulation. There are no obvious gaps; it handles both Tailwind v3/v4 scenarios and provides actionable checks for developers.
Maintenance
Related MCP Connectors
Give your agent a real design system: tokens, measured WCAG contrast, and rules to follow.
Gives AI agents direct access to your Sanity projects and guidance for working with them
Serves your design system and coding standards to coding agents, so they stop guessing.
Tailwind CSS palettes (50-950) from any color, the closest Tailwind color, and Tailwind's defaults
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides AI assistants with access to a production-ready design system including Tailwind CSS component patterns, style guides (colors, typography, spacing), and Web Components specifications for consistent UI development.-
- 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,233 npm41MIT
- AlicenseNot gradedqualityBmaintenanceEnables coding agents to query a workspace's design system before writing UI and validate generated code against the same system afterward, using configurable token and component sources.13 npm1MIT
- 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.-