Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

fix(install): detect Cursor IDE and register MCP config (#222)

Martin Vogelf88d0315ac73
diff --git a/src/cli/cli.c b/src/cli/cli.c
index d37ac4281..37ba6d886 100644
--- a/src/cli/cli.c
+++ b/src/cli/cli.c
@@ -1088,6 +1088,10 @@ cbm_detected_agents_t cbm_detect_agents(const char *home_dir) {
#endif
agents.vscode = dir_exists(path);
+ /* Cursor stores its user MCP config in ~/.cursor/mcp.json on all platforms. */
+ snprintf(path, sizeof(path), "%s/.cursor", home_dir);
+ agents.cursor = dir_exists(path);
+
snprintf(path, sizeof(path), "%s/.openclaw", home_dir);
agents.openclaw = dir_exists(path);
@@ -2734,6 +2738,7 @@ static void print_detected_agents(const cbm_detected_agents_t *a) {
{a->aider, "Aider"},
{a->kilocode, "KiloCode"},
{a->vscode, "VS-Code"},
+ {a->cursor, "Cursor"},
{a->openclaw, "OpenClaw"},
{a->kiro, "Kiro"},
};
@@ -2924,6 +2929,12 @@ static void install_editor_agent_configs(const cbm_detected_agents_t *agents, co
install_generic_agent_config("VS Code", binary_path, cp, NULL, dry_run,
cbm_install_vscode_mcp);
}
+ if (agents->cursor) {
+ char cp[CLI_BUF_1K];
+ snprintf(cp, sizeof(cp), "%s/.cursor/mcp.json", home);
+ install_generic_agent_config("Cursor", binary_path, cp, NULL, dry_run,
+ cbm_install_editor_mcp);
+ }
if (agents->openclaw) {
char cp[CLI_BUF_1K];
snprintf(cp, sizeof(cp), "%s/.openclaw/openclaw.json", home);
@@ -3244,6 +3255,12 @@ static void uninstall_editor_agents(const cbm_detected_agents_t *agents, const c
uninstall_agent_mcp_instr((mcp_uninstall_args_t){"VS Code", cp, NULL}, dry_run,
cbm_remove_vscode_mcp);
}
+ if (agents->cursor) {
+ char cp[CLI_BUF_1K];
+ snprintf(cp, sizeof(cp), "%s/.cursor/mcp.json", home);
+ uninstall_agent_mcp_instr((mcp_uninstall_args_t){"Cursor", cp, NULL}, dry_run,
+ cbm_remove_editor_mcp);
+ }
if (agents->openclaw) {
char cp[CLI_BUF_1K];
snprintf(cp, sizeof(cp), "%s/.openclaw/openclaw.json", home);
diff --git a/src/cli/cli.h b/src/cli/cli.h
index b2c740313..30314814a 100644
--- a/src/cli/cli.h
+++ b/src/cli/cli.h
@@ -119,6 +119,7 @@ typedef struct {
bool aider; /* aider on PATH */
bool kilocode; /* KiloCode globalStorage dir exists */
bool vscode; /* VS Code User config dir exists */
+ bool cursor; /* ~/.cursor/ exists */
bool openclaw; /* ~/.openclaw/ exists */
bool kiro; /* ~/.kiro/ exists */
} cbm_detected_agents_t;
diff --git a/tests/test_cli.c b/tests/test_cli.c
index 1c378c517..aa7f273eb 100644
--- a/tests/test_cli.c
+++ b/tests/test_cli.c
@@ -1453,6 +1453,25 @@ TEST(cli_detect_agents_finds_codex) {
PASS();
}
+/* issue #222: Cursor (~/.cursor/) must be detected so install/update registers
+ * the MCP server in ~/.cursor/mcp.json — previously it was never discovered. */
+TEST(cli_detect_agents_finds_cursor_issue222) {
+ char tmpdir[256];
+ snprintf(tmpdir, sizeof(tmpdir), "/tmp/cli-detect-XXXXXX");
+ if (!cbm_mkdtemp(tmpdir))
+ SKIP("cbm_mkdtemp failed");
+
+ char dir[512];
+ snprintf(dir, sizeof(dir), "%s/.cursor", tmpdir);
+ test_mkdirp(dir);
+
+ cbm_detected_agents_t agents = cbm_detect_agents(tmpdir);
+ ASSERT_TRUE(agents.cursor);
+
+ test_rmdir_r(tmpdir);
+ PASS();
+}
+
TEST(cli_detect_agents_finds_gemini) {
char tmpdir[256];
snprintf(tmpdir, sizeof(tmpdir), "/tmp/cli-detect-XXXXXX");
@@ -1522,8 +1541,8 @@ TEST(cli_detect_agents_finds_kilocode) {
snprintf(dir, sizeof(dir),
"%s/Library/Application Support/Code/User/globalStorage/kilocode.kilo-code", tmpdir);
#elif defined(_WIN32)
- snprintf(dir, sizeof(dir),
- "%s/AppData/Roaming/Code/User/globalStorage/kilocode.kilo-code", tmpdir);
+ snprintf(dir, sizeof(dir), "%s/AppData/Roaming/Code/User/globalStorage/kilocode.kilo-code",
+ tmpdir);
#else
snprintf(dir, sizeof(dir), "%s/.config/Code/User/globalStorage/kilocode.kilo-code", tmpdir);
#endif
@@ -2496,6 +2515,7 @@ SUITE(cli) {
RUN_TEST(cli_detect_agents_finds_claude);
RUN_TEST(cli_detect_agents_finds_claude_via_env);
RUN_TEST(cli_detect_agents_finds_codex);
+ RUN_TEST(cli_detect_agents_finds_cursor_issue222);
RUN_TEST(cli_detect_agents_finds_gemini);
RUN_TEST(cli_detect_agents_finds_zed);
RUN_TEST(cli_detect_agents_finds_antigravity);