Skip to content

install -y writes wrong binary path on Windows (hardcoded ~/.local/bin/ vs actual location) #158

@slvnlrt

Description

@slvnlrt

Bug

cbm_cmd_install() hardcodes ~/.local/bin/codebase-memory-mcp.exe as the binary path written into agent MCP configs (.mcp.json, settings.json, etc.).

When installed via install.ps1 — which places the binary in $LOCALAPPDATA/Programs/codebase-memory-mcp/ — all agent configs point to a path that doesn't exist. MCP server fails to start for every agent.

Reproduction

# Fresh Windows install via install.ps1
irm https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.ps1 | iex

# Binary installed at:
#   C:/Users/<user>/AppData/Local/Programs/codebase-memory-mcp/codebase-memory-mcp.exe

# But ~/.claude/.mcp.json contains:
#   "command": "C:/Users/<user>/.local/bin/codebase-memory-mcp.exe"

# That file does NOT exist → MCP server fails to start
PS> Test-Path "$env:USERPROFILE\.local\bin\codebase-memory-mcp.exe"
False

Root cause

In src/cli/cli.c, cbm_cmd_install() constructs self_path with a hardcoded path:

/* Step 2: Binary path */
char self_path[1024];
#ifdef _WIN32
snprintf(self_path, sizeof(self_path), "%s/.local/bin/codebase-memory-mcp.exe", home);
#else
snprintf(self_path, sizeof(self_path), "%s/.local/bin/codebase-memory-mcp", home);
#endif

This works when the binary is installed via the native C update flow (which targets ~/.local/bin/), but not when installed via install.ps1 (which targets $LOCALAPPDATA/Programs/).

Suggested fix

Use runtime binary path detection — the same pattern already used in http_server.c:index_thread_fn() (line 594):

  • Windows: GetModuleFileNameA(NULL, self_path, sizeof(self_path))
  • macOS: _NSGetExecutablePath()
  • Linux: readlink("/proc/self/exe", ...)

Fall back to the current ~/.local/bin/ assumption if runtime detection fails.

Environment

  • Windows 11 Pro
  • codebase-memory-mcp 0.5.7 (installed via install.ps1 --ui)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingeditor/integrationEditor compatibility and CLI integration

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions