Tailwind Svelte Assistant

编码与调试

by CaullenOmdahl

提供 SvelteKit 与 Tailwind CSS 文档、utility class 信息及可直接复用的 Svelte 组件片段,加速 UI 开发。

什么是 Tailwind Svelte Assistant

提供 SvelteKit 与 Tailwind CSS 文档、utility class 信息及可直接复用的 Svelte 组件片段,加速 UI 开发。

核心功能 (11 个工具)

get_sveltekit_doc

[LEGACY] Get SvelteKit documentation for a specific topic. NOTE: This tool only covers ~8% of SvelteKit docs. Use 'get_svelte_full_docs' for complete documentation coverage.

get_tailwind_info

[LEGACY] Get Tailwind CSS information for a specific query. NOTE: This tool only covers ~4% of Tailwind docs. Use 'get_tailwind_full_docs' for complete documentation coverage.

get_component_snippet

Get a Svelte component code snippet for a specific UI element.

list_sveltekit_topics

Lists available SvelteKit documentation topics.

list_tailwind_info_topics

Lists available Tailwind CSS documentation topics.

list_snippet_categories

Lists available component snippet categories.

list_snippets_in_category

Lists available snippets within a specified category.

get_svelte_full_docs

Get the complete Svelte and SvelteKit documentation (~1MB, 100% coverage). WARNING: This returns ~320,000 tokens. Only use with LLMs that support large context windows (100k+ tokens). For smaller contexts, use 'search_svelte_docs' or 'get_sveltekit_doc' instead.

get_tailwind_full_docs

Get the complete Tailwind CSS documentation (~2.1MB, 249 files, 100% coverage). WARNING: This returns ~730,000 tokens. Only use with LLMs that support very large context windows (200k+ tokens). For smaller contexts, use 'search_tailwind_docs' or 'get_tailwind_info' instead.

search_svelte_docs

Search within the complete Svelte and SvelteKit documentation for specific topics or keywords.

search_tailwind_docs

Search within the complete Tailwind CSS documentation for specific utility classes or concepts.

README

Tailwind Svelte Assistant MCP Server

smithery badge

A secure, high-performance Model Context Protocol (MCP) server that provides complete SvelteKit and Tailwind CSS documentation (100% coverage) and code snippets with enhanced security, proper TypeScript implementation, and comprehensive error handling.

✨ What's New (v0.1.1)

📚 Complete Documentation Coverage

  • 100% Svelte/SvelteKit Coverage: Official LLM-optimized documentation (1.04 MB)
  • 100% Tailwind CSS Coverage: Complete documentation via Repomix extraction (2.1 MB, 249 files)
  • Intelligent Search: Search within complete documentation with context
  • 12.5x-25x Improvement: From 4-8% coverage to 100% coverage

🚀 Key Improvements (v0.1.1)

🔒 Security Enhancements

  • Path Traversal Protection: Comprehensive input sanitization prevents directory traversal attacks
  • Input Validation: Strict parameter validation with pattern matching and length limits
  • Secure File Operations: Bounded file access with path validation and size limits
  • Audit Logging: Structured security event logging for monitoring

🏗️ Architecture Improvements

  • Modular Design: Separated concerns into dedicated services and utilities
  • TypeScript Excellence: Full type safety with proper interfaces and no any types
  • ES Modules: Modern JavaScript module system with proper imports
  • Error Handling: Comprehensive error classification and safe error messaging

⚡ Performance Optimizations

  • Content Caching: LRU cache with configurable timeout for improved response times
  • File Size Limits: Prevents resource exhaustion with configurable limits
  • Async Operations: Non-blocking file operations for better concurrency
  • Memory Management: Automatic cache cleanup and garbage collection

📁 Project Structure

code
src/
├── index.ts                 # Main server with security hardening
├── types.ts                 # TypeScript type definitions
├── services/
│   └── fileService.ts       # Secure file operations with caching
└── utils/
    ├── security.ts          # Input validation and path sanitization
    └── errorHandler.ts      # Comprehensive error handling

🚀 Quick Start

Install via Smithery (Recommended)

The easiest way to install this MCP server is through Smithery:

bash
npx -y @smithery/cli install @CaullenOmdahl/tailwind-svelte-assistant --client claude

This will automatically:

  • Install the server
  • Configure it for Claude Desktop
  • Set up all required dependencies

Install via Direct URL

For other MCP clients, use the direct server URL:

