MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_junie_mcp_preflight

Function cbm_junie_mcp_preflight

src/cli/cli.c:4366–4400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4364/* ── Junie MCP config (JSON, same mcpServers format) ──────────── */
4365
4366static int cbm_junie_mcp_preflight(const char *binary_path, const char *config_path) {
4367 static const char *const path[] = {"mcpServers"};
4368 static const struct {
4369 const char *name;
4370 const char *argument;
4371 } entries[] = {
4372 {CBM_DEFAULT_MCP_SERVER_NAME, NULL},
4373 {CBM_SCOUT_MCP_SERVER_NAME, CBM_SCOUT_PROFILE_ARGUMENT},
4374 {CBM_ANALYSIS_MCP_SERVER_NAME, CBM_ANALYSIS_PROFILE_ARGUMENT},
4375 };
4376 char *document = NULL;
4377 size_t document_length = 0U;
4378 int read_result = cbm_json_like_read_document(config_path, &document, &document_length);
4379 if (read_result == 1) {
4380 free(document);
4381 return CLI_OK;
4382 }
4383 if (read_result < 0) {
4384 free(document);
4385 return CLI_ERR;
4386 }
4387 int result = CLI_OK;
4388 for (size_t i = 0U; i < sizeof(entries) / sizeof(entries[0]); i++) {
4389 int ownership = cbm_json_mcp_snapshot_ownership(
4390 document, document_length, path, 1U, CBM_JSON_MCP_STANDARD, entries[i].name,
4391 entries[i].argument, binary_path, g_previous_managed_mcp_command, NULL);
4392 if (ownership != CBM_JSON_LIKE_OBJECT_MATCH && ownership != CBM_JSON_LIKE_OBJECT_MISSING &&
4393 ownership != CBM_JSON_MCP_OWNERSHIP_STALE) {
4394 result = CLI_ERR;
4395 break;
4396 }
4397 }
4398 free(document);
4399 return result;
4400}
4401
4402int cbm_upsert_junie_mcp(const char *binary_path, const char *config_path) {
4403 static const char *const path[] = {"mcpServers"};

Callers 1

cbm_upsert_junie_mcpFunction · 0.85

Calls 2

Tested by

no test coverage detected