Skip to content

Commit 02575fb

Browse files
committed
Add VS Code detection and MCP registration to install/uninstall
The install command detected many editors (Cursor, Zed, Gemini, etc.) but not VS Code, even though cbm_install_vscode_mcp() already existed. Add VS Code User config dir detection and wire it into both install and uninstall flows, writing to ~/.config/Code/User/mcp.json (Linux) or ~/Library/Application Support/Code/User/mcp.json (macOS).
1 parent 89970f2 commit 02575fb

2 files changed

Lines changed: 47 additions & 3 deletions

File tree

src/cli/cli.c

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ int cbm_remove_zed_mcp(const char *config_path) {
813813
/* ── Agent detection ──────────────────────────────────────────── */
814814

815815
cbm_detected_agents_t cbm_detect_agents(const char *home_dir) {
816-
cbm_detected_agents_t agents = {false, false, false, false, false, false, false, false};
816+
cbm_detected_agents_t agents = {false, false, false, false, false, false, false, false, false};
817817
if (!home_dir || !home_dir[0]) {
818818
return agents;
819819
}
@@ -874,6 +874,16 @@ cbm_detected_agents_t cbm_detect_agents(const char *home_dir) {
874874
agents.kilocode = true;
875875
}
876876

877+
/* VS Code: User config dir */
878+
#ifdef __APPLE__
879+
snprintf(path, sizeof(path), "%s/Library/Application Support/Code/User", home_dir);
880+
#else
881+
snprintf(path, sizeof(path), "%s/.config/Code/User", home_dir);
882+
#endif
883+
if (stat(path, &st) == 0 && S_ISDIR(st.st_mode)) {
884+
agents.vscode = true;
885+
}
886+
877887
return agents;
878888
}
879889

@@ -2038,8 +2048,11 @@ int cbm_cmd_install(int argc, char **argv) {
20382048
if (agents.kilocode) {
20392049
printf(" KiloCode");
20402050
}
2051+
if (agents.vscode) {
2052+
printf(" VS-Code");
2053+
}
20412054
if (!agents.claude_code && !agents.codex && !agents.gemini && !agents.zed && !agents.opencode &&
2042-
!agents.antigravity && !agents.aider && !agents.kilocode) {
2055+
!agents.antigravity && !agents.aider && !agents.kilocode && !agents.vscode) {
20432056
printf(" (none)");
20442057
}
20452058
printf("\n\n");
@@ -2200,7 +2213,23 @@ int cbm_cmd_install(int argc, char **argv) {
22002213
printf(" instructions: %s\n", instr_path);
22012214
}
22022215

2203-
/* Step 12: Ensure PATH */
2216+
/* Step 12: Install VS Code */
2217+
if (agents.vscode) {
2218+
printf("VS Code:\n");
2219+
char config_path[1024];
2220+
#ifdef __APPLE__
2221+
snprintf(config_path, sizeof(config_path),
2222+
"%s/Library/Application Support/Code/User/mcp.json", home);
2223+
#else
2224+
snprintf(config_path, sizeof(config_path), "%s/.config/Code/User/mcp.json", home);
2225+
#endif
2226+
if (!dry_run) {
2227+
cbm_install_vscode_mcp(self_path, config_path);
2228+
}
2229+
printf(" mcp: %s\n", config_path);
2230+
}
2231+
2232+
/* Step 13: Ensure PATH */
22042233
char bin_dir[1024];
22052234
snprintf(bin_dir, sizeof(bin_dir), "%s/.local/bin", home);
22062235
const char *rc = cbm_detect_shell_rc(home);
@@ -2374,6 +2403,20 @@ int cbm_cmd_uninstall(int argc, char **argv) {
23742403
printf(" removed instructions\n");
23752404
}
23762405

2406+
if (agents.vscode) {
2407+
char config_path[1024];
2408+
#ifdef __APPLE__
2409+
snprintf(config_path, sizeof(config_path),
2410+
"%s/Library/Application Support/Code/User/mcp.json", home);
2411+
#else
2412+
snprintf(config_path, sizeof(config_path), "%s/.config/Code/User/mcp.json", home);
2413+
#endif
2414+
if (!dry_run) {
2415+
cbm_remove_vscode_mcp(config_path);
2416+
}
2417+
printf("VS Code: removed MCP config entry\n");
2418+
}
2419+
23772420
/* Step 2: Remove indexes */
23782421
int index_count = 0;
23792422
const char *cache_dir = get_cache_dir(home);

src/cli/cli.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ typedef struct {
113113
bool antigravity; /* ~/.gemini/antigravity/ exists */
114114
bool aider; /* aider on PATH */
115115
bool kilocode; /* KiloCode globalStorage dir exists */
116+
bool vscode; /* VS Code User config dir exists */
116117
} cbm_detected_agents_t;
117118

118119
/* Detect which coding agents are installed.

0 commit comments

Comments
 (0)