| 1079 | } |
| 1080 | |
| 1081 | int cbm_remove_zed_mcp(const char *config_path) { |
| 1082 | if (!config_path) { |
| 1083 | return CLI_ERR; |
| 1084 | } |
| 1085 | |
| 1086 | yyjson_doc *doc = read_json_file(config_path); |
| 1087 | if (!doc) { |
| 1088 | return CLI_ERR; |
| 1089 | } |
| 1090 | |
| 1091 | yyjson_mut_doc *mdoc = yyjson_mut_doc_new(NULL); |
| 1092 | yyjson_mut_val *root = yyjson_val_mut_copy(mdoc, yyjson_doc_get_root(doc)); |
| 1093 | yyjson_doc_free(doc); |
| 1094 | if (!root) { |
| 1095 | yyjson_mut_doc_free(mdoc); |
| 1096 | return CLI_ERR; |
| 1097 | } |
| 1098 | yyjson_mut_doc_set_root(mdoc, root); |
| 1099 | |
| 1100 | yyjson_mut_val *servers = yyjson_mut_obj_get(root, "context_servers"); |
| 1101 | if (!servers || !yyjson_mut_is_obj(servers)) { |
| 1102 | yyjson_mut_doc_free(mdoc); |
| 1103 | return 0; |
| 1104 | } |
| 1105 | |
| 1106 | yyjson_mut_obj_remove_key(servers, "codebase-memory-mcp"); |
| 1107 | |
| 1108 | int rc = write_json_file(config_path, mdoc); |
| 1109 | yyjson_mut_doc_free(mdoc); |
| 1110 | return rc; |
| 1111 | } |
| 1112 | |
| 1113 | /* ── Agent detection ──────────────────────────────────────────── */ |
| 1114 |
no test coverage detected