tailwind-context-resolver-mcp

v0.2.0
io.github.vola-trebla/tailwind-context-resolver-mcp Checked 3 days ago Published 6 months ago

Resolves 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'.

ParameterTypeDescription
config_path *stringAbsolute path to tailwind.config.js or tailwind.config.ts
namespace *stringDot-path into the theme (e.g. 'colors', 'colors.brand', 'spacing')
filterstringOptional 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.

ParameterTypeDescription
class_string *stringSpace-separated Tailwind class string to validate
config_path *stringAbsolute 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.

ParameterTypeDescription
class_string *stringSpace-separated Tailwind class string to check for conflicts
config_path *stringAbsolute 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.

ParameterTypeDescription
config_path *stringAbsolute 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(...)).

ParameterTypeDescription
css_path *stringAbsolute 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.

ParameterTypeDescription
css_path *stringAbsolute path to the CSS file containing the @theme blocks
project_root *stringAbsolute path to the project root directory
scan_dirsarrayOptional 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.

ParameterTypeDescription
class_string *stringSpace-separated Tailwind class string to compile
config_pathstringOptional path to tailwind.config.js/ts (for Tailwind v3 custom configs)
css_pathstringOptional path to the project's CSS entry file (for Tailwind v4 custom theme styles)