Back to MCP Servers

Svelte MCP Server

Official Svelte MCP server providing access to Svelte/SvelteKit documentation, a static-analysis autofixer for LLM-generated code, and playground link generation.

Developer Tools by Svelte (sveltejs) None active
Overview

The Svelte MCP server is the official Model Context Protocol server maintained by the Svelte team. It gives AI coding agents direct access to the current Svelte and SvelteKit documentation and adds static-analysis tooling that catches common mistakes LLMs make when generating Svelte components. The goal is to reduce hallucinated APIs and make agent-generated Svelte code actually compile and run.

The server exposes four tools: list-sections and get-documentation for pulling content from svelte.dev/docs on demand, svelte-autofixer for iteratively analyzing and suggesting fixes for generated component code, and playground-link for producing an ephemeral svelte.dev/playground URL with the generated code embedded. It also ships a svelte-task prompt that orchestrates how an agent should use these tools when working on Svelte tasks.

The server is available as a hosted remote endpoint at https://mcp.svelte.dev/mcp (Streamable HTTP) and as a local stdio server via the @sveltejs/mcp npm package. The source lives in the open-source sveltejs/ai-tools repo under MIT license.

Tools

Tool Description
list-sections Returns the list of all available Svelte/SvelteKit documentation sections that can be fetched.
get-documentation Fetches the current content for one or more documentation sections directly from svelte.dev/docs.
svelte-autofixer Runs static analysis on LLM-generated Svelte code and suggests fixes. Designed to be invoked iteratively until no issues remain.
playground-link Generates an ephemeral svelte.dev/playground link containing the supplied code so users can run and test it without saving to a project.
Setup Guide

Option 1: Remote server (recommended)

Point your MCP client at the hosted endpoint. No installation, no API key.

Claude Desktop: Settings → Connectors → Add Custom Connector. Name it svelte and use URL https://mcp.svelte.dev/mcp.

Cursor / generic MCP config:

{
  "mcpServers": {
    "svelte": {
      "url": "https://mcp.svelte.dev/mcp"
    }
  }
}

VS Code: Open the command palette, run MCP: Add Server..., choose HTTP (HTTP or Server-Sent-Events), then enter https://mcp.svelte.dev/mcp.

Option 2: Local stdio server

Runs the server locally via the @sveltejs/mcp npm package.

{
  "mcpServers": {
    "svelte": {
      "command": "npx",
      "args": ["-y", "@sveltejs/mcp"]
    }
  }
}

CLI shortcuts:

  • Claude Code: claude mcp add -t stdio -s [scope] svelte -- npx -y @sveltejs/mcp
  • Gemini CLI: gemini mcp add -t stdio -s [scope] svelte npx -y @sveltejs/mcp
  • Codex CLI: add an entry to ~/.codex/config.toml with command npx and args ["-y", "@sveltejs/mcp"]

No authentication is required for either option.

Use Cases
  • Ground an AI agent in the current Svelte 5 / SvelteKit docs so it stops referring to deprecated Svelte 4 patterns like $: reactive statements or export let props.
  • Run svelte-autofixer on agent-generated components in a loop until static-analysis issues are resolved, before writing files to disk.
  • Generate a shareable playground link from a snippet so a teammate or end user can immediately try the code in their browser.
  • Look up specific SvelteKit features (load functions, form actions, hooks) on demand instead of stuffing all docs into the system prompt.
  • Migrate Svelte 4 components to Svelte 5 runes by letting the agent fetch the migration docs and iterate with the autofixer.
Example Prompts
  • "Build a SvelteKit form with a server action that validates and inserts into Postgres. Run it through svelte-autofixer before showing me."
  • "Convert this Svelte 4 component to Svelte 5 runes syntax and give me a playground link to test it."
  • "What are the available documentation sections, and fetch the one on load functions in SvelteKit."
  • "Generate a Svelte 5 counter component using $state, then create a playground link."
  • "Review this component for any issues using the Svelte autofixer and iterate until it passes."
Pros
  • Official, maintained by the Svelte core team.
  • Hosted remote endpoint means zero setup and no API keys.
  • The svelte-autofixer static-analysis tool meaningfully reduces hallucinated APIs in generated Svelte code.
  • Always returns up-to-date docs straight from svelte.dev, so agents get current Svelte 5 / SvelteKit guidance.
Limitations
  • Scope is limited to Svelte and SvelteKit. Not useful for projects on other frameworks.
  • In the hosted deployment the SSE channel is closed immediately to avoid Vercel timeout logs, so server.log and list-changed notifications are not delivered (elicitation and sampling still work).
  • No write or filesystem tools. The server suggests fixes and generates links but does not edit your project for you.
Alternatives
  • Context7: general-purpose docs MCP server with Svelte coverage among many other libraries.
  • Ref: MCP server that indexes docs across many frameworks, including Svelte.
  • Framework-specific official servers like the Nuxt or Astro docs MCPs if you're working in those ecosystems instead.