Skip to main content

概述

Svelte MCP (模型上下文协议) 服务器可以帮助你的 LLM 或所选代理编写更好的 Svelte 代码。它的工作原理是提供与当前任务相关的文档,并静态分析生成的代码,以便提出修复建议和最佳实践。

¥The Svelte MCP (Model Context Protocol) server can help your LLM or agent of choice write better Svelte code. It works by providing documentation relevant to the task at hand, and statically analysing generated code so that it can suggest fixes and best practices.

设置(Setup)

¥Setup

设置会根据你首选的 MCP 版本(远程或本地)以及你选择的 MCP 客户端(例如 Claude Code、Codex CLI 或 GitHub Copilot)而有所不同:

¥The setup varies based on the version of the MCP you prefer — remote or local — and your chosen MCP client (e.g. Claude Code, Codex CLI or GitHub Copilot):

用法(Usage)

¥Usage

为了充分利用 MCP 服务器,我们建议在你的 AGENTS.md(或 CLAUDE.md,如果使用 Claude 代码)中包含以下提示。这将告诉 LLM 哪些工具可用以及何时适合使用它们。

¥To get the most out of the MCP server we recommend including the following prompt in your AGENTS.md (or CLAUDE.md, if using Claude Code). This will tell the LLM which tools are available and when it’s appropriate to use them.

You are able to use the Svelte MCP server, where you have access to comprehensive Svelte 5 and SvelteKit documentation. Here's how to use the available tools effectively:

## Available MCP Tools:

### 1. list-sections

Use this FIRST to discover all available documentation sections. Returns a structured list with titles, use_cases, and paths.
When asked about Svelte or SvelteKit topics, ALWAYS use this tool at the start of the chat to find relevant sections.

### 2. get-documentation

Retrieves full documentation content for specific sections. Accepts single or multiple sections.
After calling the list-sections tool, you MUST analyze the returned documentation sections (especially the use_cases field) and then use the get-documentation tool to fetch ALL documentation sections that are relevant for the user's task.

### 3. svelte-autofixer

Analyzes Svelte code and returns issues and suggestions.
You MUST use this tool whenever writing Svelte code before sending it to the user. Keep calling it until no issues or suggestions are returned.

### 4. playground-link

Generates a Svelte Playground link with the provided code.
After completing the code, ask the user if they want a playground link. Only call this tool after user confirmation and NEVER if code was written to files in their project.

如果你的 MCP 客户端支持,我们还建议你使用 svelte-task 提示符来指导 LLM 如何以最佳方式使用 MCP 服务器。

¥If your MCP client supports it, we also recommend using the svelte-task prompt to instruct the LLM on the best way to use the MCP server.

上一页 下一页