{#- Context variables: none needed — this is a standalone setup script -#}
#!/usr/bin/env bash
# Auto-install the Databricks AI Dev Kit MCP server if not present.
# Called by .claude/settings.json SessionStart hook on every Claude Code session.
set -euo pipefail

KIT_DIR="$HOME/.ai-dev-kit"
VENV_PYTHON="$KIT_DIR/.venv/bin/python"
SERVER_SCRIPT="$KIT_DIR/repo/databricks-mcp-server/run_server.py"

if [ -f "$VENV_PYTHON" ] && [ -f "$SERVER_SCRIPT" ]; then
  exit 0  # Already installed
fi

echo "Databricks MCP server not found. Installing..." >&2
bash <(curl -sL https://raw.githubusercontent.com/databricks-solutions/ai-dev-kit/main/install.sh)
echo "MCP server installed." >&2
