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

Function cbm_junie_mcp_preflight

src/cli/cli.c:3921–3955  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3919/* ── Junie MCP config (JSON, same mcpServers format) ──────────── */
3920
3921static int cbm_junie_mcp_preflight(const char *binary_path, const char *config_path) {
3922 static const char *const path[] = {"mcpServers"};
3923 static const struct {
3924 const char *name;
3925 const char *argument;
3926 } entries[] = {
3927 {CBM_DEFAULT_MCP_SERVER_NAME, NULL},
3928 {CBM_SCOUT_MCP_SERVER_NAME, CBM_SCOUT_PROFILE_ARGUMENT},
3929 {CBM_ANALYSIS_MCP_SERVER_NAME, CBM_ANALYSIS_PROFILE_ARGUMENT},
3930 };
3931 char *document = NULL;
3932 size_t document_length = 0U;
3933 int read_result = cbm_json_like_read_document(config_path, &document, &document_length);
3934 if (read_result == 1) {
3935 free(document);
3936 return CLI_OK;
3937 }
3938 if (read_result < 0) {
3939 free(document);
3940 return CLI_ERR;
3941 }
3942 int result = CLI_OK;
3943 for (size_t i = 0U; i < sizeof(entries) / sizeof(entries[0]); i++) {
3944 int ownership = cbm_json_mcp_snapshot_ownership(
3945 document, document_length, path, 1U, CBM_JSON_MCP_STANDARD, entries[i].name,
3946 entries[i].argument, binary_path, g_previous_managed_mcp_command, NULL);
3947 if (ownership != CBM_JSON_LIKE_OBJECT_MATCH && ownership != CBM_JSON_LIKE_OBJECT_MISSING &&
3948 ownership != CBM_JSON_MCP_OWNERSHIP_STALE) {
3949 result = CLI_ERR;
3950 break;
3951 }
3952 }
3953 free(document);
3954 return result;
3955}
3956
3957int cbm_upsert_junie_mcp(const char *binary_path, const char *config_path) {
3958 static const char *const path[] = {"mcpServers"};

Callers 1

cbm_upsert_junie_mcpFunction · 0.85

Calls 2

Tested by

no test coverage detected