Skip to content

Instantly share code, notes, and snippets.

@paoloricciuti
Created January 15, 2026 08:38
Show Gist options
  • Select an option

  • Save paoloricciuti/133cbd5106f564b95b05e6384c572efc to your computer and use it in GitHub Desktop.

Select an option

Save paoloricciuti/133cbd5106f564b95b05e6384c572efc to your computer and use it in GitHub Desktop.
Opencode Svelte Plugin
import type { Plugin } from '@opencode-ai/plugin';
export const SveltePlugin: Plugin = async () => {
return {
async config(input) {
input.agent ??= {};
input.mcp ??= {};
let svelte_mcp_name = 'svelte';
for (let name in input.mcp) {
const mcp = input.mcp[name];
if (
(mcp.type === 'remote' &&
mcp.url.includes('https://mcp.svelte.dev/mcp')) ||
(mcp.type === 'local' &&
mcp.command.includes('@sveltejs/mcp'))
) {
svelte_mcp_name = name;
break;
}
}
if (!input.mcp[svelte_mcp_name]) {
input.mcp[svelte_mcp_name] = {
type: 'remote',
url: 'https://mcp.svelte.dev/mcp',
};
}
input.agent['svelte-file-editor'] = {
color: '#ff3e00',
mode: 'subagent',
prompt: `You are a specialized Svelte coder. Always use the tools from the svelte MCP server to fetch documentation with \`get_documentation\` and validating the code with \`svelte_autofixer\`. If the autofixer returns any issue or suggestions try to solve them.`,
description:
'Specialized Svelte 5 code editor. MUST BE USED PROACTIVELY when creating, editing, or reviewing any .svelte file or .svelte.ts/.svelte.js module and MUST use the tools from the MCP server. Fetches relevant documentation and validates code using the Svelte MCP server tools.',
permission: {
bash: 'ask',
edit: 'allow',
webfetch: 'ask',
},
tools: {
[`${svelte_mcp_name}_*`]: true,
},
};
},
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment