Files
paoloricciuti d3e4182109 fix: lint
2026-09-07 18:12:52 +02:00
..
2026-08-11 22:25:39 +02:00
2026-09-07 18:12:52 +02:00
2026-08-31 16:31:14 +02:00
2026-08-31 16:31:14 +02:00
2026-09-07 18:12:52 +02:00
2026-08-31 16:31:14 +02:00
2026-08-31 16:31:14 +02:00
2026-08-31 16:31:14 +02:00
2026-08-31 16:31:14 +02:00
2026-08-31 16:31:14 +02:00
2026-08-31 16:31:14 +02:00
2026-08-31 16:31:14 +02:00
2026-08-31 16:31:14 +02:00

@sveltejs/opencode

OpenCode plugin for Svelte that provides the Svelte MCP server, a specialized file editor subagent and instruction files.

Installation

Add @sveltejs/opencode to your OpenCode config (either global or local):

{
	"$schema": "https://opencode.ai/config.json",
	"plugin": ["@sveltejs/opencode"]
}

That's it! You now have the Svelte MCP server and the file editor subagent configured automatically.

The same package and @sveltejs/opencode/server entrypoint support both OpenCode v1 and v2. No server configuration change is needed when upgrading OpenCode.

To configure the plugin from OpenCode v1's TUI, add the package to tui.json as well:

{
	"$schema": "https://opencode.ai/tui.json",
	"plugin": ["@sveltejs/opencode"]
}

OpenCode V2 automatically loads the package's TUI entrypoint when the server plugin is active.

Run /svelte-plugin or choose Configure Svelte plugin from the command palette. The dialog lets you choose project or global scope before editing the available options, and guides you through finite choices such as built-in skills.

Features

Svelte MCP Server

The plugin automatically configures the Svelte MCP server which provides:

  • list-sections - Discover available Svelte 5 and SvelteKit documentation sections
  • get-documentation - Retrieve full documentation content for specific sections
  • svelte-autofixer - Analyze Svelte code and get issues/suggestions
  • playground-link - Generate Svelte Playground links with provided code

Svelte File Editor Subagent

A specialized subagent (svelte-file-editor) that is automatically used when creating, editing, or reviewing .svelte, .svelte.ts, or .svelte.js files. It fetches relevant documentation and validates code using the Svelte MCP server tools.

Agent Instructions

The plugin injects instructions that teach the agent how to effectively use the Svelte MCP tools.

Configuration

Create svelte.json to customize how the plugin configures MCP, the Svelte subagent, instructions, and skills.

{
	"$schema": "https://svelte.dev/opencode/schema.json",
	"mcp": {
		"type": "local",
		"enabled": true
	},
	"subagent": {
		"enabled": true,
		"agents": {
			"svelte-file-editor": {
				"model": "anthropic/claude-sonnet-4-20250514",
				"temperature": 0.7,
				"top_p": 0.9,
				"maxSteps": 20
			}
		}
	},
	"instructions": {
		"enabled": true
	},
	"skills": {
		"enabled": ["svelte-code-writer", "svelte-core-bestpractices"]
	},
	"autoupdate": true
}

Auto update

The plugin checks npm for newer versions and warns you when one is available. OpenCode caches plugins, so a new version is only picked up once that cache is wiped.

Automatic updates are enabled by default. When a newer version is detected, the plugin removes itself from the OpenCode cache when its server instance shuts down, so the latest version is installed on the next start. This only applies when the plugin is unpinned or explicitly uses the latest tag. Exact versions, ranges, and other dist-tags are left untouched because reinstalling them may resolve to the same version again. Set "autoupdate": false to only receive the warning.

OpenCode v2 keeps a background server running after its TUI closes. Closing the TUI is therefore not a plugin shutdown; cleanup occurs when v2 evicts the idle location or when the background server stops.

OpenCode v1 displays update and invalid-config warnings as TUI toasts. The v2 server plugin API does not currently expose notifications, so v2 reports the same messages as Node process warnings. v2 also registers the bundled instructions and skills directly through its plugin domains rather than adding their paths to the legacy configuration.

Defaults

If omitted, the plugin uses these defaults:

  • mcp.type: "local"
  • mcp.enabled: true
  • subagent.enabled: true
  • subagent.agents: {}
  • instructions.enabled: true
  • skills.enabled: true
  • autoupdate: true

Configuration Options

Option Type Default Description
mcp.type "remote" | "local" "local" Run @sveltejs/mcp via npx (local) or use https://mcp.svelte.dev/mcp (remote).
mcp.enabled boolean true Enable or disable the Svelte MCP server entry.
subagent.enabled boolean true Enable or disable registration of the svelte-file-editor subagent.
subagent.agents.svelte-file-editor.model string main agent Override the model used by the Svelte file editor subagent.
subagent.agents.svelte-file-editor.temperature number unset Set temperature for the subagent.
subagent.agents.svelte-file-editor.top_p number unset Set top-p sampling for the subagent.
subagent.agents.svelte-file-editor.maxSteps number unlimited Limit the number of steps the subagent can execute.
instructions.enabled boolean true Enable or disable automatic instruction-file injection.
skills.enabled boolean | string[] true Enable all skills (true), disable all skills (false), or enable only specific skill names.
autoupdate boolean true Remove an unpinned/latest plugin from the cache on plugin shutdown when an update is available.

Supported Skill Names

When using skills.enabled as an array, these built-in names are currently available:

  • svelte-code-writer
  • svelte-core-bestpractices

Config File Locations and Precedence

The plugin reads from these files (lowest priority first, highest priority last):

  • ~/.config/opencode/svelte.json
  • $OPENCODE_CONFIG_DIR/svelte.json (when OPENCODE_CONFIG_DIR is set)
  • .opencode/svelte.json in the current project

If the same key is defined in multiple files, the later location overrides earlier ones.

OpenCode v2 watches these files and reloads the MCP, subagent, instructions, and skills when they change. A server restart is not required.

License

MIT