| 123456789101112131415161718192021222324252627282930313233 |
- #!/usr/bin/env bash
- set -euo pipefail
- cd "$(dirname "$0")"
- mkdir -p logs
- if [ -f .venv/bin/activate ]; then
- # Activate the local environment when present so uvicorn and deps resolve consistently.
- # shellcheck disable=SC1091
- source .venv/bin/activate
- fi
- PID_FILE="logs/server.pid"
- if [ -f "$PID_FILE" ] && kill -0 "$(cat "$PID_FILE")" 2>/dev/null; then
- echo "server already running with pid $(cat "$PID_FILE")" >&2
- exit 0
- fi
- if command -v uv >/dev/null 2>&1; then
- nohup uv run uvicorn trends_mcp.mcp_server_fastmcp:app --host 0.0.0.0 --port 8507 > logs/server.log 2>&1 &
- echo $! > "$PID_FILE"
- exit 0
- fi
- if [ -x .venv/bin/python ]; then
- PYTHON=.venv/bin/python
- else
- PYTHON=python3
- fi
- nohup "$PYTHON" -m uvicorn trends_mcp.mcp_server_fastmcp:app --host 0.0.0.0 --port 8507 > logs/server.log 2>&1 &
- echo $! > "$PID_FILE"
|