Skip to main content

OpenCode

OpenCode has a plugin system that allows developers to add MCP servers, agents and commands programmatically. Svelte has an OpenCode plugin published under @sveltejs/opencode.

Installation

With OpenCode 1.3.4 or newer, install the plugin from the command line:

opencode plugin @sveltejs/opencode

Alternatively, edit your OpenCode config (either the global or the local one) and add @sveltejs/opencode to the list of plugins:

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

That's it! You now have the Svelte MCP server, skills, and the svelte-file-editor subagent configured for you.

TUI configuration

The package also includes a TUI plugin for configuring these features interactively. Add @sveltejs/opencode to your global or project-local tui.json:

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

Restart OpenCode, then run /svelte-plugin or select 'Configure Svelte plugin' from the command palette. Choose whether to edit the project or global configuration, then use the checkboxes and radio options to configure the plugin. Changes are saved automatically, and 'Revert changes' restores the values from when the dialog was opened.

Configuration

By default, everything is enabled. The TUI plugin writes the same configuration files that you can create or edit manually:

  • locally, in .opencode/svelte.json
  • globally, in ~/.config/opencode/svelte.json (or, if you have specified the environment variable, in $OPENCODE_CONFIG_DIR/svelte.json)
{
	"$schema": "https://svelte.dev/opencode/schema.json",
	"mcp": {
		"type": "remote", // or "local" — defaults to remote
		"enabled": true
	},
	"subagent": {
		"enabled": true,
		"agents": {
			"svelte-file-editor": {
				"model": "<other-model>", // defaults to the same as main agent
				"temperature": 1, // defaults to unset
				"top_p": 0.7, // defaults to unset
				"maxSteps": 20 // defaults to unlimited
			}
		}
	},
	"skills": {
		// this can be `true`, or an array of skills to enable
		// e.g. ["svelte-core-bestpractices"]
		"enabled": true
	},
	"instructions": {
		"enabled": true
	}
}

Edit this page on GitHub llms.txt

previous next