spences10

mcp-svelte-docs

Community spences10
Updated

MCP server for Svelte docs

mcp-svelte-docs

A Model Context Protocol (MCP) server that provides efficient accessto Svelte documentation with advanced caching, search capabilities,and optimised content delivery. This server integrates directly withSvelte's official documentation, offering both full and compressedvariants suitable for different LLM context window sizes.

Features

  • ๐Ÿ“š Complete Svelte documentation access through MCP Resources
  • ๐Ÿ” Advanced search capabilities:
    • Document type filtering (API, Tutorial, Example, Error)
    • Section hierarchy awareness
    • Intelligent relevance scoring based on:
      • Term frequency
      • Section importance
      • Document type relevance
      • Exact phrase matching
    • Context-aware result excerpts
    • Related search suggestions
  • ๐Ÿ’พ Efficient caching with LibSQL
  • ๐Ÿ”„ Automatic content freshness checks
  • ๐Ÿ“ฆ Support for package-specific documentation (Svelte, Kit, CLI)
  • ๐Ÿ“ Smart content chunking for large documents
  • ๐Ÿ—œ๏ธ Compressed variants for smaller context windows
  • ๐Ÿ—๏ธ Built on the Model Context Protocol

Configuration

This server requires configuration through your MCP client. Here areexamples for different environments:

Cline Configuration

Add this to your Cline MCP settings:

{
	"mcpServers": {
		"svelte-docs": {
			"command": "npx",
			"args": ["-y", "mcp-svelte-docs"],
			"env": {
				"LIBSQL_URL": "file:local.db",
				"LIBSQL_AUTH_TOKEN": "your-auth-token-if-using-remote-db"
			}
		}
	}
}

Claude Desktop with WSL Configuration

For WSL environments, add this to your Claude Desktop configuration:

{
	"mcpServers": {
		"svelte-docs": {
			"command": "wsl.exe",
			"args": [
				"bash",
				"-c",
				"LIBSQL_URL=file:local.db LIBSQL_AUTH_TOKEN=your-token npx -y mcp-svelte-docs"
			]
		}
	}
}

Environment Variables

The server supports the following environment variables:

  • LIBSQL_URL (optional): URL for the LibSQL database. Defaults tofile:local.db
  • LIBSQL_AUTH_TOKEN (optional): Auth token for remote LibSQLdatabase

API

The server implements both MCP Resources and Tools:

Resources

Access documentation through these URIs:

  • svelte-docs://docs/llms.txt - Documentation index
  • svelte-docs://docs/llms-full.txt - Complete documentation
  • svelte-docs://docs/llms-small.txt - Compressed documentation
  • svelte-docs://docs/{package}/llms.txt - Package-specificdocumentation
    • Supported packages: svelte, kit, cli

Tools

search_docs

Enhanced search functionality with advanced filtering and contextawareness.

Parameters:

  • query (string, required): Search keywords or natural languagequery
  • doc_type (string, optional): Filter by documentation type
    • Values: 'api', 'tutorial', 'example', 'error', 'all'
    • Default: 'all'
  • context (number, optional): Number of surrounding paragraphs (0-3)
    • Default: 1
  • include_hierarchy (boolean, optional): Include section hierarchy
    • Default: true

Example Usage:

// API Reference Search
{
  "query": "bind:value directive",
  "doc_type": "api",
  "context": 1
}

// Tutorial Search
{
  "query": "routing sveltekit",
  "doc_type": "tutorial",
  "context": 2,
  "include_hierarchy": true
}
get_next_chunk

Retrieve subsequent chunks of large documents.

Parameters:

  • uri (string, required): Document URI
  • chunk_number (number, required): Chunk number to retrieve(1-based)

Development

Setup

  1. Clone the repository
  2. Install dependencies:
pnpm install
  1. Build the project:
pnpm build
  1. Run in development mode:
pnpm dev

Publishing

  1. Update version in package.json
  2. Build the project:
pnpm build
  1. Publish to npm:
pnpm publish

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see the LICENSE file for details.

Acknowledgments

MCP Server ยท Populars

MCP Server ยท New