Skip to content

Commit ea337f2

Browse files
committed
opencode support
1 parent a4ffa4e commit ea337f2

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

packages/cli-v3/src/commands/install-mcp.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const clients = [
2929
"crush",
3030
"cline",
3131
"openai-codex",
32+
"opencode",
3233
"amp",
3334
] as const;
3435
const scopes = ["user", "project", "local"] as const;
@@ -81,6 +82,10 @@ const clientScopes: ClientScopes = {
8182
"openai-codex": {
8283
user: "~/.codex/config.toml",
8384
},
85+
opencode: {
86+
user: "~/.config/opencode/opencode.json",
87+
project: "./opencode.json",
88+
},
8489
};
8590

8691
const clientLabels: ClientLabels = {
@@ -94,6 +99,7 @@ const clientLabels: ClientLabels = {
9499
cline: "Cline",
95100
"openai-codex": "OpenAI Codex CLI",
96101
amp: "Sourcegraph AMP",
102+
opencode: "opencode",
97103
};
98104

99105
type SupportedClients = (typeof clients)[number];
@@ -321,7 +327,7 @@ async function installMcpServerForClient(
321327
return { configPath, clientName, scope };
322328
}
323329

324-
type McpServerConfig = Record<string, string | Array<string> | undefined>;
330+
type McpServerConfig = Record<string, string | Array<string> | boolean | undefined>;
325331
type McpServerScope = {
326332
scope: (typeof scopes)[number];
327333
location: string;
@@ -446,6 +452,9 @@ function resolveMcpServerConfigJsonPath(
446452
case "openai-codex": {
447453
return ["mcp_servers", "trigger"];
448454
}
455+
case "opencode": {
456+
return ["mcp", "trigger"];
457+
}
449458
}
450459
}
451460

@@ -534,6 +543,13 @@ function resolveMcpServerConfig(
534543
args,
535544
};
536545
}
546+
case "opencode": {
547+
return {
548+
type: "local",
549+
command: ["npx", ...args],
550+
enabled: true,
551+
};
552+
}
537553
}
538554
}
539555

0 commit comments

Comments
 (0)