Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

fix: opencode MCP config format (#134)

Chitral Verma5743e1a1f37b
diff --git a/src/cli/cli.c b/src/cli/cli.c
index 3a953040b..f88f765e1 100644
--- a/src/cli/cli.c
+++ b/src/cli/cli.c
@@ -1314,7 +1314,11 @@ int cbm_upsert_opencode_mcp(const char *binary_path, const char *config_path) {
yyjson_mut_obj_remove_key(mcp, "codebase-memory-mcp");
yyjson_mut_val *entry = yyjson_mut_obj(mdoc);
- yyjson_mut_obj_add_str(mdoc, entry, "command", binary_path);
+ yyjson_mut_obj_add_bool(mdoc, entry, "enabled", true);
+ yyjson_mut_obj_add_str(mdoc, entry, "type", "local");
+ yyjson_mut_val *cmd_arr = yyjson_mut_arr(mdoc);
+ yyjson_mut_arr_add_str(mdoc, cmd_arr, binary_path);
+ yyjson_mut_obj_add_val(mdoc, entry, "command", cmd_arr);
yyjson_mut_obj_add_val(mdoc, mcp, "codebase-memory-mcp", entry);
int rc = write_json_file(config_path, mdoc);
diff --git a/tests/test_cli.c b/tests/test_cli.c
index 425430b7c..0e2434cc8 100644
--- a/tests/test_cli.c
+++ b/tests/test_cli.c
@@ -1570,6 +1570,11 @@ TEST(cli_upsert_opencode_mcp_fresh) {
ASSERT_NOT_NULL(data);
ASSERT(strstr(data, "codebase-memory-mcp") != NULL);
ASSERT(strstr(data, "/usr/local/bin/codebase-memory-mcp") != NULL);
+ ASSERT(strstr(data, "\"enabled\":true") != NULL || strstr(data, "\"enabled\": true") != NULL);
+ /* command must be emitted as an array, not a string */
+ ASSERT(strstr(data, "\"command\":[") != NULL || strstr(data, "\"command\": [") != NULL);
+ /* type must be explicitly set to \"local\" */
+ ASSERT(strstr(data, "\"type\":\"local\"") != NULL || strstr(data, "\"type\": \"local\"") != NULL);
test_rmdir_r(tmpdir);
PASS();