The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
mcpconnect: prefer opencode.json when both OpenCode configs exist
Claude9e36d4b5816b
diff --git a/cli/beacon/internal/mcpconnect/harness_test.go b/cli/beacon/internal/mcpconnect/harness_test.goindex c71af122..29ff564f 100644--- a/cli/beacon/internal/mcpconnect/harness_test.go+++ b/cli/beacon/internal/mcpconnect/harness_test.go@@ -735,8 +735,14 @@ func TestOpenCodePrefersAnExistingConfigFile(t *testing.T) {t.Fatalf("path = %s, want the existing opencode.json", got)}writeFile(t, filepath.Join(dir, "opencode.jsonc"), "{}\n")+ if got := targetPath(t, target, home); got != filepath.Join(dir, "opencode.json") {+ t.Fatalf("path = %s, want opencode.json when both exist, as `opencode mcp add` chooses", got)+ }+ if err := os.Remove(filepath.Join(dir, "opencode.json")); err != nil {+ t.Fatal(err)+ }if got := targetPath(t, target, home); got != filepath.Join(dir, "opencode.jsonc") {- t.Fatalf("path = %s, want opencode.jsonc when both exist", got)+ t.Fatalf("path = %s, want the existing opencode.jsonc", got)}t.Setenv("XDG_CONFIG_HOME", filepath.Join(home, "xdg"))if got := targetPath(t, target, home); got != filepath.Join(home, "xdg", "opencode", "opencode.jsonc") {diff --git a/cli/beacon/internal/mcpconnect/targets.go b/cli/beacon/internal/mcpconnect/targets.goindex f66e5f0a..134e122f 100644--- a/cli/beacon/internal/mcpconnect/targets.go+++ b/cli/beacon/internal/mcpconnect/targets.go@@ -299,14 +299,15 @@ func vscodeMCPPath(string) (string, error) {}// opencodeConfigPath picks the global config OpenCode's own `opencode mcp add` writes to: an-// existing opencode.jsonc, else an existing opencode.json, else a new opencode.jsonc.+// existing opencode.json, else an existing opencode.jsonc, else a new opencode.jsonc. (Checked+// against opencode 1.18: with both files present it writes opencode.json.)func opencodeConfigPath(home string) (string, error) {base := strings.TrimSpace(os.Getenv("XDG_CONFIG_HOME"))if base == "" {base = filepath.Join(home, ".config")}dir := filepath.Join(base, "opencode")- for _, name := range []string{"opencode.jsonc", "opencode.json"} {+ for _, name := range []string{"opencode.json", "opencode.jsonc"} {if info, err := os.Stat(filepath.Join(dir, name)); err == nil && !info.IsDir() {return filepath.Join(dir, name), nil}