#!/bin/bash
# GeoSight MCP Server - Quick Setup Script
# Run this script to set up the project quickly
set -e # Exit on error
echo "🛰️ GeoSight MCP Server - Quick Setup"
echo "====================================="
echo ""
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Function to print status
print_status() {
echo -e "${GREEN}✓${NC} $1"
}
print_warning() {
echo -e "${YELLOW}⚠${NC} $1"
}
print_error() {
echo -e "${RED}✗${NC} $1"
}
# Check Python version
echo "Checking Python version..."
PYTHON_VERSION=$(python3 --version 2>&1 | cut -d' ' -f2 | cut -d'.' -f1,2)
REQUIRED_VERSION="3.11"
if [ "$(printf '%s\n' "$REQUIRED_VERSION" "$PYTHON_VERSION" | sort -V | head -n1)" = "$REQUIRED_VERSION" ]; then
print_status "Python $PYTHON_VERSION installed"
else
print_error "Python 3.11+ required. Found: $PYTHON_VERSION"
exit 1
fi
# Check Docker
echo "Checking Docker..."
if command -v docker &> /dev/null; then
print_status "Docker installed"
else
print_warning "Docker not found. Some features may not work."
fi
# Create virtual environment
echo ""
echo "Creating virtual environment..."
if [ ! -d "venv" ]; then
python3 -m venv venv
print_status "Virtual environment created"
else
print_status "Virtual environment already exists"
fi
# Activate virtual environment
echo "Activating virtual environment..."
source venv/bin/activate
print_status "Virtual environment activated"
# Install dependencies
echo ""
echo "Installing dependencies..."
pip install --upgrade pip -q
pip install -e ".[dev]" -q
print_status "Dependencies installed"
# Create .env file if not exists
echo ""
echo "Checking environment configuration..."
if [ ! -f ".env" ]; then
cp .env.example .env
print_status "Created .env file from template"
print_warning "Please edit .env with your API credentials"
else
print_status ".env file already exists"
fi
# Create necessary directories
echo ""
echo "Creating directories..."
mkdir -p models/weights
mkdir -p data
mkdir -p logs
print_status "Directories created"
# Run quick test
echo ""
echo "Running quick test..."
python -c "
import sys
try:
from geosight.tools.geocoding import get_location_info
print('✓ GeoSight modules loaded successfully')
except Exception as e:
print(f'✗ Error loading modules: {e}')
sys.exit(1)
"
# Check if Docker services should be started
echo ""
read -p "Start Docker infrastructure services? (Redis, PostgreSQL, MinIO) [y/N] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "Starting Docker services..."
docker-compose up -d redis postgres minio
print_status "Docker services started"
echo ""
echo "Services running:"
echo " - Redis: localhost:6379"
echo " - PostgreSQL: localhost:5432"
echo " - MinIO: localhost:9000 (console: localhost:9001)"
fi
# Print next steps
echo ""
echo "====================================="
echo -e "${GREEN}🎉 Setup Complete!${NC}"
echo "====================================="
echo ""
echo "Next steps:"
echo ""
echo "1. Edit .env with your Sentinel Hub credentials (optional)"
echo " nano .env"
echo ""
echo "2. Run the MCP server:"
echo " source venv/bin/activate"
echo " python -m geosight.server"
echo ""
echo "3. Or use the CLI:"
echo " python -m geosight.cli --help"
echo ""
echo "4. Run tests:"
echo " pytest -v"
echo ""
echo "5. Start the dashboard:"
echo " cd dashboard && streamlit run app.py"
echo ""
echo "6. Configure Claude Desktop:"
echo " See README.md for configuration instructions"
echo ""
echo "For more information, see docs/IMPLEMENTATION_GUIDE.md"
echo ""