#!/bin/bash
# Galaxy Brain MCP - Bash Installation Script
# Think. Do. Done.
#
# Usage:
# ./install.sh # Full installation
# ./install.sh --skip-claude # Skip Claude Desktop config
# ./install.sh --dev # Development installation
set -e
# Colors
MAGENTA='\033[0;35m'
GREEN='\033[0;32m'
CYAN='\033[0;36m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
galaxy() { echo -e "${MAGENTA}$1${NC}"; }
success() { echo -e "${GREEN}[OK]${NC} $1"; }
info() { echo -e "${CYAN}[..]${NC} $1"; }
warn() { echo -e "${YELLOW}[!!]${NC} $1"; }
fail() { echo -e "${RED}[XX]${NC} $1"; }
# Parse arguments
SKIP_CLAUDE=false
DEV_MODE=false
SHOW_HELP=false
while [[ $# -gt 0 ]]; do
case $1 in
--skip-claude) SKIP_CLAUDE=true; shift ;;
--dev) DEV_MODE=true; shift ;;
--help|-h) SHOW_HELP=true; shift ;;
*) shift ;;
esac
done
# Banner
show_banner() {
galaxy "
============================================
GALAXY BRAIN MCP INSTALLER
============================================
Think. Do. Done.
Sequential Thinking + Sequential Doing
= Complete Cognitive Loop
============================================
"
}
# Help
if [ "$SHOW_HELP" = true ]; then
show_banner
echo "Usage: ./install.sh [options]"
echo ""
echo "Options:"
echo " --skip-claude Skip Claude Desktop configuration"
echo " --dev Install in development mode (editable)"
echo " --help, -h Show this help message"
echo ""
echo "Examples:"
echo " ./install.sh # Full installation"
echo " ./install.sh --dev # Development mode"
echo " ./install.sh --skip-claude # Skip Claude Desktop setup"
exit 0
fi
show_banner
# Check Python
info "Checking Python installation..."
if command -v python3 &> /dev/null; then
PYTHON_CMD="python3"
elif command -v python &> /dev/null; then
PYTHON_CMD="python"
else
fail "Python not found. Please install Python 3.10+"
exit 1
fi
PYTHON_VERSION=$($PYTHON_CMD --version 2>&1)
if [[ $PYTHON_VERSION =~ Python\ 3\.([0-9]+) ]]; then
MINOR=${BASH_REMATCH[1]}
if [ "$MINOR" -ge 10 ]; then
success "$PYTHON_VERSION"
else
fail "Python 3.10+ required (found: $PYTHON_VERSION)"
exit 1
fi
fi
# Check pip
info "Checking pip..."
if $PYTHON_CMD -m pip --version &> /dev/null; then
success "pip found"
else
fail "pip not found"
exit 1
fi
# Get script directory
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
info "Project directory: $PROJECT_DIR"
# Install package
info "Installing Galaxy Brain..."
cd "$PROJECT_DIR"
if [ "$DEV_MODE" = true ]; then
info "Installing in development mode..."
$PYTHON_CMD -m pip install -e ".[dev]" > /dev/null 2>&1
else
$PYTHON_CMD -m pip install . > /dev/null 2>&1
fi
success "Galaxy Brain installed"
# Verify installation
info "Verifying installation..."
VERSION=$($PYTHON_CMD -c "import galaxy_brain; print(galaxy_brain.__version__)" 2>/dev/null || echo "unknown")
success "Galaxy Brain v$VERSION installed"
# Configure Claude Desktop (unless skipped)
if [ "$SKIP_CLAUDE" = false ]; then
info "Configuring Claude Desktop..."
# Determine config location based on OS
if [[ "$OSTYPE" == "darwin"* ]]; then
CLAUDE_CONFIG_DIR="$HOME/Library/Application Support/Claude"
else
CLAUDE_CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/Claude"
fi
CLAUDE_CONFIG_FILE="$CLAUDE_CONFIG_DIR/claude_desktop_config.json"
# Ensure directory exists
mkdir -p "$CLAUDE_CONFIG_DIR"
# Get Python path
PYTHON_PATH=$(which $PYTHON_CMD)
# Create or update config
if [ -f "$CLAUDE_CONFIG_FILE" ]; then
# Update existing config using Python
$PYTHON_CMD << EOF
import json
import sys
config_file = "$CLAUDE_CONFIG_FILE"
python_path = "$PYTHON_PATH"
try:
with open(config_file, 'r') as f:
config = json.load(f)
except:
config = {}
if 'mcpServers' not in config:
config['mcpServers'] = {}
config['mcpServers']['galaxy-brain'] = {
'command': python_path,
'args': ['-m', 'galaxy_brain.server']
}
with open(config_file, 'w') as f:
json.dump(config, f, indent=2)
print("Config updated")
EOF
else
# Create new config
cat > "$CLAUDE_CONFIG_FILE" << EOF
{
"mcpServers": {
"galaxy-brain": {
"command": "$PYTHON_PATH",
"args": ["-m", "galaxy_brain.server"]
}
}
}
EOF
fi
success "Claude Desktop configured"
info "Config location: $CLAUDE_CONFIG_FILE"
fi
# Done
galaxy "
============================================
INSTALLATION COMPLETE!
============================================
Galaxy Brain is ready to think and do.
Quick Start:
1. Restart Claude Desktop
2. Use these tools:
- start_thinking: Begin reasoning
- think: Add thoughts
- execute_batch: Run operations
- think_and_do: Complete loop
Example:
think_and_do({
problem: \"What files are in this directory?\",
thoughts: [
\"I need to list directory contents\",
\"I'll use the shell service\"
],
operations: [{
service: \"shell\",
method: \"run\",
params: { command: \"ls -la\" }
}]
})
Think. Do. Done.
============================================
"