CLI
The @sveltejs/mcp npm package normally launches the local stdio MCP server:
npx -y @sveltejs/mcpIf you invoke it with a subcommand, it behaves like a regular CLI and prints the result directly in your terminal instead. This is useful for agents, scripts and quick manual checks.
Usage
npx -y @sveltejs/mcp <command> [options]Available commands:
list-sectionsget-documentation <sections>svelte-autofixer <code_or_path>
You can learn more about the commands with
npx -y @sveltejs/mcp --help
npx -y @sveltejs/mcp <command> --help
npx -y @sveltejs/mcp --versionlist-sections
Lists all available Svelte and SvelteKit documentation sections.
npx -y @sveltejs/mcp list-sectionsThe output is a structured text list of sections, including each section's title, use_cases, and documentation path. This is the same catalog the MCP tool uses before calling get-documentation.
get-documentation
Fetches the full documentation for one or more sections.
npx -y @sveltejs/mcp get-documentation 'svelte/$state'
# or
npx -y @sveltejs/mcp get-documentation 'svelte/$state,svelte/await-expressions'Each section can be matched by title or by documentation path. If a section cannot be found, the CLI returns an error plus similar matches when available.
svelte-autofixer
Runs the Svelte autofixer against either inline code or a file path:
npx -y @sveltejs/mcp svelte-autofixer 'src/routes/+page.svelte'If the argument is an existing path, the CLI reads the file automatically. Otherwise it treats the argument as raw Svelte code.
Because most shells expand $, inline code should be quoted or escaped correctly. In practice, passing a file path is usually easier than passing source directly.
Available options:
--svelte-version <4|5>- choose which Svelte version to validate against (defaults to5)--async- enable async Svelte analysis for Svelte 5 projects
The command prints an object with:
issuessuggestionsrequire_another_tool_call_after_fixing
This makes it easy to use in an agentic loop: run the autofixer, apply fixes, then run it again until it reports no remaining issues or suggestions.