# Profile Management Guide ## What are Profiles? **Profiles** allow you to maintain multiple independent Claude Code configurations on the same machine. Each profile has its own: - MCP server list - Enabled/disabled state for each MCP - Settings and preferences - Backup history This is useful when you have multiple Claude Code instances with different purposes or requirements. ## Common Use Cases ### Use Case 1: Regular vs GLM Instance You might have: - **Default profile**: Full suite of MCPs for regular work - **GLM profile**: Minimal MCPs (vision, search only) to save tokens ### Use Case 2: Project-Specific Configurations Different projects need different tools: - **Web project**: MCPs for browser automation, CSS, JavaScript - **Data project**: MCPs for database, analytics, data processing - **DevOps project**: MCPs for infrastructure, deployment, monitoring ### Use Case 3: Development vs Production Separate environments: - **Development**: Experimental MCPs, testing new tools - **Production**: Stable, proven MCPs only ### Use Case 4: Personal vs Work Keep work and personal completely separate: - **Work**: Company-specific MCPs, work tools - **Personal**: Personal tools, side projects ## How Profiles Work ### Directory Structure Each profile is a separate directory: ``` ~/.claude/ # Default profile ├── settings.local.json └── *.bak # Backups ~/.claude-glm/ # GLM profile ├── settings.local.json └── *.bak # Backups ~/.claude-work/ # Work profile ├── settings.local.json └── *.bak # Backups ~/.claude-personal/ # Personal profile ├── settings.local.json └── *.bak # Backups ``` ### Environment Variable Claude Code uses the `CLAUDE_CONFIG_DIR` environment variable to determine which profile to use: ```bash # No env var set → uses ~/.claude (default) claude mcp list # Env var set → uses custom directory export CLAUDE_CONFIG_DIR=~/.claude-glm claude mcp list # Now uses ~/.claude-glm/settings.local.json ``` ## Setting Up Profiles ### Method 1: Create Profile Manually ```bash # 1. Create profile directory mkdir ~/.claude-glm # 2. Copy base config from default profile cp ~/.claude/settings.local.json ~/.claude-glm/ # 3. Edit the new config (optional) # Remove MCPs you don't want in this profile code ~/.claude-glm/settings.local.json # 4. Use the profile CLAUDE_CONFIG_DIR=~/.claude-glm mcp-manager ``` ### Method 2: Create Profile from Scratch ```bash # 1. Create profile directory mkdir ~/.claude-work # 2. Create minimal config cat > ~/.claude-work/settings.local.json << 'EOF' { "permissions": {}, "enableAllProjectMcpServers": true, "enabledMcpjsonServers": [] } EOF # 3. Launch manager and add MCPs CLAUDE_CONFIG_DIR=~/.claude-work mcp-manager # Press 'a' to add your first MCP ``` ### Method 3: Clone Existing Profile ```bash # Clone default profile to new profile cp -r ~/.claude ~/.claude-staging # Use the new profile CLAUDE_CONFIG_DIR=~/.claude-staging mcp-manager ``` ## Using Profiles ### Viewing Available Profiles In the TUI: 1. Press `p` to open Profile Switcher 2. See all available profiles with paths 3. Active profile is marked with `[ACTIVE]` ### Switching Profiles **Important**: Switching profiles requires restarting the manager. ```bash # Option 1: Set environment variable for session export CLAUDE_CONFIG_DIR=~/.claude-glm mcp-manager # Option 2: One-liner for temporary switch CLAUDE_CONFIG_DIR=~/.claude-glm mcp-manager # Option 3: Unset to return to default unset CLAUDE_CONFIG_DIR mcp-manager ``` ### Profile Indicator The active profile name is always shown at the top of the main list view: ``` ┌────────────────────────────────────────────────┐ │ ClaudeCode MCP Manager │ │ Profile: glm │ ← Active profile │ │ │ ▶ ✓ ● fetch-mcp node /path/to/server.js │ ``` ## Workflow Examples ### Workflow 1: Daily Profile Switching **Morning - Work mode:** ```bash # Set up work environment export CLAUDE_CONFIG_DIR=~/.claude-work mcp-manager # Enable only work-related MCPs # Launch Claude Code claude ``` **Evening - Personal projects:** ```bash # Switch to personal profile export CLAUDE_CONFIG_DIR=~/.claude-personal mcp-manager # Different set of MCPs enabled # Launch Claude Code claude ``` ### Workflow 2: Shell Functions for Easy Switching Add to your `~/.zshrc` or `~/.bashrc`: ```bash # Default Claude function claude-default() { unset CLAUDE_CONFIG_DIR mcp-manager } # GLM Claude function claude-glm() { export CLAUDE_CONFIG_DIR="$HOME/.claude-glm" mcp-manager } # Work Claude function claude-work() { export CLAUDE_CONFIG_DIR="$HOME/.claude-work" mcp-manager } # Personal Claude function claude-personal() { export CLAUDE_CONFIG_DIR="$HOME/.claude-personal" mcp-manager } ``` Usage: ```bash # Launch with different profiles claude-default claude-glm claude-work claude-personal ``` ### Workflow 3: Project-Specific Profiles For different project types: ```bash # Web development project export CLAUDE_CONFIG_DIR=~/.claude-web mcp-manager # Enable: browser-automation, css-tools, js-linter # Data science project export CLAUDE_CONFIG_DIR=~/.claude-data mcp-manager # Enable: jupyter, pandas-tools, data-viz # DevOps project export CLAUDE_CONFIG_DIR=~/.claude-devops mcp-manager # Enable: kubernetes, terraform, aws-cli ``` ### Workflow 4: Testing New MCPs Safely ```bash # Create testing profile cp -r ~/.claude ~/.claude-test export CLAUDE_CONFIG_DIR=~/.claude-test # Launch manager and experiment mcp-manager # Add experimental MCPs, test them # If successful, replicate to default profile # If not, just delete ~/.claude-test ``` ## Advanced Profile Management ### Syncing Profiles To keep profiles in sync (e.g., same base MCPs, different enabled states): ```bash # Script to sync MCP definitions (not enabled states) sync-profiles() { # Extract mcpServers section from default profile jq '.mcpServers' ~/.claude/settings.local.json > /tmp/mcp-servers.json # Update other profiles while preserving their enabledMcpjsonServers for profile in ~/.claude-*; do if [ -f "$profile/settings.local.json" ]; then # Backup first cp "$profile/settings.local.json" "$profile/settings.local.json.sync-backup" # Merge: new mcpServers with existing enabledMcpjsonServers jq --slurpfile mcps /tmp/mcp-servers.json \ '.mcpServers = $mcps[0]' \ "$profile/settings.local.json" > /tmp/merged.json mv /tmp/merged.json "$profile/settings.local.json" fi done } ``` ### Exporting/Importing Profiles **Export a profile:** ```bash # Create shareable backup tar -czf my-profile-backup.tar.gz -C ~/ .claude-work # Share the file # Others can import with: # tar -xzf my-profile-backup.tar.gz -C ~/ ``` **Import a profile:** ```bash # Unpack shared profile tar -xzf received-profile.tar.gz -C ~/ # Rename if needed mv ~/.claude-work ~/.claude-imported # Test it CLAUDE_CONFIG_DIR=~/.claude-imported mcp-manager ``` ### Profile Comparison Compare MCP configurations between profiles: ```bash # See which MCPs are enabled in each profile compare-profiles() { echo "=== Default Profile ===" jq -r '.enabledMcpjsonServers[]' ~/.claude/settings.local.json | sort echo "" echo "=== GLM Profile ===" jq -r '.enabledMcpjsonServers[]' ~/.claude-glm/settings.local.json | sort echo "" echo "=== Diff ===" diff \ <(jq -r '.enabledMcpjsonServers[]' ~/.claude/settings.local.json | sort) \ <(jq -r '.enabledMcpjsonServers[]' ~/.claude-glm/settings.local.json | sort) } ``` ## Profile-Specific Settings ### Example: Minimal GLM Profile For token-constrained GLM usage: ```json { "permissions": {}, "enableAllProjectMcpServers": false, "enabledMcpjsonServers": [ "fetch-mcp", "brave-search" ] } ``` Only 2 MCPs enabled to minimize context usage. ### Example: Full-Featured Work Profile For comprehensive tooling: ```json { "permissions": {}, "enableAllProjectMcpServers": true, "enabledMcpjsonServers": [ "fetch-mcp", "brave-search", "perplexity-mcp", "filesystem-mcp", "database-mcp", "git-mcp", "docker-mcp", "kubernetes-mcp" ] } ``` ### Example: Development Testing Profile For experimenting: ```json { "permissions": {}, "enableAllProjectMcpServers": true, "enabledMcpjsonServers": [ "experimental-tool", "custom-mcp-1", "custom-mcp-2" ] } ``` ## Troubleshooting ### "Profile not found" or "Config not readable" **Problem**: Profile directory or config file doesn't exist **Solution**: ```bash # Check if directory exists ls -la ~/.claude-glm # If not, create it mkdir -p ~/.claude-glm cp ~/.claude/settings.local.json ~/.claude-glm/ # Verify file exists and is readable cat ~/.claude-glm/settings.local.json ``` ### Changes in Manager Don't Affect Claude Code **Problem**: Modified profile but Claude Code still uses old config **Solution**: ```bash # Ensure Claude Code is using the same profile # Set the env var BEFORE launching Claude export CLAUDE_CONFIG_DIR=~/.claude-glm claude # Now uses the glm profile # Verify which config it's using echo $CLAUDE_CONFIG_DIR ``` ### Profile Switcher Shows No Profiles **Problem**: No `~/.claude*` directories found **Solution**: ```bash # Create at least the default profile mkdir -p ~/.claude # Initialize with minimal config cat > ~/.claude/settings.local.json << 'EOF' { "permissions": {}, "enableAllProjectMcpServers": true, "enabledMcpjsonServers": [] } EOF # Restart manager mcp-manager ``` ### Profile Name Shows "unknown" **Problem**: Active profile can't be determined **Solution**: ```bash # Check environment variable echo $CLAUDE_CONFIG_DIR # If empty, using default # If set, verify directory exists ls -la $CLAUDE_CONFIG_DIR ``` ### Backup History Not Isolated Between Profiles **Behavior**: This is correct! Each profile has its own backup directory. ```bash # Default profile backups ls ~/.claude/*.bak # GLM profile backups ls ~/.claude-glm/*.bak # They're completely separate ``` ## Best Practices ### 1. Always Backup Before Major Changes Before modifying a profile's config directly: ```bash cp ~/.claude-glm/settings.local.json ~/.claude-glm/manual-backup.json ``` ### 2. Name Profiles Descriptively Good names: - `~/.claude-glm` (GLM instance) - `~/.claude-work` (work projects) - `~/.claude-personal` (personal projects) - `~/.claude-minimal` (token-constrained) Bad names: - `~/.claude-1`, `~/.claude-2` (not descriptive) - `~/.claude-temp` (might accidentally delete) ### 3. Document Your Profiles Create a README for each profile: ```bash cat > ~/.claude-work/README.md << 'EOF' # Work Profile ## Purpose Claude Code configuration for work-related development. ## MCPs Enabled - fetch-mcp: Web research - brave-search: Search capability - database-mcp: Database access - git-mcp: Git operations ## Usage export CLAUDE_CONFIG_DIR=~/.claude-work claude EOF ``` ### 4. Use Shell Functions for Convenience See "Workflow 2" above for shell function examples. ### 5. Test New MCPs in Separate Profile Don't experiment in your main profile: ```bash # Create test profile cp -r ~/.claude ~/.claude-test # Test new MCPs CLAUDE_CONFIG_DIR=~/.claude-test mcp-manager # Add experimental MCP, test it # If good, add to main profile # If bad, delete test profile rm -rf ~/.claude-test ``` ## Profile Migration ### Migrating from Single to Multiple Profiles If you're currently using just `~/.claude`: ```bash # 1. Backup current config cp -r ~/.claude ~/.claude-backup-$(date +%Y%m%d) # 2. Keep ~/.claude as "default" # It already exists, no action needed # 3. Create additional profiles mkdir ~/.claude-glm mkdir ~/.claude-work # 4. Copy base config to each cp ~/.claude/settings.local.json ~/.claude-glm/ cp ~/.claude/settings.local.json ~/.claude-work/ # 5. Customize each profile CLAUDE_CONFIG_DIR=~/.claude-glm mcp-manager # Disable MCPs you don't need for GLM CLAUDE_CONFIG_DIR=~/.claude-work mcp-manager # Enable work-specific MCPs # 6. Set up shell functions (see "Workflow 2") ``` ## Integration with Claude Code ### Launching Claude Code with Specific Profile ```bash # Set profile BEFORE launching Claude export CLAUDE_CONFIG_DIR=~/.claude-glm claude # Or one-liner CLAUDE_CONFIG_DIR=~/.claude-glm claude ``` ### GLM Function Integration If you have a `glm` function in your shell config: ```bash # ~/.zshrc or ~/.bashrc glm() { # Set GLM-specific env vars export CLAUDE_CONFIG_DIR="$HOME/.claude-glm" export ANTHROPIC_API_KEY="your-glm-key" export ANTHROPIC_COMPLETION_MODEL="glm-model-name" # Launch Claude claude "$@" # Clean up (optional) unset CLAUDE_CONFIG_DIR } ``` ## FAQ **Q: Can I have unlimited profiles?** A: Yes! Create as many `~/.claude-*` directories as you need. **Q: Do profiles share MCP server definitions?** A: No, each profile has its own `mcpServers` section in settings.local.json. You must add MCPs to each profile individually (or copy configs). **Q: Will changing profiles affect my running Claude instance?** A: No, Claude Code reads the config when it starts. Restart Claude to pick up profile changes. **Q: Can I rename a profile?** A: Yes, just rename the directory: ```bash mv ~/.claude-old-name ~/.claude-new-name ``` **Q: How do I delete a profile?** A: Simply delete the directory: ```bash rm -rf ~/.claude-unwanted ``` **Q: Can profiles share backups?** A: No, each profile maintains its own backup history in its directory. **Q: What's the default profile?** A: `~/.claude` when `CLAUDE_CONFIG_DIR` is not set. ## Summary Profiles give you powerful flexibility to: - Maintain different MCP configurations - Optimize for different use cases (work, personal, testing) - Save context tokens by using minimal profiles when needed - Safely experiment without affecting your main config The key is the `CLAUDE_CONFIG_DIR` environment variable - it tells Claude Code (and the MCP Manager) which config to use. **Quick Reference Card:** ```bash # List profiles ls -d ~/.claude* # Use specific profile export CLAUDE_CONFIG_DIR=~/.claude-PROFILENAME mcp-manager # Return to default unset CLAUDE_CONFIG_DIR mcp-manager # View profile in manager # Press 'p' in the TUI ``` Happy profiling! 👤