code
https://server.smithery.ai/@CaullenOmdahl/tailwind-svelte-assistant/mcp

Add this to your MCP client configuration:

json
{
  "mcpServers": {
    "tailwind-svelte-assistant": {
      "url": "https://server.smithery.ai/@CaullenOmdahl/tailwind-svelte-assistant/mcp",
      "transport": "http"
    }
  }
}

🛠️ Manual Installation & Setup

Prerequisites

  • Node.js 20+ (required for ES modules support and dependencies)
  • npm or yarn
  • Git (for cloning repository)

Install Dependencies

bash
npm install

Build the Server

bash
npm run build

Development Mode

bash
npm run watch

🔧 Configuration

The server uses secure defaults but can be configured via the ServerConfig interface:

typescript
const CONFIG: ServerConfig = {
  maxFileSize: 3 * 1024 * 1024,    // 3MB max file size (for full docs)
  cacheTimeout: 5 * 60 * 1000,     // 5 minutes cache timeout
  contentBasePath: './content',
  svelteFullDocsPath: './content/docs/svelte-sveltekit-full.txt',
  tailwindFullDocsPath: './content/docs/tailwind-docs-full.txt',
  // ... other paths
};

Documentation Updates

Documentation is automatically downloaded and updated:

bash
# Update all documentation (Svelte + Tailwind)
npm run update-content

This script:

  • Downloads official Svelte LLM-optimized docs (svelte.dev/llms-full.txt)
  • Extracts complete Tailwind docs from GitHub via Repomix
  • Updates component snippet timestamps
  • Generates content summary

Sources:

  • Svelte/SvelteKit: Official LLM-optimized text file (100% coverage)
  • Tailwind CSS: GitHub repository via Repomix extraction (249 MDX files)
  • Snippets: Local curated component examples (43 files)

🛡️ Security Features

Input Validation

  • Pattern Matching: Only alphanumeric, hyphens, underscores, and dots allowed
  • Length Limits: Configurable maximum input lengths
  • Path Sanitization: Removes directory traversal attempts
  • Bounds Checking: Ensures file access stays within allowed directories

Error Handling

  • Safe Error Messages: No sensitive information exposed to clients
  • Structured Logging: JSON-formatted audit logs for security monitoring
  • Error Classification: Different handling for different error types
  • Graceful Degradation: Fallback responses for non-critical failures

File System Security

  • Path Validation: Verifies resolved paths are within base directories
  • File Size Limits: Prevents resource exhaustion attacks
  • Read-Only Operations: No write operations exposed to clients
  • Cache Isolation: Content caching doesn't expose file system structure

📊 Performance Features

Caching System

typescript
// Automatic content caching with configurable timeout
const fileService = new SecureFileService(
  1024 * 1024,    // Max file size
  5 * 60 * 1000   // Cache timeout (5 minutes)
);

Resource Management

  • Memory Limits: File size restrictions prevent memory exhaustion
  • Cache Cleanup: Automatic removal of expired cache entries
  • Async I/O: Non-blocking file operations
  • Error Recovery: Graceful handling of resource limitations

🔍 Available Tools

🆕 Complete Documentation Tools (Recommended)

  • get_svelte_full_docs - Get complete Svelte & SvelteKit documentation (1MB, 100% coverage)

    • No parameters required
    • Returns entire documentation in single LLM-optimized file
    • Official format from Svelte team
  • get_tailwind_full_docs - Get complete Tailwind CSS documentation (2.1MB, 100% coverage)

    • No parameters required
    • Includes all 249 documentation files
    • All utility classes and concepts covered
  • search_svelte_docs - Search within Svelte/SvelteKit documentation

    • Parameters: query (string), limit (optional, default: 5)
    • Returns matching sections with surrounding context
    • Fast in-memory search
  • search_tailwind_docs - Search within Tailwind CSS documentation

    • Parameters: query (string), limit (optional, default: 5)
    • Returns matching sections with surrounding context
    • Covers all utility classes

Legacy Documentation Tools

Note: These tools only cover ~4-8% of available documentation. Use the full docs tools above for complete coverage.

  • get_sveltekit_doc - Retrieve specific SvelteKit documentation topic
  • get_tailwind_info - Get specific Tailwind CSS information
  • list_sveltekit_topics - List available SvelteKit docs (limited)
  • list_tailwind_info_topics - List Tailwind documentation (limited)

