# Troubleshooting Guide Common issues and their solutions when using MCP Manager. ## Table of Contents - [Installation Issues](#installation-issues) - [MCP Configuration Issues](#mcp-configuration-issues) - [Profile Issues](#profile-issues) - [macOS Specific Issues](#macos-specific-issues) - [State Corruption Issues](#state-corruption-issues) ## Installation Issues ### Binary Killed on Startup (macOS) **Symptom:** ```bash $ mcp-manager [1] 12345 killed mcp-manager ``` **Cause:** macOS Gatekeeper blocking unsigned binary **Solution:** ```bash # Remove quarantine attribute xattr -d com.apple.quarantine ~/.local/bin/mcp-manager # Or rebuild using install script (handles this automatically) ./scripts/install.sh --build --local ``` **Prevention:** Our build scripts now automatically remove quarantine attributes. ### Go Build Fails **Symptom:** ``` go: module not found ``` **Solution:** ```bash go mod download go mod verify go build ``` ## MCP Configuration Issues ### "/mcp" Shows No Servers **Symptom:** Claude Code shows "No MCP servers configured" **Possible Causes:** 1. **Wrong config file location** ```bash # Check which file Claude Code is reading echo $CLAUDE_CONFIG_DIR # Default: should be empty (uses ~/.claude.json) # GLM: should be ~/.claude-glm ``` 2. **MCPs in wrong file** ```bash # Claude Code reads from .claude.json, not settings.local.json ls -lh ~/.claude.json jq '.mcpServers | keys' ~/.claude.json ``` 3. **Corrupt JSON** ```bash # Validate JSON syntax jq empty ~/.claude.json # If error, restore from backup cp ~/.claude.json.backup- ~/.claude.json ``` ### MCP Shows as Disabled But Should Be Enabled **Symptom:** MCP appears in disabled list but you want it enabled **Solution:** ```bash # Use mcp-manager to toggle it mcp-manager --profile # Navigate to the MCP, press Space to toggle ``` ### MCP Appears Twice in UI **Symptom:** Same MCP shows in both enabled and disabled lists **Cause:** Invalid state from direct JSON editing **Solution:** ```bash # Check for duplicates jq '.mcpServers | keys' ~/.claude.json jq '._mcpManagerDisabledServers | keys' ~/.claude.json # Remove from one list (use mcp-manager or careful jq) # Decide: should it be enabled or disabled? # If enabled, remove from disabled list: jq 'del(._mcpManagerDisabledServers["mcp-name"])' ~/.claude.json > tmp && mv tmp ~/.claude.json # If disabled, remove from enabled list: jq 'del(.mcpServers["mcp-name"])' ~/.claude.json > tmp && mv tmp ~/.claude.json ``` **Prevention:** Never use `jq` to add MCPs - use mcp-manager or claude CLI. ## Profile Issues ### GLM Profile Loads Default MCPs **Symptom:** Running `glm` shows default profile MCPs instead of GLM-specific ones **Cause:** `CLAUDE_CONFIG_DIR` not set in glm function **Check:** ```bash # View glm function type glm # Should include: # export CLAUDE_CONFIG_DIR="$HOME/.claude-glm" ``` **Solution:** ```bash # Edit ~/.zshrc and add to glm function: export CLAUDE_CONFIG_DIR="$HOME/.claude-glm" # Reload shell source ~/.zshrc # Test glm /mcp # Should show GLM-specific MCPs ``` ### Profile MCPs Not Isolated **Symptom:** Changes in one profile affect another profile **Cause:** Profiles sharing same `.claude.json` file **Solution:** ```bash # Verify each profile has its own file ls -la ~/.claude.json # Default ls -la ~/.claude-glm/.claude.json # GLM # Check sizes differ ls -lh ~/.claude.json ~/.claude-glm/.claude.json ``` ### Cannot Switch Profiles **Symptom:** `mcp-manager --profile glm` doesn't work **Solution:** ```bash # Ensure profile directory exists mkdir -p ~/.claude-glm # Verify mcp-manager sees it mcp-manager --profile glm --version ``` ## macOS Specific Issues ### Quarantine Attribute Keeps Coming Back **Symptom:** Have to run `xattr -d` after every rebuild **Solution:** Use install script which handles this automatically: ```bash ./scripts/install.sh --build --local ``` ### Permission Denied on /usr/local/bin **Symptom:** ``` permission denied: /usr/local/bin/mcp-manager ``` **Solution:** ```bash # Install to ~/.local/bin instead (no sudo needed) ./scripts/install.sh --build --local # Or use sudo for system-wide install sudo ./scripts/install.sh --build ``` ## State Corruption Issues ### Config File Bloated to 100+ MB **Symptom:** `.claude.json` is 100-200MB **Cause:** Normal - Claude Code stores conversation history in this file **Not a problem**, but makes manual editing dangerous: - Don't use `jq` to modify large files - Use mcp-manager which only touches MCP fields - Backups (in `~/.claude/backups/`) are small (1-30KB, MCP config only) **Optional cleanup:** ```bash # View largest fields jq '. | to_entries | map({key: .key, size: (.value | tostring | length)}) | sort_by(.size) | reverse | .[0:5]' ~/.claude.json # Usually "projects" field is huge (conversation history) # You can manually clean old projects from Claude Code UI ``` ### MCPs Lost After Edit **Symptom:** Added MCPs don't appear after manual JSON edit **Cause:** Direct `jq` editing bypassed safety mechanisms **Solution:** ```bash # Restore from backup ls -lt ~/.claude/backups/*.json | head -5 cp ~/.claude/backups/mcp-config.2025-10-03-220000.json /tmp/mcp-backup.json # Merge MCPs back jq -s '.[0] * {mcpServers: .[1].mcpServers}' ~/.claude.json /tmp/mcp-backup.json > /tmp/merged.json mv /tmp/merged.json ~/.claude.json ``` **Prevention:** Always use mcp-manager to modify configs. ### All Config Fields Disappeared **Symptom:** `.claude.json` only has mcpServers, missing other fields **Cause:** Used `jq` without preserving other fields **Solution:** ```bash # Restore from most recent backup cp ~/.claude.json.backup- ~/.claude.json # Or merge MCPs into older complete backup jq '.mcpServers = $new.mcpServers' \ ~/.claude.json.backup-complete \ --slurpfile new ~/.claude.json > /tmp/fixed.json mv /tmp/fixed.json ~/.claude.json ``` ## Backup and Recovery ### Create Manual Backup ```bash # Backup entire config cp ~/.claude.json ~/.claude.json.backup-$(date +%s) # Backup just MCPs (small) jq '{mcpServers, _mcpManagerDisabledServers}' ~/.claude.json > ~/mcp-backup.json ``` ### Restore from Backup ```bash # List available backups ls -lht ~/.claude/backups/*.json | head -10 ls -lht ~/.claude.json.backup-* | head -10 # Restore full config cp ~/.claude.json.backup- ~/.claude.json # Restore just MCPs jq -s '.[0] * {mcpServers: .[1].mcpServers, _mcpManagerDisabledServers: .[1]._mcpManagerDisabledServers}' \ ~/.claude.json \ ~/.claude/backups/mcp-config..json > /tmp/restored.json mv /tmp/restored.json ~/.claude.json ``` ### Check Backup History ```bash # View MCP changes over time for file in $(ls -t ~/.claude/backups/*.json | head -5); do echo "=== $file ===" jq '.mcpServers | keys' "$file" echo "" done ``` ## Validation ### Validate Config File ```bash # Check JSON syntax jq empty ~/.claude.json && echo "✓ Valid JSON" || echo "✗ Invalid JSON" # Check for duplicates comm -12 \ <(jq -r '.mcpServers | keys[]' ~/.claude.json | sort) \ <(jq -r '._mcpManagerDisabledServers | keys[]' ~/.claude.json | sort) # Should output nothing - any output means duplicates exist ``` ### Test MCP Loading ```bash # Default profile claude & sleep 2 # In Claude: /mcp # GLM profile glm & sleep 2 # In Claude: /mcp ``` ## Getting Help If none of these solutions work: 1. **Check logs:** ```bash # Claude Code logs tail -f ~/.claude/logs/* ``` 2. **Run doctor command:** ```bash claude /doctor ``` 3. **Create GitHub Issue:** - Include `mcp-manager --version` output - Include sanitized config (remove API keys!) - Describe steps to reproduce 4. **Emergency reset:** ```bash # Backup first! cp ~/.claude.json ~/claude-backup-emergency.json # Remove all MCPs jq '.mcpServers = {} | ._mcpManagerDisabledServers = {}' ~/.claude.json > /tmp/reset.json mv /tmp/reset.json ~/.claude.json # Re-add MCPs one by one using mcp-manager ``` --- **Remember:** The golden rule is to always use mcp-manager or Claude CLI commands - never edit `.claude.json` directly with `jq` or text editors!