Skip to content

Commit 9131ec9

Browse files
committed
Add OpenCode client support
1 parent f8da12f commit 9131ec9

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

cmd/thv/app/client.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Valid clients:
5757
- cursor: Cursor editor
5858
- goose: Goose AI agent
5959
- lm-studio: LM Studio application
60+
- opencode: OpenCode editor
6061
- roo-code: Roo Code extension for VS Code
6162
- trae: Trae IDE
6263
- vscode: Visual Studio Code
@@ -84,6 +85,7 @@ Valid clients:
8485
- cursor: Cursor editor
8586
- goose: Goose AI agent
8687
- lm-studio: LM Studio application
88+
- opencode: OpenCode editor
8789
- roo-code: Roo Code extension for VS Code
8890
- trae: Trae IDE
8991
- vscode: Visual Studio Code
@@ -191,13 +193,13 @@ func clientRegisterCmdFunc(cmd *cobra.Command, args []string) error {
191193
// Validate the client type
192194
switch clientType {
193195
case "roo-code", "cline", "cursor", "claude-code", "vscode-insider", "vscode", "windsurf", "windsurf-jetbrains",
194-
"amp-cli", "amp-vscode", "amp-vscode-insider", "amp-cursor", "amp-windsurf", "lm-studio", "goose", "trae", "continue":
196+
"amp-cli", "amp-vscode", "amp-vscode-insider", "amp-cursor", "amp-windsurf", "lm-studio", "goose", "trae", "continue", "opencode":
195197
// Valid client type
196198
default:
197199
return fmt.Errorf(
198200
"invalid client type: %s (valid types: roo-code, cline, cursor, claude-code, vscode, vscode-insider, "+
199201
"windsurf, windsurf-jetbrains, amp-cli, amp-vscode, amp-vscode-insider, amp-cursor, amp-windsurf, lm-studio, "+
200-
"goose, trae, continue)",
202+
"goose, trae, continue, opencode)",
201203
clientType)
202204
}
203205

@@ -210,13 +212,13 @@ func clientRemoveCmdFunc(cmd *cobra.Command, args []string) error {
210212
// Validate the client type
211213
switch clientType {
212214
case "roo-code", "cline", "cursor", "claude-code", "vscode-insider", "vscode", "windsurf", "windsurf-jetbrains",
213-
"amp-cli", "amp-vscode", "amp-vscode-insider", "amp-cursor", "amp-windsurf", "lm-studio", "goose", "trae", "continue":
215+
"amp-cli", "amp-vscode", "amp-vscode-insider", "amp-cursor", "amp-windsurf", "lm-studio", "goose", "trae", "continue", "opencode":
214216
// Valid client type
215217
default:
216218
return fmt.Errorf(
217219
"invalid client type: %s (valid types: roo-code, cline, cursor, claude-code, vscode, vscode-insider, "+
218220
"windsurf, windsurf-jetbrains, amp-cli, amp-vscode, amp-vscode-insider, amp-cursor, amp-windsurf, lm-studio, "+
219-
"goose, trae, continue)",
221+
"goose, trae, continue, opencode)",
220222
clientType)
221223
}
222224

docs/cli/thv_client_register.md

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/cli/thv_client_remove.md

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/config.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ const (
5959
Trae MCPClient = "trae"
6060
// Continue represents the Continue.dev IDE plugins.
6161
Continue MCPClient = "continue"
62+
// OpenCode represents the OpenCode editor.
63+
OpenCode MCPClient = "opencode"
6264
)
6365

6466
// Extension is extension of the client config file.
@@ -429,6 +431,21 @@ var supportedClientIntegrations = []mcpClientConfig{
429431
YAMLStorageType: YAMLStorageTypeArray,
430432
YAMLIdentifierField: "name",
431433
},
434+
{
435+
ClientType: OpenCode,
436+
Description: "OpenCode editor",
437+
SettingsFile: "opencode.json",
438+
MCPServersPathPrefix: "/mcp",
439+
RelPath: []string{".config", "opencode"},
440+
Extension: JSON,
441+
SupportedTransportTypesMap: map[types.TransportType]string{
442+
types.TransportTypeStdio: "remote", // OpenCode requires "type": "remote" for URL-based servers
443+
types.TransportTypeSSE: "remote",
444+
types.TransportTypeStreamableHTTP: "remote",
445+
},
446+
IsTransportTypeFieldSupported: true, // OpenCode requires "type": "remote" for URL-based servers
447+
MCPServersUrlLabel: "url",
448+
},
432449
}
433450

434451
// ConfigFile represents a client configuration file

0 commit comments

Comments
 (0)