#!/bin/sh
set -eu

script_dir=$(
    CDPATH=''
    cd -- "$(dirname -- "$0")"
    pwd
)
repo_root=$(
    CDPATH=''
    cd -- "$script_dir/.."
    pwd
)

# Claude legitimately receives its own auth environment.  The router adapter
# does not need it, so replace the entire environment before importing Python.
if [ -d "$repo_root/src/helios" ]; then
    exec /usr/bin/env -i \
        LANG=C.UTF-8 \
        PATH=/usr/bin:/bin \
        PYTHONPATH="$repo_root/src" \
        /usr/bin/python3 -m helios.router_mcp "$@"
fi
exec /usr/bin/env -i \
    LANG=C.UTF-8 \
    PATH=/usr/bin:/bin \
    /usr/bin/python3 -m helios.router_mcp "$@"
