#!/usr/bin/env bash
set -e

cd "$(dirname "$0")"

# Sekrety poza repo (OPENAI_API_KEY itp.)
ENV_FILE=/root/.secrets/user_mcp.env
if [ -f "$ENV_FILE" ]; then
  set -a
  . "$ENV_FILE"
  set +a
else
  echo "Brak pliku z sekretami: $ENV_FILE" >&2
  exit 1
fi

if [ ! -d ".venv" ]; then
  python3 -m venv .venv
fi

.venv/bin/pip install -r requirements.txt -q
exec .venv/bin/python user_mcp.py
