-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_mcp.sh
More file actions
56 lines (43 loc) · 1.25 KB
/
Copy pathstart_mcp.sh
File metadata and controls
56 lines (43 loc) · 1.25 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
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env bash
set -euo pipefail
log() {
echo "[INFO] $*" >&2
}
err() {
echo "[ERROR] $*" >&2
}
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
BACKEND_DIR="$SCRIPT_DIR/backend"
VENV_DIR="$BACKEND_DIR/venv"
LOG_FILE="/tmp/nemesis_mcp.log"
log "Starting NEMESIS"
log "Script path: $SCRIPT_DIR"
log "Backend path: $BACKEND_DIR"
if [[ ! -d "$BACKEND_DIR" ]]; then
err "Backend directory not found: $BACKEND_DIR"
exit 1
fi
cd "$BACKEND_DIR"
if [[ ! -d "$VENV_DIR" ]]; then
log "Creating missing venv..."
python3 -m venv "$VENV_DIR"
fi
source "$VENV_DIR/bin/activate"
log "Ensuring pip is up to date..."
"$VENV_DIR/bin/python3" -m pip install --quiet --upgrade pip setuptools wheel || true
log "Installing dependencies from requirements.txt..."
"$VENV_DIR/bin/python3" -m pip install --quiet -r requirements.txt || true
log "Testing MCP import..."
"$VENV_DIR/bin/python3" - << 'EOF'
try:
from mcp.server import Server
import sys
print("✅ MCP import OK", file=sys.stderr)
except Exception as e:
import sys
print(f"⌠MCP import FAILED: {e}", file=sys.stderr)
sys.exit(1)
EOF
log "Launching MCP server"
log "Logs will be in $LOG_FILE"
exec "$VENV_DIR/bin/python3" -u mcp/nemesis_mcp_server.py 2>"$LOG_FILE"