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

Function cbm_upsert_grok_mcp

src/cli/cli.c:4525–4546  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4523}
4524
4525static int cbm_upsert_grok_mcp(const char *binary_path, const char *config_path) {
4526 if (!binary_path || !config_path) {
4527 return CLI_ERR;
4528 }
4529 char escaped[CLI_BUF_8K];
4530 if (cbm_toml_escape_basic_string(binary_path, escaped, sizeof(escaped)) != 0) {
4531 return CLI_ERR;
4532 }
4533 /* Grok spawns stdio servers with the full parent environment (verified
4534 * against grok 1.0.5), so unlike Codex (#1562) nothing has to be
4535 * forwarded: CBM_CACHE_DIR and CBM_RUNTIME_DIR reach the server as-is. */
4536 char block[CLI_BUF_8K];
4537 int written =
4538 snprintf(block, sizeof(block), GROK_CMM_SECTION "\ncommand = \"%s\"\nargs = []\n", escaped);
4539 if (written < 0 || (size_t)written >= sizeof(block) ||
4540 cbm_remove_grok_legacy_mcp(config_path) != 0) {
4541 return CLI_ERR;
4542 }
4543 return cbm_toml_upsert_managed_block(config_path, GROK_MCP_BEGIN, GROK_MCP_END, block) == 0
4544 ? CLI_OK
4545 : CLI_ERR;
4546}
4547
4548static int cbm_remove_grok_mcp_owned(const char *binary_path, const char *config_path) {
4549 (void)binary_path;

Callers

nothing calls this directly

Tested by

no test coverage detected