A specialized Model Context Protocol (MCP) server for tRPC SvelteKit development, providing curated knowledge, code examples, and intelligent assistance for building type-safe APIs with end-to-end type safety in SvelteKit applications.
search_knowledge
- Find explanations and conceptssearch_examples
- Discover code patterns and implementationsgenerate_with_context
- Create routers and procedures using curated patternsaudit_with_rules
- Review code against tRPC SvelteKit best practicesexplain_concept
- Get detailed explanations with examplesgenerate-router
- Generate modern tRPC SvelteKit routersaudit-trpc-code
- Audit code for optimization opportunitiesexplain-concept
- Detailed concept explanationssearch-patterns
- Find specific implementation patternsSimply add to your Claude Desktop configuration - no installation required:
{
"mcpServers": {
"trpc-sveltekit": {
"command": "bunx",
"args": ["@binsarjr/trpc-sveltekit-mcp"],
"env": {}
}
}
}
# Clone and setup
git clone https://github.com/binsarjr/trpc-sveltekit-mcp
cd trpc-sveltekit-mcp
# Install dependencies with Bun
bun install
# Start the server
bun start
trpc-sveltekit-mcp/
āāā src/
ā āāā index.ts # Main MCP server implementation
ā āāā TRPCSvelteKitSearchDB.ts # SQLite database with FTS5 search
ā āāā data/
ā āāā knowledge/ # Curated Q&A knowledge base (JSONL)
ā āāā patterns/ # Code examples and patterns (JSONL)
āāā package.json
āāā bun.lockb # Bun lock file
āāā tsconfig.json
āāā README.md
{
"mcpServers": {
"trpc-sveltekit": {
"command": "bunx",
"args": ["@binsarjr/trpc-sveltekit-mcp"],
"env": {}
}
}
}
{
"mcpServers": {
"trpc-sveltekit": {
"command": "bun",
"args": ["/path/to/trpc-sveltekit-mcp/src/index.ts"],
"env": {}
}
}
}
Tool: search_knowledge
Query: "authentication middleware"
Returns detailed explanations about implementing authentication in tRPC SvelteKit.
Tool: search_examples
Query: "router setup context"
Returns working tRPC SvelteKit router implementations with context setup.
Tool: generate_with_context
Description: "User management API with CRUD operations"
Procedures: ["list", "create", "update", "delete"]
Generates a complete tRPC router using modern patterns with relevant examples from the knowledge base.
Tool: audit_with_rules
Code: "const router = t.router({ hello: t.procedure.query(() => 'world') });"
Focus: "best-practices"
Analyzes code and suggests tRPC SvelteKit improvements like input validation and error handling.
data/knowledge/
){
"question": "How do you create a tRPC router in SvelteKit?",
"answer": "Create a tRPC router using t.router() and define procedures with t.procedure.query() for read operations..."
}
data/patterns/
){
"instruction": "Create a basic tRPC router with TypeScript",
"input": "Set up a basic tRPC router with a simple greeting query",
"output": "// lib/trpc/router.ts\nimport { initTRPC } from '@trpc/server';\n..."
}
The server stores its SQLite database following the XDG Base Directory specification:
~/.config/binsarjr/trpc-sveltekit-mcp/database.db
This provides a consistent, organized location across all operating systems.
You can customize the database location using environment variables:
{
"mcpServers": {
"trpc-sveltekit": {
"command": "bunx",
"args": ["@binsarjr/trpc-sveltekit-mcp"],
"env": {
"TRPC_SVELTEKIT_MCP_CONFIG_DIR": "/custom/config/path",
"TRPC_SVELTEKIT_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
src/data/knowledge/
{"question": "...", "answer": "..."}
src/data/patterns/
{"instruction": "...", "input": "...", "output": "..."}
router
, procedures
, context
, etc.)The search tools support sophisticated queries:
// Search for authentication patterns
search_examples("authentication middleware jwt")
// Find type safety guidance
search_knowledge("typescript type inference zod")
// Discover integration patterns
search_examples("sveltekit load function trpc")
Use prompts in sequence for complex workflows:
search-patterns
- Find relevant patternsgenerate-router
- Create based on patternsaudit-trpc-code
- Review and optimize"No results found"
"Tool not found"
"Invalid data format"
Database/Config Issues
TRPC_SVELTEKIT_MCP_DB_PATH
environment variable for custom locations# Enable debug logging
DEBUG=* bun start
# Test database location
bunx @binsarjr/trpc-sveltekit-mcp # Watch for config path logs
# Check config directory (all platforms)
ls -la ~/.config/binsarjr/trpc-sveltekit-mcp/
MIT License - see LICENSE file for details.