Tailwind Context Resolver Mcp

io.github.vola-trebla由 GitHub 帳號 vola-trebla 發布v0.2.0更新於 Oct 24, 2026

Resolves Tailwind CSS design tokens and validates utility classes against the local project config.

發布方自己的服務:Tailwind App

已驗證STDIO僅桌面開發者工具AI 與機器學習

概覽

AI 產生的概覽

讓助理讀取專案已解析的 Tailwind CSS v3 主題,並據此驗證工具類別字串。

可以做什麼
載入專案的 tailwind.config.js 或 .ts,並透過四個工具公開解析後的設計系統。resolve_theme_tokens 回傳某個命名空間(例如 colors.brand、spacing)下的權杖;validate_class_string 將 className 字串拆成有效與無效類別並提出衝突警告;detect_css_conflicts 回報互相衝突的工具類別,例如 flex 與 grid;get_config_summary 回報 Tailwind 版本、前綴、被客製化的主題區段與外掛。驗證以權杖為基礎,而非完整的 PostCSS/JIT 流程。
適用情境
當助理在具有自訂調色盤、間距刻度、前綴或品牌權杖的專案中撰寫 Tailwind 類別時適用,可讓它對照真實設定而非預設主題檢查類別名稱。最適合在既有的 Tailwind v3 程式碼庫中進行元件或介面相關工作。
執行需求
以 stdio 在本機執行,通常用 npx 啟動。需要 Node.js 18+,以及專案中的 tailwind.config.js 或 tailwind.config.ts。僅支援 Tailwind CSS v3,v4 的 CSS 設定格式不受支援。未宣告需要帳號、API 金鑰或環境變數。
安裝前請注意
會讀取專案的 Tailwind 設定,因此應指向預期的專案目錄。它只讀取與驗證,不會修改檔案,也不會將資料傳送給第三方。不要求任何憑證。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Tailwind Context Resolver Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

tailwind-context-resolver-mcp 🎨🐸

[npm version] [npm downloads] [CI] [License: MIT]

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:

jsx
// 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-" prefix

The 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.


✅ 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-18 a valid spacing value here?"
  • "Does this project use a custom prefix?"
  • "Is bg-brand-primary flex grid a 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.

json
{  "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.

json
{  "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.

json
{  "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:

json
{  "mcpServers": {    "tailwind-context-resolver": {      "command": "npx",      "args": ["-y", "tailwind-context-resolver-mcp"]    }  }}

Cursor / VS Code / Any MCP client

json
{  "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.js or tailwind.config.ts in your project

🔧 How It Works

The server uses the same config loading strategy as the Tailwind CLI:

  1. jiti loads your tailwind.config.ts at runtime — no ts-node required
  2. tailwindcss/resolveConfig merges your config with Tailwind defaults to produce the full resolved theme
  3. Tools perform token-based class validation — checking that bg-brand-primary maps to an actual colors.brand.primary token — 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 system2. resolve_theme_tokens     → query specific namespaces before writing classes   (namespace: "colors.brand", "spacing")3. validate_class_string    → validate the className string before committing it4. detect_css_conflicts     → final sanity check for conflicting utilities

🐸 Part of the MCP Toolbelt

Built alongside:


License

MIT

來源:README.md,提交 2e58837

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.2.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

其他 Tailwind 整合