A specialized Model Context Protocol (MCP) server for shadcn-svelte development, providing curated knowledge, code examples, and intelligent assistance for building modern UI components with design systems, theming, and accessibility best practices in Svelte and SvelteKit applications.
search_knowledge
- Find explanations and conceptssearch_examples
- Discover code patterns and implementationssearch_components
- Search UI components with props and variantsgenerate_component
- Generate components with themes and accessibilityaudit_with_rules
- Review code against shadcn-svelte best practicesexplain_concept
- Get detailed explanations with examplesgenerate-component
- Generate modern shadcn-svelte componentsaudit-shadcn-code
- Audit code for accessibility and design system complianceexplain-concept
- Detailed concept explanations with examplesfind-component
- Find specific components with usage patternsSimply add to your Claude Desktop configuration - no installation required:
{
"mcpServers": {
"shadcn-svelte": {
"command": "bunx",
"args": ["@binsarjr/shadcn-svelte-mcp"],
"env": {}
}
}
}
# Clone and setup
git clone https://github.com/binsarjr/shadcn-svelte-mcp
cd shadcn-svelte-mcp
# Install dependencies with Bun
bun install
# Start the server
bun start
shadcn-svelte-mcp/
āāā src/
ā āāā index.ts # Main MCP server implementation
ā āāā ShadcnSvelteSearchDB.ts # SQLite database with FTS5 search
ā āāā data/
ā āāā knowledge/ # Curated Q&A knowledge base (JSONL)
ā āāā examples/ # Code examples and patterns (JSONL)
ā āāā components/ # Component catalog with props and variants (JSONL)
āāā package.json
āāā tsconfig.json
āāā README.md
{
"mcpServers": {
"shadcn-svelte": {
"command": "bunx",
"args": ["@binsarjr/shadcn-svelte-mcp"],
"env": {}
}
}
}
{
"mcpServers": {
"shadcn-svelte": {
"command": "bun",
"args": ["/path/to/shadcn-svelte-mcp/src/index.ts"],
"env": {}
}
}
}
Tool: search_knowledge
Query: "button variants themes"
Returns detailed explanations about implementing button variants with different themes in shadcn-svelte.
Tool: search_examples
Query: "card component accessibility"
Returns working shadcn-svelte card component implementations with accessibility features.
Tool: search_components
Query: "dialog modal"
Returns component details for dialog/modal components with props, variants, and installation instructions.
Tool: generate_component
Description: "User profile card with avatar, name, and action buttons"
Component Type: "card"
Theme: "auto"
Generates a complete shadcn-svelte component using modern patterns with relevant examples from the knowledge base.
Tool: audit_with_rules
Code: "<script>\n let { variant = 'default', ...props } = $props();\n</script>\n<button class={buttonVariants({ variant })} {...props}><slot /></button>"
Focus: "accessibility"
Analyzes code and suggests shadcn-svelte improvements for accessibility compliance and design system consistency.
data/knowledge/
){
"question": "How do I customize shadcn-svelte button variants?",
"answer": "To customize button variants in shadcn-svelte, you can modify the variants object in your button component using class-variance-authority (cva)...",
"category": "components",
"tags": ["button", "variants", "customization"]
}
data/examples/
){
"title": "Accessible Button with Custom Variants",
"description": "Button component with custom variants and full accessibility support",
"component": "Button",
"code": "<script lang=\"ts\">\n import { cn } from '$lib/utils';\n import { buttonVariants } from './variants';\n \n type Variant = 'default' | 'destructive' | 'outline';\n \n interface Props {\n variant?: Variant;\n class?: string;\n }\n \n let { variant = 'default', class: className, ...restProps }: Props = $props();\n</script>\n\n<button \n class={cn(buttonVariants({ variant }), className)}\n {...restProps}\n>\n <slot />\n</button>",
"category": "buttons",
"tags": ["button", "variants", "accessibility", "typescript"],
"complexity": "intermediate",
"dependencies": ["class-variance-authority", "clsx"]
}
data/components/
){
"name": "Button",
"description": "Displays a button or a component that looks like a button with various styling variants",
"category": "form",
"props": "{\"variant\": {\"type\": \"'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link'\", \"default\": \"'default'\"}, \"size\": {\"type\": \"'default' | 'sm' | 'lg' | 'icon'\", \"default\": \"'default'\"}}",
"usage": "<Button variant=\"outline\" size=\"sm\">Click me</Button>",
"installation": "npx shadcn-svelte@latest add button",
"variants": ["default", "destructive", "outline", "secondary", "ghost", "link"],
"dependencies": ["class-variance-authority", "clsx"]
}
The server stores its SQLite database following the XDG Base Directory specification:
~/.config/binsarjr/shadcn-svelte-mcp/database.db
This provides a consistent, organized location across all operating systems.
You can customize the database location using environment variables:
{
"mcpServers": {
"shadcn-svelte": {
"command": "bunx",
"args": ["@binsarjr/shadcn-svelte-mcp"],
"env": {
"SHADCN_SVELTE_MCP_CONFIG_DIR": "/custom/config/path",
"SHADCN_SVELTE_MCP_DB_PATH": "/custom/database.db"
}
}
}
}
The server uses SQLite with FTS5 for advanced search capabilities:
unicode61
tokenizer with a comprehensive set of separators for robust indexing of terms.highlight()
function.The server provides comprehensive logging and error handling:
# Test the server
echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}' | bun start
# Test via bunx
echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}' | bunx @binsarjr/shadcn-svelte-mcp
# Enable development mode with watch
bun run dev
# Inspect the server (for debugging)
bun run inspect
# Build for production
bun run build
# Publish to npm
npm publish
src/data/knowledge/
{"question": "...", "answer": "...", "category": "...", "tags": [...]}
src/data/examples/
{"title": "...", "description": "...", "component": "...", "code": "...", "category": "...", "tags": [...], "complexity": "...", "dependencies": [...]}
src/data/components/
{"name": "...", "description": "...", "category": "...", "props": "...", "usage": "...", "installation": "...", "variants": [...], "dependencies": [...]}
button
, theme
, variant
, etc.)The search tools support sophisticated queries:
// Search for component patterns
search_examples("button variants accessibility")
// Find theming guidance
search_knowledge("dark mode theme customization")
// Discover specific components
search_components("dialog modal overlay")
Use prompts in sequence for complex workflows:
find-component
- Find relevant componentsgenerate-component
- Create based on patternsaudit-shadcn-code
- Review and optimize"No results found"
"Tool not found"
"Invalid data format"
Database/Config Issues
SHADCN_SVELTE_MCP_DB_PATH
environment variable for custom locations# Enable debug logging
DEBUG=* bun start
# Test database location
bunx @binsarjr/shadcn-svelte-mcp # Watch for config path logs
# Check config directory (all platforms)
ls -la ~/.config/binsarjr/shadcn-svelte-mcp/
MIT License - see LICENSE file for details.