tailwind-context-resolver-mcp
v0.2.0Resolves Tailwind CSS design tokens and validates utility classes against the local project config.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
resolve_theme_tokens
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'.
| Parameter | Type | Description |
|---|---|---|
config_path * | string | Absolute path to tailwind.config.js or tailwind.config.ts |
namespace * | string | Dot-path into the theme (e.g. 'colors', 'colors.brand', 'spacing') |
filter | string | Optional substring filter on token names |
validate_class_string
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.
| Parameter | Type | Description |
|---|---|---|
class_string * | string | Space-separated Tailwind class string to validate |
config_path * | string | Absolute path to tailwind.config.js or tailwind.config.ts |
detect_css_conflicts
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.
| Parameter | Type | Description |
|---|---|---|
class_string * | string | Space-separated Tailwind class string to check for conflicts |
config_path * | string | Absolute path to tailwind.config.js or tailwind.config.ts |
get_config_summary
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.
| Parameter | Type | Description |
|---|---|---|
config_path * | string | Absolute path to tailwind.config.js or tailwind.config.ts |
resolve_v4_theme_variables
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(...)).
| Parameter | Type | Description |
|---|---|---|
css_path * | string | Absolute path to the CSS file containing the @theme or @import "tailwindcss" directives |
audit_theme_usage
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.
| Parameter | Type | Description |
|---|---|---|
css_path * | string | Absolute path to the CSS file containing the @theme blocks |
project_root * | string | Absolute path to the project root directory |
scan_dirs | array | Optional array of subdirectories to scan (defaults to ["src"]) |
simulate_jit_compilation
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.
| Parameter | Type | Description |
|---|---|---|
class_string * | string | Space-separated Tailwind class string to compile |
config_path | string | Optional path to tailwind.config.js/ts (for Tailwind v3 custom configs) |
css_path | string | Optional path to the project's CSS entry file (for Tailwind v4 custom theme styles) |