#!/usr/bin/env bash
# Wrapper that AI clients (Claude Code, Cursor, Codex, …) point at.
# Executes the MCP server from the bundled virtualenv without requiring
# that venv to be activated in the calling shell.

set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
INSTALL_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
VENV_PY="$INSTALL_DIR/.venv/bin/python"

if [ ! -x "$VENV_PY" ]; then
    echo "godot-mcp: virtualenv missing at $INSTALL_DIR/.venv. Re-run install.sh." >&2
    exit 127
fi

exec "$VENV_PY" -m godot_mcp.server "$@"
