#!/bin/bash set -e # ai.card MCP server startup script # Configuration CARD_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" API_DIR="$CARD_DIR/api" VENV_DIR="$HOME/.config/syui/ai/card/venv" PYTHON="$VENV_DIR/bin/python" # Default settings HOST="${HOST:-localhost}" PORT="${PORT:-8000}" RELOAD="${RELOAD:-true}" echo "🎴 Starting ai.card MCP Server" echo "================================" echo "Directory: $API_DIR" echo "Python: $PYTHON" echo "Host: $HOST" echo "Port: $PORT" echo "Reload: $RELOAD" echo # Check virtual environment if [ ! -f "$PYTHON" ]; then echo "❌ Error: Virtual environment not found at $VENV_DIR" echo "Please run ./setup_venv.sh first" exit 1 fi # Change to API directory cd "$API_DIR" # Start server if [ "$RELOAD" = "true" ]; then echo "🚀 Starting server with auto-reload..." exec "$PYTHON" -m uvicorn app.main:app --host "$HOST" --port "$PORT" --reload else echo "🚀 Starting server..." exec "$PYTHON" -m uvicorn app.main:app --host "$HOST" --port "$PORT" fi