Skip to content

Commit e116ef6

Browse files
committed
Fix mcp remove hanging: add -s user scope flag
claude mcp remove without -s user prompts interactively for scope, which hangs when run from install/uninstall commands. Both registerClaudeCodeMCP (pre-cleanup remove) and deregisterMCP (uninstall) now pass -s user explicitly.
1 parent 9e06d89 commit e116ef6

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

cmd/codebase-memory-mcp/install.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,11 @@ func installSkills(cfg installConfig) {
240240
// registerClaudeCodeMCP registers the MCP server with Claude Code CLI.
241241
func registerClaudeCodeMCP(binaryPath, claudePath string, cfg installConfig) {
242242
if cfg.dryRun {
243-
fmt.Printf(" [dry-run] Would run: %s mcp remove codebase-memory-mcp\n", claudePath)
243+
fmt.Printf(" [dry-run] Would run: %s mcp remove -s user codebase-memory-mcp\n", claudePath)
244244
fmt.Printf(" [dry-run] Would run: %s mcp add --scope user codebase-memory-mcp -- %s\n", claudePath, binaryPath)
245245
} else {
246246
// Silent remove (may fail if not registered — that's fine)
247-
_ = execCLI(claudePath, "mcp", "remove", "codebase-memory-mcp")
247+
_ = execCLI(claudePath, "mcp", "remove", "-s", "user", "codebase-memory-mcp")
248248
if err := execCLI(claudePath, "mcp", "add", "--scope", "user", "codebase-memory-mcp", "--", binaryPath); err != nil {
249249
fmt.Printf(" ⚠ MCP registration failed: %v\n", err)
250250
} else {
@@ -321,9 +321,9 @@ func removeClaudeSkills(cfg installConfig) {
321321
// deregisterMCP removes the MCP server registration from a CLI.
322322
func deregisterMCP(cliPath, cliName string, cfg installConfig) {
323323
if cfg.dryRun {
324-
fmt.Printf(" [dry-run] Would run: %s mcp remove codebase-memory-mcp\n", cliPath)
324+
fmt.Printf(" [dry-run] Would run: %s mcp remove -s user codebase-memory-mcp\n", cliPath)
325325
} else {
326-
if err := execCLI(cliPath, "mcp", "remove", "codebase-memory-mcp"); err != nil {
326+
if err := execCLI(cliPath, "mcp", "remove", "-s", "user", "codebase-memory-mcp"); err != nil {
327327
fmt.Printf(" ⚠ %s MCP deregistration: %v\n", cliName, err)
328328
} else {
329329
fmt.Printf(" ✓ %s MCP server deregistered\n", cliName)

0 commit comments

Comments
 (0)