A specialized Model Context Protocol (MCP) server for Svelte 5 frontend development, providing curated knowledge, code examples, and intelligent assistance for modern Svelte development with runes, snippets, and enhanced reactivity.
search_knowledge
- Find explanations and conceptssearch_examples
- Discover code patterns and implementationsgenerate_with_context
- Create components using curated patternsaudit_with_rules
- Review code against Svelte 5 best practicesexplain_concept
- Get detailed explanations with examplesgenerate-component
- Generate modern Svelte 5 componentsaudit-svelte5-code
- Audit code for optimization opportunitiesexplain-concept
- Detailed concept explanationssearch-patterns
- Find specific implementation patterns# Clone and setup
git clone <repository-url>
cd svelte5-mcp-server
# Install dependencies
npm install
# Build the server
npm run build
# Start the server
npm start
svelte5-mcp-server/
āāā src/
ā āāā index.ts # Main MCP server implementation
āāā data/
ā āāā svelte_5_knowledge.json # Curated Q&A knowledge base
ā āāā svelte_5_patterns.json # Code examples and patterns
āāā package.json
āāā tsconfig.json
āāā example system prompt # Svelte 5 specific system prompt (quite strict, adjust for your own preferences)
āāā README.md
Add to your Claude Desktop configuration:
{
"mcpServers": {
"svelte5": {
"command": "node",
"args": ["/path/to/svelte5-mcp-server/dist/index.js"],
"env": {}
}
}
}
Tool: search_knowledge
Query: "runes reactivity"
Returns detailed explanations about Svelte 5 runes and the new reactivity system.
Tool: search_examples
Query: "counter component $state"
Returns working Svelte 5 counter implementations using the $state
rune.
Tool: generate_with_context
Description: "A todo list with add/remove functionality"
Features: ["$state", "snippets", "accessibility"]
Generates a complete todo component using modern Svelte 5 patterns with relevant examples from the knowledge base.
Tool: audit_with_rules
Code: "<script>let count = 0;</script><button on:click={() => count++}>{count}</button>"
Focus: "best-practices"
Analyzes code and suggests Svelte 5 improvements (e.g., using $state
and modern event handling).
$state
- Reactive state management$derived
- Computed values and derived state$effect
- Side effects and lifecycle$props
- Component properties$bindable
- Two-way data binding$inspect
- Development debugging{#snippet}
, {@render}
)onclick
vs legacy on:click
$:
) ā runessvelte_5_knowledge.json
){
"question": "How do you manage reactive state in Svelte 5?",
"answer": "In Svelte 5, reactive state is managed using the $state rune..."
}
svelte_5_patterns.json
){
"instruction": "Create a Svelte 5 component demonstrating $state",
"input": "The rune allows you to create reactive state...",
"output": "<script>\nlet count = $state(0);\n</script>\n\n<button onclick={() => count++}>\n clicks: {count}\n</button>"
}
The server uses a better-sqlite3 database and FTS5 queries for search
unicode61
tokenizer with a comprehensive set of separators for robust indexing of terms.highlight()
function.npm run build # Compile TypeScript
npm run dev # Watch mode for development
node process-attached-data.js # Process curated knowledge
node setup-data.js # Create sample data
The server provides comprehensive logging and error handling:
# Test the server
echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}' | npm start
data/svelte_5_knowledge.json
{"question": "...", "answer": "..."}
data/svelte_5_patterns.json
{"instruction": "...", "input": "...", "output": "..."}
$state
, snippets
, etc.)The search tools support sophisticated queries:
// Search for state management patterns
search_examples("$state reactive updates")
// Find accessibility guidance
search_knowledge("a11y accessibility screen reader")
// Discover migration patterns
search_examples("svelte 4 migration runes")
Use prompts in sequence for complex workflows:
search-patterns
- Find relevant patternsgenerate-component
- Create based on patternsaudit-svelte5-code
- Review and optimize"No results found"
"Tool not found"
npm run build
)"Invalid data format"
# Enable debug logging
DEBUG=* npm start
MIT License - see LICENSE file for details.