Component Tools

  • get_component_snippet - Fetch Svelte component code
  • list_snippet_categories - List component categories
  • list_snippets_in_category - List snippets in category

Enhanced Tool Schemas

All tools include:

  • Pattern validation with regex constraints
  • Length limits for input parameters
  • Comprehensive descriptions with usage examples
  • Security-hardened input sanitization

📝 Usage Examples

MCP Client Configuration

Option 1: Smithery Hosted (Recommended)

json
{
  "mcpServers": {
    "tailwind-svelte-assistant": {
      "url": "https://server.smithery.ai/@CaullenOmdahl/tailwind-svelte-assistant/mcp",
      "transport": "http"
    }
  }
}

Option 2: Local Installation

json
{
  "mcpServers": {
    "tailwind-svelte-assistant": {
      "command": "node",
      "args": ["./dist/index.js"],
      "env": {}
    }
  }
}

Tool Usage

Recommended: Complete Documentation

javascript
// Get complete Svelte/SvelteKit documentation (1MB, 100% coverage)
await client.callTool("get_svelte_full_docs", {});

// Get complete Tailwind CSS documentation (2.1MB, 100% coverage)
await client.callTool("get_tailwind_full_docs", {});

// Search within Svelte documentation
await client.callTool("search_svelte_docs", {
  query: "load function",
  limit: 5  // optional
});

// Search within Tailwind documentation
await client.callTool("search_tailwind_docs", {
  query: "padding utilities",
  limit: 3  // optional
});

Legacy: Specific Topics (Limited Coverage)

javascript
// Get specific SvelteKit topic (only covers ~8% of docs)
await client.callTool("get_sveltekit_doc", { topic: "routing" });

// Get specific Tailwind info (only covers ~4% of docs)
await client.callTool("get_tailwind_info", { query: "padding" });

// List available topics (limited)
await client.callTool("list_tailwind_info_topics", {});

Component Snippets

javascript
// Get a component snippet
await client.callTool("get_component_snippet", {
  component_category: "headers",
  snippet_name: "navbar-default"
});

// List snippet categories
await client.callTool("list_snippet_categories", {});

🧪 Testing & Quality Assurance

Security Auditing

bash
npm run security-audit

Dependency Checking

bash
npm run outdated-check

MCP Inspector

bash
npm run inspector

🐳 Docker Deployment

The included Dockerfile provides a secure, multi-stage build:

dockerfile
# Multi-stage build with security hardening
FROM node:18-alpine AS builder
# ... build process

FROM node:18-alpine AS release
# ... production setup with non-root user

Security Features

  • Multi-stage build reduces attack surface
  • Alpine Linux for minimal footprint
  • Non-root user for container security
  • Production dependencies only

📈 Monitoring & Logging

Structured Logging

All operations are logged with structured JSON for easy parsing:

json
{
  "timestamp": "2024-01-15T10:30:00.000Z",
  "level": "info",
  "operation": "tool_request",
  "tool": "get_sveltekit_doc",
  "topic": "routing"
}

Audit Events

  • Tool requests with parameters
  • Security violations and blocked requests
  • Error conditions with classification
  • Performance metrics and cache hits

🔄 Migration from v0.1.0

Breaking Changes

  • ES Modules: Updated to use import/export instead of require
  • TypeScript: Strict typing may require type assertions in some cases
  • Error Messages: More secure, less detailed error messages

Compatibility

  • Tool Interface: All existing tools work with improved validation
  • Content Structure: No changes to content organization
  • Docker: Updated base image and security hardening

🤝 Contributing

Development Guidelines

  1. Security First: All changes must pass security review
  2. Type Safety: Maintain strict TypeScript compliance
  3. Test Coverage: Include tests for new functionality
  4. Documentation: Update README for any API changes

Code Review Checklist

  • Input validation for all user inputs
  • Error handling with safe error messages
  • TypeScript types without any
  • Security audit for path operations
  • Performance impact assessment

📚 Documentation

🐛 Troubleshooting

Common Issues

Build Errors

bash
# Clear dist and rebuild
rm -rf dist && npm run build

Permission Errors

bash
# Ensure executable permissions
chmod +x dist/index.js

Import Errors

  • Ensure Node.js 18+ for ES module support
  • Check "type": "module" in package.json

Security Concerns

If you discover a security vulnerability, please report it via GitHub issues with the security label.

📄 License

