TailwindCSS MCP Server
Provides 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.
README
TailwindCSS MCP Server
A comprehensive Model Context Protocol (MCP) server that provides TailwindCSS utilities, documentation, conversion tools, and template generation capabilities. This server enables AI assistants to help with TailwindCSS development through intelligent tooling and real-time assistance.
🚀 Features
Information Tools (4 tools)
get_tailwind_utilities- Retrieve TailwindCSS utility classes by category, property, or searchget_tailwind_colors- Access the complete TailwindCSS color palette with all shadesget_tailwind_config_guide- Get configuration guides for different frameworkssearch_tailwind_docs- Search TailwindCSS documentation with intelligent filtering
Action Tools (4 tools)
install_tailwind- Generate installation commands and configurations for any frameworkconvert_css_to_tailwind- Convert traditional CSS to TailwindCSS utility classesgenerate_color_palette- Create custom color palettes with multiple shades from base colorsgenerate_component_template- Generate HTML component templates with TailwindCSS classes
Supported Frameworks
- React (Create React App, Next.js)
- Vue (Vue 3, Nuxt.js)
- Angular
- Svelte/SvelteKit
- Laravel
- Vite
- Vanilla JavaScript/HTML
📦 Installation
Using npm (Recommended)
npm install -g tailwindcss-mcp-server
Using the package directly
npx tailwindcss-mcp-server
Local Development
git clone https://github.com/CarbonoDev/tailwindcss-mcp-server.git
cd tailwindcss-mcp-server
npm install
npm run build
⚙️ Configuration
Claude Desktop
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
Option 1: Using global installation
{
"mcpServers": {
"tailwindcss-server": {
"command": "tailwindcss-server"
}
}
}
Option 2: Using npx
{
"mcpServers": {
"tailwindcss-server": {
"command": "npx",
"args": ["-y", "tailwindcss-mcp-server"]
}
}
}
Option 3: Using local build
{
"mcpServers": {
"tailwindcss-server": {
"command": "/path/to/tailwindcss-mcp/build/index.js"
}
}
}
Claude Code
Add MCP Server using npx
claude mcp add tailwindcss-mcp-server -- npx tailwindcss-mcp-server
Windsurf IDE
Add to your ./windsurf/mcp_servers.json:
{
"mcpServers": {
"tailwindcss-server": {
"command": "npx",
"args": ["-y", "tailwindcss-mcp-server"]
}
}
}
Cursor IDE
Add to your .cursor/mcp.json:
{
"mcpServers": {
"tailwindcss-server": {
"command": "npx",
"args": ["-y", "tailwindcss-mcp-server"]
}
}
}
🛠️ Tool Reference
Information Tools
get_tailwind_utilities
Retrieve TailwindCSS utility classes with flexible filtering options.
Parameters:
category(optional): Filter by category (e.g., 'layout', 'typography', 'colors')property(optional): Filter by CSS property (e.g., 'margin', 'color', 'font-size')search(optional): Search term to find specific utilities
Example Usage:
// Get all layout utilities
get_tailwind_utilities({ category: "layout" })
// Get margin-related utilities
get_tailwind_utilities({ property: "margin" })
// Search for flex utilities
get_tailwind_utilities({ search: "flex" })
get_tailwind_colors
Access TailwindCSS color palette with complete shade information.
Parameters:
colorName(optional): Specific color name (e.g., 'blue', 'red')includeShades(optional): Include all color shades (default: true)
Example Usage:
// Get all colors with shades
get_tailwind_colors({ includeShades: true })
// Get specific color information
get_tailwind_colors({ colorName: "blue" })
get_tailwind_config_guide
Get configuration guides and best practices for different frameworks.
Parameters:
topic(optional): Configuration topic (e.g., 'installation', 'customization')framework(optional): Target framework (e.g., 'react', 'vue', 'nextjs')
Example Usage:
// Get React-specific configuration
get_tailwind_config_guide({ framework: "react" })
// Get customization guides
get_tailwind_config_guide({ topic: "customization" })
search_tailwind_docs
Search TailwindCSS documentation with intelligent filtering.
Parameters:
query(required): Search query for TailwindCSS documentationcategory(optional): Filter by documentation categorylimit(optional): Limit number of results (default: 10)
Example Usage:
// Search for responsive design information
search_tailwind_docs({
query: "responsive design",
limit: 5
})
// Search in specific category
search_tailwind_docs({
query: "dark mode",
category: "customization"
})
Action Tools
install_tailwind
Generate complete installation commands and configuration files for any framework.
Parameters:
framework(required): Target framework ('react', 'nextjs', 'vue', 'vite', 'laravel', 'angular', 'svelte')packageManager(optional): Package manager ('npm', 'yarn', 'pnpm', 'bun') - default: 'npm'includeTypescript(optional): Include TypeScript configuration (default: false)
Example Usage:
// Install for Next.js with npm
install_tailwind({
framework: "nextjs",
packageManager: "npm"
})
// Install for React with TypeScript and yarn
install_tailwind({
framework: "react",
packageManager: "yarn",
includeTypescript: true
})
convert_css_to_tailwind
Convert traditional CSS to TailwindCSS utility classes with intelligent suggestions.
Parameters:
css(required): CSS code to convert to TailwindCSS utilitiesmode(optional): Output format ('classes', 'inline', 'component') - default: 'classes'
Example Usage:
// Convert CSS to utility classes
convert_css_to_tailwind({
css: ".button { padding: 1rem; background-color: #3B82F6; color: white; }"
})
// Convert with inline format
convert_css_to_tailwind({
css: ".card { margin: 16px; border-radius: 8px; }",
mode: "inline"
})
// Convert for @apply directive
convert_css_to_tailwind({
css: ".component { display: flex; justify-content: center; }",
mode: "component"
})
generate_color_palette
Create custom color palettes with multiple shades from a base color.
Parameters:
baseColor(required): Base color in hex, rgb, or hsl formatname(required): Name for the color paletteshades(optional): Array of shade values (default: [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950])
Example Usage:
// Generate brand color palette
generate_color_palette({
baseColor: "#6366F1",
name: "brand"
})
// Generate custom shades
generate_color_palette({
baseColor: "rgb(59, 130, 246)",
name: "primary",
shades: [100, 300, 500, 700, 900]
})
// Generate from HSL
generate_color_palette({
baseColor: "hsl(217, 91%, 60%)",
name: "accent"
})
generate_component_template
Generate HTML component templates with TailwindCSS classes and customization suggestions.
Parameters:
componentType(required): Component type ('button', 'card', 'form', 'navbar', 'modal', 'alert', 'badge', 'breadcrumb')style(optional): Visual style ('minimal', 'modern', 'playful') - default: 'modern'darkMode(optional): Include dark mode support (default: false)responsive(optional): Include responsive design classes (default: true)
Example Usage:
// Generate a modern button
generate_component_template({
componentType: "button",
style: "modern",
responsive: true
})
// Generate a modal with dark mode
generate_component_template({
componentType: "modal",
style: "minimal",
darkMode: true
})
// Generate a playful card component
generate_component_template({
componentType: "card",
style: "playful",
responsive: true
})
🎯 Use Cases
1. Learning TailwindCSS
- Explore utility classes by category or property
- Understand the color system and naming conventions
- Get configuration examples for your framework
- Search documentation for specific concepts
2. Converting Existing CSS
- Convert legacy CSS to modern TailwindCSS utilities
- Get suggestions for unsupported properties
- Learn TailwindCSS equivalents for common CSS patterns
- Optimize existing stylesheets
3. Design System Creation
- Generate custom color palettes that match your brand
- Create consistent component templates
- Export color variables for CSS or JavaScript
- Maintain design consistency across projects
4. Framework Integration
- Get framework-specific installation guides
- Set up TailwindCSS with TypeScript support
- Configure build tools and development workflows
- Learn best practices for your tech stack
🔧 Development
Prerequisites
- Node.js 18+
- npm, yarn, or pnpm
Setup
# Clone the repository
git clone https://github.com/CarbonoDev/tailwindcss-mcp-server.git
cd tailwindcss-mcp-server
# Install dependencies
npm install
# Build the project
npm run build
# Run tests
npm test
# Start development with watch mode
npm run watch
Testing
# Run all tests
npm test
# Run tests with coverage
npm run test:coverage
# Run tests in watch mode
npm run test:watch
# Run tests with UI
npm run test:ui
Debugging
Use the MCP Inspector for debugging and development:
npm run inspector
This will start the inspector and provide a URL for browser-based debugging.
📊 Server Capabilities
- Real-time Documentation: Access up-to-date TailwindCSS documentation
- Intelligent Conversion: Convert CSS to TailwindCSS with accuracy and suggestions
- Framework Integration: Support for all major frontend frameworks
- Color Management: Advanced color palette generation with shade variants
- Template Generation: Ready-to-use component templates with customization options
- Performance Optimized: Efficient caching and service architecture
- Error Handling: Comprehensive error handling with helpful messages
- Type Safety: Full TypeScript implementation with proper typing
🤝 Contributing
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Ensure all tests pass
- Submit a pull request
📄 License
MIT License - see LICENSE file for details.
🔗 Links
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。