@clarity-contrib/tailwindcss-mcp-server 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 fluxui-dev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,470 @@
1
+ # TailwindCSS MCP Server
2
+
3
+ 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.
4
+
5
+ ## 🚀 Features
6
+
7
+ ### Information Tools (4 tools)
8
+ - **`get_tailwind_utilities`** - Retrieve TailwindCSS utility classes by category, property, or search
9
+ - **`get_tailwind_colors`** - Access the complete TailwindCSS color palette with all shades
10
+ - **`get_tailwind_config_guide`** - Get configuration guides for different frameworks
11
+ - **`search_tailwind_docs`** - Search TailwindCSS documentation with intelligent filtering
12
+
13
+ ### Action Tools (4 tools)
14
+ - **`install_tailwind`** - Generate installation commands and configurations for any framework
15
+ - **`convert_css_to_tailwind`** - Convert traditional CSS to TailwindCSS utility classes
16
+ - **`generate_color_palette`** - Create custom color palettes with multiple shades from base colors
17
+ - **`generate_component_template`** - Generate HTML component templates with TailwindCSS classes
18
+
19
+ ### Supported Frameworks
20
+ - **React** (Create React App, Next.js)
21
+ - **Vue** (Vue 3, Nuxt.js)
22
+ - **Angular**
23
+ - **Svelte/SvelteKit**
24
+ - **Laravel**
25
+ - **Vite**
26
+ - **Vanilla JavaScript/HTML**
27
+
28
+ ## 📦 Installation
29
+
30
+ ### Using bun (Recommended)
31
+ ```bash
32
+ bun add -g @clarity-contrib/tailwindcss-mcp-server
33
+ ```
34
+
35
+ ### Using npm
36
+ ```bash
37
+ npm install -g @clarity-contrib/tailwindcss-mcp-server
38
+ ```
39
+
40
+ ### Using the package directly
41
+ ```bash
42
+ # With bun
43
+ bunx @clarity-contrib/tailwindcss-mcp-server
44
+
45
+ # With npx
46
+ npx @clarity-contrib/tailwindcss-mcp-server
47
+ ```
48
+
49
+ ### Local Development
50
+ ```bash
51
+ git clone https://github.com/clarity-contrib/tailwindcss-mcp-server.git
52
+ cd tailwindcss-mcp-server
53
+ bun install
54
+ bun run build
55
+ ```
56
+
57
+ ## ⚙️ Configuration
58
+
59
+ ### Claude Desktop
60
+
61
+ Add to your Claude Desktop configuration file:
62
+
63
+ **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
64
+ **Windows**: `%APPDATA%/Claude/claude_desktop_config.json`
65
+
66
+ #### Option 1: Using global installation
67
+ ```json
68
+ {
69
+ "mcpServers": {
70
+ "tailwindcss-server": {
71
+ "command": "tailwindcss-server"
72
+ }
73
+ }
74
+ }
75
+ ```
76
+
77
+ #### Option 2: Using bunx
78
+ ```json
79
+ {
80
+ "mcpServers": {
81
+ "tailwindcss-server": {
82
+ "command": "bunx",
83
+ "args": ["@clarity-contrib/tailwindcss-mcp-server"]
84
+ }
85
+ }
86
+ }
87
+ ```
88
+
89
+ #### Option 3: Using npx
90
+ ```json
91
+ {
92
+ "mcpServers": {
93
+ "tailwindcss-server": {
94
+ "command": "npx",
95
+ "args": ["-y", "@clarity-contrib/tailwindcss-mcp-server"]
96
+ }
97
+ }
98
+ }
99
+ ```
100
+
101
+ #### Option 4: Using local build
102
+ ```json
103
+ {
104
+ "mcpServers": {
105
+ "tailwindcss-server": {
106
+ "command": "/path/to/tailwindcss-mcp/build/index.js"
107
+ }
108
+ }
109
+ }
110
+ ```
111
+ ### Claude Code
112
+
113
+ ```bash
114
+ # Using bunx
115
+ claude mcp add tailwindcss-mcp-server -- bunx @clarity-contrib/tailwindcss-mcp-server
116
+
117
+ # Using npx
118
+ claude mcp add tailwindcss-mcp-server -- npx -y @clarity-contrib/tailwindcss-mcp-server
119
+ ```
120
+
121
+ ### Windsurf IDE
122
+
123
+ Add to your `./windsurf/mcp_servers.json`:
124
+ ```json
125
+ {
126
+ "mcpServers": {
127
+ "tailwindcss-server": {
128
+ "command": "bunx",
129
+ "args": ["@clarity-contrib/tailwindcss-mcp-server"]
130
+ }
131
+ }
132
+ }
133
+ ```
134
+
135
+ Or with npx:
136
+ ```json
137
+ {
138
+ "mcpServers": {
139
+ "tailwindcss-server": {
140
+ "command": "npx",
141
+ "args": ["-y", "@clarity-contrib/tailwindcss-mcp-server"]
142
+ }
143
+ }
144
+ }
145
+ ```
146
+
147
+ ### Cursor IDE
148
+
149
+ Add to your `.cursor/mcp.json`:
150
+ ```json
151
+ {
152
+ "mcpServers": {
153
+ "tailwindcss-server": {
154
+ "command": "bunx",
155
+ "args": ["@clarity-contrib/tailwindcss-mcp-server"]
156
+ }
157
+ }
158
+ }
159
+ ```
160
+
161
+ Or with npx:
162
+ ```json
163
+ {
164
+ "mcpServers": {
165
+ "tailwindcss-server": {
166
+ "command": "npx",
167
+ "args": ["-y", "@clarity-contrib/tailwindcss-mcp-server"]
168
+ }
169
+ }
170
+ }
171
+ ```
172
+
173
+ ## 🛠️ Tool Reference
174
+
175
+ ### Information Tools
176
+
177
+ #### `get_tailwind_utilities`
178
+ Retrieve TailwindCSS utility classes with flexible filtering options.
179
+
180
+ **Parameters:**
181
+ - `category` (optional): Filter by category (e.g., 'layout', 'typography', 'colors')
182
+ - `property` (optional): Filter by CSS property (e.g., 'margin', 'color', 'font-size')
183
+ - `search` (optional): Search term to find specific utilities
184
+
185
+ **Example Usage:**
186
+ ```typescript
187
+ // Get all layout utilities
188
+ get_tailwind_utilities({ category: "layout" })
189
+
190
+ // Get margin-related utilities
191
+ get_tailwind_utilities({ property: "margin" })
192
+
193
+ // Search for flex utilities
194
+ get_tailwind_utilities({ search: "flex" })
195
+ ```
196
+
197
+ #### `get_tailwind_colors`
198
+ Access TailwindCSS color palette with complete shade information.
199
+
200
+ **Parameters:**
201
+ - `colorName` (optional): Specific color name (e.g., 'blue', 'red')
202
+ - `includeShades` (optional): Include all color shades (default: true)
203
+
204
+ **Example Usage:**
205
+ ```typescript
206
+ // Get all colors with shades
207
+ get_tailwind_colors({ includeShades: true })
208
+
209
+ // Get specific color information
210
+ get_tailwind_colors({ colorName: "blue" })
211
+ ```
212
+
213
+ #### `get_tailwind_config_guide`
214
+ Get configuration guides and best practices for different frameworks.
215
+
216
+ **Parameters:**
217
+ - `topic` (optional): Configuration topic (e.g., 'installation', 'customization')
218
+ - `framework` (optional): Target framework (e.g., 'react', 'vue', 'nextjs')
219
+
220
+ **Example Usage:**
221
+ ```typescript
222
+ // Get React-specific configuration
223
+ get_tailwind_config_guide({ framework: "react" })
224
+
225
+ // Get customization guides
226
+ get_tailwind_config_guide({ topic: "customization" })
227
+ ```
228
+
229
+ #### `search_tailwind_docs`
230
+ Search TailwindCSS documentation with intelligent filtering.
231
+
232
+ **Parameters:**
233
+ - `query` (required): Search query for TailwindCSS documentation
234
+ - `category` (optional): Filter by documentation category
235
+ - `limit` (optional): Limit number of results (default: 10)
236
+
237
+ **Example Usage:**
238
+ ```typescript
239
+ // Search for responsive design information
240
+ search_tailwind_docs({
241
+ query: "responsive design",
242
+ limit: 5
243
+ })
244
+
245
+ // Search in specific category
246
+ search_tailwind_docs({
247
+ query: "dark mode",
248
+ category: "customization"
249
+ })
250
+ ```
251
+
252
+ ### Action Tools
253
+
254
+ #### `install_tailwind`
255
+ Generate complete installation commands and configuration files for any framework.
256
+
257
+ **Parameters:**
258
+ - `framework` (required): Target framework ('react', 'nextjs', 'vue', 'vite', 'laravel', 'angular', 'svelte')
259
+ - `packageManager` (optional): Package manager ('npm', 'yarn', 'pnpm', 'bun') - default: 'npm'
260
+ - `includeTypescript` (optional): Include TypeScript configuration (default: false)
261
+
262
+ **Example Usage:**
263
+ ```typescript
264
+ // Install for Next.js with npm
265
+ install_tailwind({
266
+ framework: "nextjs",
267
+ packageManager: "npm"
268
+ })
269
+
270
+ // Install for React with TypeScript and yarn
271
+ install_tailwind({
272
+ framework: "react",
273
+ packageManager: "yarn",
274
+ includeTypescript: true
275
+ })
276
+ ```
277
+
278
+ #### `convert_css_to_tailwind`
279
+ Convert traditional CSS to TailwindCSS utility classes with intelligent suggestions.
280
+
281
+ **Parameters:**
282
+ - `css` (required): CSS code to convert to TailwindCSS utilities
283
+ - `mode` (optional): Output format ('classes', 'inline', 'component') - default: 'classes'
284
+
285
+ **Example Usage:**
286
+ ```typescript
287
+ // Convert CSS to utility classes
288
+ convert_css_to_tailwind({
289
+ css: ".button { padding: 1rem; background-color: #3B82F6; color: white; }"
290
+ })
291
+
292
+ // Convert with inline format
293
+ convert_css_to_tailwind({
294
+ css: ".card { margin: 16px; border-radius: 8px; }",
295
+ mode: "inline"
296
+ })
297
+
298
+ // Convert for @apply directive
299
+ convert_css_to_tailwind({
300
+ css: ".component { display: flex; justify-content: center; }",
301
+ mode: "component"
302
+ })
303
+ ```
304
+
305
+ #### `generate_color_palette`
306
+ Create custom color palettes with multiple shades from a base color.
307
+
308
+ **Parameters:**
309
+ - `baseColor` (required): Base color in hex, rgb, or hsl format
310
+ - `name` (required): Name for the color palette
311
+ - `shades` (optional): Array of shade values (default: [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950])
312
+
313
+ **Example Usage:**
314
+ ```typescript
315
+ // Generate brand color palette
316
+ generate_color_palette({
317
+ baseColor: "#6366F1",
318
+ name: "brand"
319
+ })
320
+
321
+ // Generate custom shades
322
+ generate_color_palette({
323
+ baseColor: "rgb(59, 130, 246)",
324
+ name: "primary",
325
+ shades: [100, 300, 500, 700, 900]
326
+ })
327
+
328
+ // Generate from HSL
329
+ generate_color_palette({
330
+ baseColor: "hsl(217, 91%, 60%)",
331
+ name: "accent"
332
+ })
333
+ ```
334
+
335
+ #### `generate_component_template`
336
+ Generate HTML component templates with TailwindCSS classes and customization suggestions.
337
+
338
+ **Parameters:**
339
+ - `componentType` (required): Component type ('button', 'card', 'form', 'navbar', 'modal', 'alert', 'badge', 'breadcrumb')
340
+ - `style` (optional): Visual style ('minimal', 'modern', 'playful') - default: 'modern'
341
+ - `darkMode` (optional): Include dark mode support (default: false)
342
+ - `responsive` (optional): Include responsive design classes (default: true)
343
+
344
+ **Example Usage:**
345
+ ```typescript
346
+ // Generate a modern button
347
+ generate_component_template({
348
+ componentType: "button",
349
+ style: "modern",
350
+ responsive: true
351
+ })
352
+
353
+ // Generate a modal with dark mode
354
+ generate_component_template({
355
+ componentType: "modal",
356
+ style: "minimal",
357
+ darkMode: true
358
+ })
359
+
360
+ // Generate a playful card component
361
+ generate_component_template({
362
+ componentType: "card",
363
+ style: "playful",
364
+ responsive: true
365
+ })
366
+ ```
367
+
368
+ ## 🎯 Use Cases
369
+
370
+ ### 1. Learning TailwindCSS
371
+ - Explore utility classes by category or property
372
+ - Understand the color system and naming conventions
373
+ - Get configuration examples for your framework
374
+ - Search documentation for specific concepts
375
+
376
+ ### 2. Converting Existing CSS
377
+ - Convert legacy CSS to modern TailwindCSS utilities
378
+ - Get suggestions for unsupported properties
379
+ - Learn TailwindCSS equivalents for common CSS patterns
380
+ - Optimize existing stylesheets
381
+
382
+ ### 3. Design System Creation
383
+ - Generate custom color palettes that match your brand
384
+ - Create consistent component templates
385
+ - Export color variables for CSS or JavaScript
386
+ - Maintain design consistency across projects
387
+
388
+ ### 4. Framework Integration
389
+ - Get framework-specific installation guides
390
+ - Set up TailwindCSS with TypeScript support
391
+ - Configure build tools and development workflows
392
+ - Learn best practices for your tech stack
393
+
394
+ ## 🔧 Development
395
+
396
+ ### Prerequisites
397
+ - [Bun](https://bun.sh) 1.0+
398
+
399
+ ### Setup
400
+ ```bash
401
+ # Clone the repository
402
+ git clone https://github.com/clarity-contrib/tailwindcss-mcp-server.git
403
+ cd tailwindcss-mcp-server
404
+
405
+ # Install dependencies
406
+ bun install
407
+
408
+ # Build the project
409
+ bun run build
410
+
411
+ # Run tests
412
+ bun test
413
+
414
+ # Start development with watch mode
415
+ bun run watch
416
+ ```
417
+
418
+ ### Testing
419
+ ```bash
420
+ # Run all tests
421
+ bun test
422
+
423
+ # Run tests with coverage
424
+ bun run test:coverage
425
+
426
+ # Run tests in watch mode
427
+ bun run test:watch
428
+
429
+ # Run tests with UI
430
+ bun run test:ui
431
+ ```
432
+
433
+ ### Debugging
434
+
435
+ Use the MCP Inspector for debugging and development:
436
+ ```bash
437
+ bun run inspector
438
+ ```
439
+
440
+ This will start the inspector and provide a URL for browser-based debugging.
441
+
442
+ ## 📊 Server Capabilities
443
+
444
+ - **Real-time Documentation**: Access up-to-date TailwindCSS documentation
445
+ - **Intelligent Conversion**: Convert CSS to TailwindCSS with accuracy and suggestions
446
+ - **Framework Integration**: Support for all major frontend frameworks
447
+ - **Color Management**: Advanced color palette generation with shade variants
448
+ - **Template Generation**: Ready-to-use component templates with customization options
449
+ - **Performance Optimized**: Efficient caching and service architecture
450
+ - **Error Handling**: Comprehensive error handling with helpful messages
451
+ - **Type Safety**: Full TypeScript implementation with proper typing
452
+
453
+ ## 🤝 Contributing
454
+
455
+ 1. Fork the repository
456
+ 2. Create a feature branch
457
+ 3. Make your changes with tests
458
+ 4. Ensure all tests pass
459
+ 5. Submit a pull request
460
+
461
+ ## 📄 License
462
+
463
+ MIT License - see LICENSE file for details.
464
+
465
+ ## 🔗 Links
466
+
467
+ - [TailwindCSS Official Documentation](https://tailwindcss.com)
468
+ - [Model Context Protocol](https://modelcontextprotocol.io)
469
+ - [Claude Desktop](https://claude.ai)
470
+ - [MCP Inspector](https://github.com/modelcontextprotocol/inspector)