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

Function cbm_remove_openclaw_mcp

src/cli/cli.c:921–957  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

919}
920
921int cbm_remove_openclaw_mcp(const char *config_path) {
922 if (!config_path) {
923 return CLI_ERR;
924 }
925
926 yyjson_doc *doc = read_json_file(config_path);
927 if (!doc) {
928 return CLI_ERR;
929 }
930
931 yyjson_mut_doc *mdoc = yyjson_mut_doc_new(NULL);
932 yyjson_mut_val *root = yyjson_val_mut_copy(mdoc, yyjson_doc_get_root(doc));
933 yyjson_doc_free(doc);
934 if (!root) {
935 yyjson_mut_doc_free(mdoc);
936 return CLI_ERR;
937 }
938 yyjson_mut_doc_set_root(mdoc, root);
939
940 yyjson_mut_val *mcp = yyjson_mut_obj_get(root, "mcp");
941 if (!mcp || !yyjson_mut_is_obj(mcp)) {
942 yyjson_mut_doc_free(mdoc);
943 return 0;
944 }
945
946 yyjson_mut_val *servers = yyjson_mut_obj_get(mcp, "servers");
947 if (!servers || !yyjson_mut_is_obj(servers)) {
948 yyjson_mut_doc_free(mdoc);
949 return 0;
950 }
951
952 yyjson_mut_obj_remove_key(servers, "codebase-memory-mcp");
953
954 int rc = write_json_file(config_path, mdoc);
955 yyjson_mut_doc_free(mdoc);
956 return rc;
957}
958
959/* ── VS Code MCP (servers key with type:stdio) ────────────────── */
960

Callers 1

test_cli.cFile · 0.85

Calls 2

read_json_fileFunction · 0.85
write_json_fileFunction · 0.85

Tested by

no test coverage detected