Skip to main content
Glama
CarbonoDev

TailwindCSS MCP Server

by CarbonoDev

generate_component_template

Create HTML component templates with TailwindCSS classes for buttons, cards, forms, and other UI elements. Choose from minimal, modern, or playful styles with optional dark mode and responsive design support.

Instructions

Generate HTML component templates with TailwindCSS classes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentTypeYesType of component to generate (e.g., 'button', 'card', 'form', 'navbar', 'modal', 'alert', 'badge', 'breadcrumb')
styleNoVisual style of the component (default: modern)
darkModeNoInclude dark mode support (default: false)
responsiveNoInclude responsive design classes (default: true)

Implementation Reference

  • The primary implementation of the generateComponentTemplate method that orchestrates the generation process.
    async generateComponentTemplate(params: GenerateTemplateParams): Promise<ComponentTemplate> {
      try {
        const { componentType, style = 'modern', darkMode = false, responsive = true } = params;
        
        const generator = this.componentTemplates.get(componentType.toLowerCase());
        if (!generator) {
          throw new ServiceError(
            `Unsupported component type: ${componentType}`,
            'TemplateService',
            'generateComponentTemplate'
          );
        }
    
        return generator(style, darkMode, responsive);
  • The handler function in index.ts that receives the tool request and calls the service.
    private async handleGenerateComponentTemplate(args: any): Promise<any> {
      try {
        const params = this.validateGenerateTemplateParams(args);
        const template = await this.templateService.generateComponentTemplate(params);
        return this.createSuccessResponse(template);
      } catch (error) {
        this.handleServiceError(error, "Failed to generate component template");
      }
    }
  • src/index.ts:241-265 (registration)
    Registration of the generate_component_template tool within the MCP tool list.
    name: "generate_component_template",
    description: "Generate HTML component templates with TailwindCSS classes",
    inputSchema: {
      type: "object",
      properties: {
        componentType: {
          type: "string",
          description: "Type of component to generate (e.g., 'button', 'card', 'form', 'navbar', 'modal', 'alert', 'badge', 'breadcrumb')",
        },
        style: {
          type: "string",
          enum: ["minimal", "modern", "playful"],
          description: "Visual style of the component (default: modern)",
        },
        darkMode: {
          type: "boolean",
          description: "Include dark mode support (default: false)",
        },
        responsive: {
          type: "boolean",
          description: "Include responsive design classes (default: true)",
        },
      },
      required: ["componentType"],
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/CarbonoDev/tailwindcss-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server