A shell script to manage Claude Desktop's MCP (Model Control Protocol) profiles. This tool allows you to easily switch between different MCP configurations for Claude Desktop.
- List available MCP profiles
- Switch between different MCP profiles
- Save current configuration as a new profile
- Disable MCP configuration
- Check current MCP status
- Automatic profile directory creation
- Automatic Claude app restart when changing profiles or disabling MCP
- macOS (tested on macOS 14.0+)
- Claude Desktop installed
- Zsh shell
- Clone this repository:
git clone https://github.com/YUZongmin/claude-mcp-manager.git
cd claude-mcp-manager
- Create a
.env
file in the project root with your configuration:
# Claude Desktop Configuration Path
CLAUDE_CONFIG="/path/to/your/claude_desktop_config.json"
# Profiles Directory Path
PROFILES_DIR="/path/to/your/profiles/directory"
- Make the script executable:
chmod +x mcp.sh
- Add the script to your
.zshrc
:
source "/path/to/claude-mcp-manager/mcp.sh"
- Reload your shell configuration:
source ~/.zshrc
The script provides the following commands:
mcp ls # List all available profiles
mcp status # Show current MCP configuration status
mcp off # Disable MCP configuration and restart Claude
mcp save NAME # Save current configuration as a new profile
mcp PROFILE # Switch to specified profile and restart Claude
- First, save your current Claude configuration as a profile:
mcp save default
- List available profiles:
mcp ls
- Switch between profiles (this will automatically restart Claude):
mcp default
- Check current status:
mcp status
- Disable MCP (this will automatically restart Claude):
mcp off
The script automatically handles Claude app lifecycle:
- When switching profiles (
mcp profile_name
), Claude will restart to apply the new configuration - When disabling MCP (
mcp off
), Claude will restart with the default configuration - The restart process includes:
- Gracefully closing Claude if it's running
- Waiting for proper shutdown
- Reopening Claude with the new configuration
claude-mcp-manager/
├── mcp.sh # Main script file
├── .env # Configuration file (create this)
├── .gitignore # Git ignore file
├── README.md # This file
└── profiles/ # Directory for storing profiles (created automatically)
Create a .env
file in the project root with the following variables:
CLAUDE_CONFIG
: Path to your Claude Desktop configuration file- Default location:
~/Library/Application Support/Claude/claude_desktop_config.json
- Default location:
PROFILES_DIR
: Path to the directory where you want to store your MCP profiles- This directory will be created automatically if it doesn't exist
Profiles are stored as JSON files in the profiles/
directory. Each profile should follow the Claude Desktop configuration format:
{
"globalShortcut": "Control+Option+Space",
"mcpServers": {
// Your MCP server configurations here
}
}
-
If you get "command not found: mcp":
- Make sure you've sourced the script in your
.zshrc
- Run
source ~/.zshrc
to reload your shell configuration
- Make sure you've sourced the script in your
-
If you get "Error: .env file not found":
- Make sure you've created the
.env
file in the same directory asmcp.sh
- Check that the paths in your
.env
file are correct
- Make sure you've created the
-
If profiles aren't showing up:
- Check that the
PROFILES_DIR
path in your.env
file is correct - Make sure you've saved at least one profile using
mcp save NAME
- Check that the
-
If Claude doesn't restart properly:
- Make sure Claude is installed in your Applications folder
- Try increasing the sleep duration in the script if needed
- Check if you have sufficient permissions to control the app
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Claude Desktop team for the MCP feature
- The open-source community for inspiration and tools