forked from sirkirby/unifi-mcp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·44 lines (36 loc) · 1.24 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·44 lines (36 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
set -euo pipefail
COMMAND="${1:-install}"
echo ""
echo " UniFi MCP Worker CLI"
echo ""
# Check Node.js
if ! command -v node &>/dev/null; then
echo " Error: Node.js is required but not installed."
echo " Install it from https://nodejs.org/ or via your package manager:"
echo " brew install node (macOS)"
echo " apt install nodejs (Debian/Ubuntu)"
echo " winget install Volta (Windows)"
echo ""
exit 1
fi
# Check minimum Node version (18+)
NODE_VERSION=$(node -v | sed 's/v//' | cut -d. -f1)
if [ "$NODE_VERSION" -lt 18 ]; then
echo " Error: Node.js 18+ required. Found: $(node -v)"
echo " Update from https://nodejs.org/"
exit 1
fi
echo " Node.js $(node -v) detected."
# Install or update the CLI
if command -v unifi-mcp-worker &>/dev/null; then
echo " Updating unifi-mcp-worker CLI..."
npm install -g unifi-mcp-worker@latest --silent 2>/dev/null || npm install -g unifi-mcp-worker@latest
else
echo " Installing unifi-mcp-worker CLI..."
npm install -g unifi-mcp-worker --silent 2>/dev/null || npm install -g unifi-mcp-worker
fi
echo ""
# Run the requested command, passing through any additional args
shift 2>/dev/null || true
unifi-mcp-worker "$COMMAND" "$@"