unraid-mcp/entrypoint.sh
Jacob Magar 86bb5ac6f8 fix: address remaining PR review comments
- docker-compose: align network default fallback (jakenet) so service
  reference matches the network name: key value
- entrypoint: match server-side boolean parsing for DISABLE_HTTP_AUTH
  (accept true/1/yes, consistent with settings.py)
- ensure-ignore-files: deduplicate pattern list by driving awk from
  the REQUIRED shell array via a | -separated -v argument
- sync-env: use grep -qE for ERE .+ instead of BRE .\+ (non-POSIX)
2026-04-01 02:03:15 -04:00

33 lines
938 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
# Validate required environment variables before starting the server
required_vars=(
UNRAID_API_URL
UNRAID_API_KEY
)
# UNRAID_MCP_BEARER_TOKEN is only required for HTTP-based transports with auth enabled
_transport="${UNRAID_MCP_TRANSPORT:-streamable-http}"
_disable_auth="${UNRAID_MCP_DISABLE_HTTP_AUTH:-false}"
if [[ "$_transport" != "stdio" && "$_disable_auth" != "true" && "$_disable_auth" != "1" && "$_disable_auth" != "yes" ]]; then
required_vars+=(UNRAID_MCP_BEARER_TOKEN)
fi
missing=()
for var in "${required_vars[@]}"; do
if [ -z "${!var:-}" ]; then
missing+=("$var")
fi
done
if [ "${#missing[@]}" -gt 0 ]; then
echo "entrypoint: ERROR — required environment variables not set:" >&2
for v in "${missing[@]}"; do
echo " $v" >&2
done
exit 1
fi
# Hand off to server — exec replaces this process so signals are forwarded correctly
exec unraid-mcp-server "$@"