This project maintains the same license as the original Tailwind-Svelte-Assistant project.


⚡ Performance Benchmarks

Before vs After (v0.1.1)

  • Documentation Coverage: 🔴 4-8% → 🟢 100% (12.5x-25x improvement)
  • Security: 🔴 Critical vulnerabilities → 🟢 Hardened
  • Type Safety: 🟡 Mixed types → 🟢 Strict TypeScript
  • Performance: 🟡 No caching → 🟢 5-minute LRU cache
  • Architecture: 🔴 Monolithic → 🟢 Modular services
  • Error Handling: 🟡 Basic → 🟢 Comprehensive classification

Documentation Metrics

  • Svelte/SvelteKit: 1,065,921 bytes (1.04 MB)
  • Tailwind CSS: 2,197,160 bytes (2.1 MB, 249 files)
  • Total Tokens: 606,587 tokens (Tailwind)
  • Update Method: Automated via npm script

Cache Performance

  • Cold Start: ~50-100ms per file read
  • Cache Hit: ~1-5ms response time
  • Memory Usage: ~1-3MB per cached full doc
  • Cache Efficiency: 80-95% hit rate in typical usage
  • Search Performance: <10ms for in-memory search

Documentation Sources

  • Svelte: Official LLM-optimized format from Svelte team
  • Tailwind: Extracted via Repomix from official GitHub repository
  • Updates: Automated script with fallback mechanisms

This upgraded MCP server transforms the original prototype into a production-ready service with complete documentation coverage, enterprise-grade security, performance, and maintainability.

常见问题

Tailwind Svelte Assistant 是什么?

提供 SvelteKit 与 Tailwind CSS 文档、utility class 信息及可直接复用的 Svelte 组件片段,加速 UI 开发。

Tailwind Svelte Assistant 提供哪些工具?

提供 11 个工具,包括 get_sveltekit_doc、get_tailwind_info、get_component_snippet

相关 Skills

前端设计

by anthropics

Universal
热门

面向组件、页面、海报和 Web 应用开发,按鲜明视觉方向生成可直接落地的前端代码与高质感 UI,适合做 landing page、Dashboard 或美化现有界面,避开千篇一律的 AI 审美。

想把页面做得既能上线又有设计感,就用前端设计:组件到整站都能产出,难得的是能避开千篇一律的 AI 味。

编码与调试
未扫描111.8k

网页构建器

by anthropics

Universal
热门

面向复杂 claude.ai HTML artifact 开发,快速初始化 React + Tailwind CSS + shadcn/ui 项目并打包为单文件 HTML,适合需要状态管理、路由或多组件交互的页面。

在 claude.ai 里做复杂网页 Artifact 很省心,多组件、状态和路由都能顺手搭起来,React、Tailwind 与 shadcn/ui 组合效率高、成品也更精致。

编码与调试
未扫描111.8k

网页应用测试

by anthropics

Universal
热门

用 Playwright 为本地 Web 应用编写自动化测试,支持启动开发服务器、校验前端交互、排查 UI 异常、抓取截图与浏览器日志,适合调试动态页面和回归验证。

借助 Playwright 一站式验证本地 Web 应用前端功能,调 UI 时还能同步查看日志和截图,定位问题更快。

编码与调试
未扫描111.8k

相关 MCP Server

GitHub

编辑精选

by GitHub

热门

GitHub 是 MCP 官方参考服务器,让 Claude 直接读写你的代码仓库和 Issues。

这个参考服务器解决了开发者想让 AI 安全访问 GitHub 数据的问题,适合需要自动化代码审查或 Issue 管理的团队。但注意它只是参考实现,生产环境得自己加固安全。

编码与调试
83.1k

by Context7

热门

Context7 是实时拉取最新文档和代码示例的智能助手,让你告别过时资料。

它能解决开发者查找文档时信息滞后的问题,特别适合快速上手新库或跟进更新。不过,依赖外部源可能导致偶尔的数据延迟,建议结合官方文档使用。

编码与调试
51.8k

by tldraw

热门

tldraw 是让 AI 助手直接在无限画布上绘图和协作的 MCP 服务器。

这解决了 AI 只能输出文本、无法视觉化协作的痛点——想象让 Claude 帮你画流程图或白板讨论。最适合需要快速原型设计或头脑风暴的开发者。不过,目前它只是个基础连接器,你得自己搭建画布应用才能发挥全部潜力。

编码与调试
46.2k

评论