-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_server.sh
More file actions
21 lines (19 loc) · 945 Bytes
/
run_server.sh
File metadata and controls
21 lines (19 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash
# Cross-platform MCP server launcher — auto-creates venv if missing
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
# Auto-setup: create venv and install deps if missing
if [ ! -f "$SCRIPT_DIR/venv/bin/python" ] && [ ! -f "$SCRIPT_DIR/venv/Scripts/python.exe" ]; then
python3 -m venv "$SCRIPT_DIR/venv" 2>/dev/null
if [ -f "$SCRIPT_DIR/venv/Scripts/pip.exe" ]; then
"$SCRIPT_DIR/venv/Scripts/pip.exe" install -q -r "$SCRIPT_DIR/requirements.txt" 2>/dev/null
elif [ -f "$SCRIPT_DIR/venv/bin/pip" ]; then
"$SCRIPT_DIR/venv/bin/pip" install -q -r "$SCRIPT_DIR/requirements.txt" 2>/dev/null
fi
fi
if [ -f "$SCRIPT_DIR/venv/Scripts/python.exe" ]; then
exec "$SCRIPT_DIR/venv/Scripts/python.exe" "$SCRIPT_DIR/server/main.py"
elif [ -f "$SCRIPT_DIR/venv/bin/python" ]; then
exec "$SCRIPT_DIR/venv/bin/python" "$SCRIPT_DIR/server/main.py"
else
exec python3 "$SCRIPT_DIR/server/main.py"
fi