Skip to content

The VS Code of video editing, built for agents.

TypeScript

Add OpenCode support in MCP configuration

konstantin-paulus943912f247c3
diff --git a/apps/desktop/src/mcp-config.test.ts b/apps/desktop/src/mcp-config.test.ts
index e98dfce5..e4912435 100644
--- a/apps/desktop/src/mcp-config.test.ts
+++ b/apps/desktop/src/mcp-config.test.ts
@@ -29,6 +29,7 @@ describe("per-agent entries", () => {
expect(agentTarget("antigravity").entry(spec)).toEqual({ serverUrl: spec.url });
expect(agentTarget("gemini-cli").entry(spec)).toEqual({ httpUrl: spec.url });
expect(agentTarget("windsurf").entry(spec)).toEqual({ serverUrl: spec.url });
+ expect(agentTarget("opencode").entry(spec)).toEqual({ type: "remote", enabled: true, url: spec.url });
});
it("gives Claude Desktop the stdio proxy, and nobody else", () => {
@@ -56,6 +57,12 @@ describe("json configs", () => {
expect(readServer(text, "mcpServers")).toBeNull();
});
+ it("uses OpenCode's root key and keeps the boolean flag", () => {
+ const text = upsertServer(null, "mcp", { type: "remote", enabled: true, url: spec.url });
+ expect(JSON.parse(text)).toEqual({ mcp: { diffusion: { type: "remote", enabled: true, url: spec.url } } });
+ expect(readServer(text, "mcp")).toEqual({ url: spec.url });
+ });
+
it("keeps other servers and unrelated keys", () => {
const before = JSON.stringify({
numStartups: 12,
diff --git a/apps/desktop/src/mcp-config.ts b/apps/desktop/src/mcp-config.ts
index 08ad6037..59e51d69 100644
--- a/apps/desktop/src/mcp-config.ts
+++ b/apps/desktop/src/mcp-config.ts
@@ -24,7 +24,7 @@ export type McpServerSpec = { url: string; command: string; args: string[] };
export const SERVER_NAME = "diffusion";
/** One agent's config entry: what its file format spells a server as. */
-export type ServerEntry = Record<string, string | string[]>;
+export type ServerEntry = Record<string, string | string[] | boolean>;
/** The stable id an agent is addressed by over IPC and in the UI. */
export type AgentId =
@@ -35,10 +35,11 @@ export type AgentId =
| "codex"
| "antigravity"
| "gemini-cli"
- | "windsurf";
+ | "windsurf"
+ | "opencode";
-/** How a config file spells its server map: JSON under `mcpServers` (or VS Code's `servers`), or Codex's TOML tables. */
-export type ConfigFormat = "mcpServers" | "servers" | "toml";
+/** How a config file spells its server map: JSON under `mcpServers` (or VS Code's `servers`, or OpenCode's `mcp`), or Codex's TOML tables. */
+export type ConfigFormat = "mcpServers" | "servers" | "mcp" | "toml";
/**
* A path under one of the two per-user roots. `appData` is where desktop apps
@@ -97,6 +98,7 @@ export const AGENT_TARGETS: readonly AgentTarget[] = [
{ id: "antigravity", label: "Antigravity", marker: home(".gemini/antigravity"), config: home(".gemini/config/mcp_config.json"), format: "mcpServers", entry: http("serverUrl") },
{ id: "gemini-cli", label: "Gemini CLI", marker: home(".gemini"), config: home(".gemini/settings.json"), format: "mcpServers", entry: http("httpUrl") },
{ id: "windsurf", label: "Devin (Windsurf)", marker: home(".codeium/windsurf"), config: home(".codeium/windsurf/mcp_config.json"), format: "mcpServers", entry: http("serverUrl") },
+ { id: "opencode", label: "OpenCode", marker: home(".config/opencode"), config: home(".config/opencode/opencode.json"), format: "mcp", entry: http("url", { type: "remote", enabled: true }) },
];
export function agentTarget(id: AgentId): AgentTarget {
@@ -229,7 +231,8 @@ function tomlString(value: string): string {
return `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
}
-function tomlValue(value: string | string[]): string {
+function tomlValue(value: string | string[] | boolean): string {
+ if (typeof value === "boolean") return String(value);
return Array.isArray(value) ? `[${value.map(tomlString).join(", ")}]` : tomlString(value);
}
diff --git a/apps/web/src/assets/icons/agent.opencode.svg b/apps/web/src/assets/icons/agent.opencode.svg
new file mode 100644
index 00000000..e8511551
--- /dev/null
+++ b/apps/web/src/assets/icons/agent.opencode.svg
@@ -0,0 +1,5 @@
+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(4 4)">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M10.666 3.9987H5.33268V11.9987H10.666V3.9987ZM13.3327 14.6654H2.66602V1.33203H13.3327V14.6654Z" fill="currentColor"/>
+</g>
+</svg>
diff --git a/apps/web/src/lib/mcp.ts b/apps/web/src/lib/mcp.ts
index 0cf753b1..6b8d5ea3 100644
--- a/apps/web/src/lib/mcp.ts
+++ b/apps/web/src/lib/mcp.ts
@@ -35,6 +35,7 @@ export const AGENT_ICONS: Record<AgentId, string> = {
antigravity: "agent.google-antigravity",
"gemini-cli": "agent.google-gemini-cli",
windsurf: "agent.devin-windsurf",
+ opencode: "agent.opencode",
};
const [connectedAgents, setConnectedAgents] = createSignal<number | null>(null);