learning_ai_invt_trdg/scripts/mcp/alpaca-mcp-server.sh

35 lines
829 B
Bash

#!/usr/bin/env zsh
set -euo pipefail
if [[ "${1:-}" == "--doctor" ]]; then
if command -v uvx >/dev/null 2>&1; then
echo "ok: uvx available ($(command -v uvx))"
exit 0
fi
if command -v uv >/dev/null 2>&1; then
echo "ok: uv available ($(command -v uv))"
exit 0
fi
if command -v pipx >/dev/null 2>&1; then
echo "ok: pipx fallback available ($(command -v pipx))"
exit 0
fi
echo "error: install uv or pipx before starting the Alpaca MCP server" >&2
exit 127
fi
if command -v uvx >/dev/null 2>&1; then
exec uvx alpaca-mcp-server "$@"
fi
if command -v uv >/dev/null 2>&1; then
exec uv tool run alpaca-mcp-server "$@"
fi
if command -v pipx >/dev/null 2>&1; then
exec pipx run alpaca-mcp-server "$@"
fi
echo "error: install uv or pipx before starting the Alpaca MCP server" >&2
exit 127