Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ int main(int argc, char **argv) {
* below opens sqlite early), else sqlite3_config returns SQLITE_MISUSE and
* the bind is silently ignored. No-op in the test build. */
cbm_alloc_init();
cbm_cli_set_version(CBM_VERSION);
cbm_profile_init(); /* reads CBM_PROFILE env var, gates all prof macros */
/* CBM_LOG_LEVEL support — distilled from #414 (closes #413). Apply before
* the first log statement so the configured level governs all output. */
Expand Down
2 changes: 1 addition & 1 deletion src/mcp/mcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ char *cbm_mcp_initialize_response(const char *params_json) {

yyjson_mut_val *impl = yyjson_mut_obj(doc);
yyjson_mut_obj_add_str(doc, impl, "name", "codebase-memory-mcp");
yyjson_mut_obj_add_str(doc, impl, "version", "0.10.0");
yyjson_mut_obj_add_str(doc, impl, "version", cbm_cli_get_version());
yyjson_mut_obj_add_val(doc, root, "serverInfo", impl);

yyjson_mut_val *caps = yyjson_mut_obj(doc);
Expand Down
5 changes: 5 additions & 0 deletions tests/test_mcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "../src/foundation/compat_fs.h" /* cbm_unlink / cbm_rmdir */
#include "../src/foundation/log.h"
#include "test_framework.h"
#include <cli/cli.h>
#include <mcp/mcp.h>
#include <store/store.h>
#include <yyjson/yyjson.h>
Expand Down Expand Up @@ -146,10 +147,13 @@ TEST(jsonrpc_format_error) {
* ══════════════════════════════════════════════════════════════════ */

TEST(mcp_initialize_response) {
cbm_cli_set_version("9.8.7-test");

/* Default (no params): returns latest supported version */
char *json = cbm_mcp_initialize_response(NULL);
ASSERT_NOT_NULL(json);
ASSERT_NOT_NULL(strstr(json, "codebase-memory-mcp"));
ASSERT_NOT_NULL(strstr(json, "\"version\":\"9.8.7-test\""));
ASSERT_NOT_NULL(strstr(json, "capabilities"));
ASSERT_NOT_NULL(strstr(json, "tools"));
ASSERT_NOT_NULL(strstr(json, "\"listChanged\":false"));
Expand All @@ -172,6 +176,7 @@ TEST(mcp_initialize_response) {
ASSERT_NOT_NULL(json);
ASSERT_NOT_NULL(strstr(json, "2025-11-25"));
free(json);
cbm_cli_set_version("dev");
PASS();
}

Expand Down
Loading