Skip to content

Commit 031d597

Browse files
authored
Fix opencode parsing failure. (#416)
1 parent 9fe7b05 commit 031d597

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

pkg/client/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ system:
204204
windows:
205205
- $USERPROFILE\.config\opencode\opencode.json
206206
yq:
207-
list: '.mcp | to_entries | map({"name": .key, "command": .value.command[0], "args": (.value.command[1:] // []), "type": "stdio"})'
207+
list: '.mcp | to_entries | map({"name": .key, "command": .value.command[0], "args": ((.value.command | .[1:]) // []), "type": "stdio"})'
208208
set: |
209209
.mcp[$NAME] = {
210210
"type": "local",

pkg/client/config_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,22 @@ func Test_yq_list(t *testing.T) {
136136
HTTPServers: []MCPServerHTTP{},
137137
},
138138
},
139+
{
140+
name: "OpenCode",
141+
cfg: config.System["opencode"],
142+
content: "list/opencode.json",
143+
result: &MCPJSONLists{
144+
STDIOServers: []MCPServerSTDIO{
145+
{
146+
Name: "MCP_DOCKER",
147+
Command: "docker",
148+
Args: []string{"mcp", "gateway", "run", "--profile", "test"},
149+
},
150+
},
151+
SSEServers: []MCPServerSSE{},
152+
HTTPServers: []MCPServerHTTP{},
153+
},
154+
},
139155
}
140156
for _, tc := range tests {
141157
t.Run(tc.name, func(t *testing.T) {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "https://opencode.ai/config.json",
3+
"mcp": {
4+
"MCP_DOCKER": {
5+
"type": "local",
6+
"command": ["docker", "mcp", "gateway", "run", "--profile", "test"],
7+
"enabled": true
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)