run_server.sh•1.41 kB
#!/bin/bash
# This script runs the Resemble AI MCP Server
# Usage: ./run_server.sh [implementation] [port] [host]
# Example: ./run_server.sh mcp 8083 0.0.0.0
# Default values
IMPLEMENTATION=${1:-auto}
PORT=${2:-8083}
HOST=${3:-0.0.0.0}
# Validate implementation
if [[ ! "$IMPLEMENTATION" =~ ^(mcp|http|direct|sdk|stdio|auto)$ ]]; then
echo "Error: Invalid implementation. Choose from: mcp, http, direct, sdk, stdio, auto"
exit 1
fi
# Determine Python command
if command -v python3.10 &> /dev/null; then
PYTHON_CMD="python3.10"
elif command -v python3 &> /dev/null; then
PYTHON_CMD="python3"
else
PYTHON_CMD="python"
fi
# Check for conda environment
if [[ -n $CONDA_PREFIX ]]; then
echo "Using conda environment '$CONDA_DEFAULT_ENV'..."
elif [[ -d "./venv" ]]; then
# Check if venv exists and activate it
echo "Activating virtual environment..."
source ./venv/bin/activate
PYTHON_CMD="python" # Use the venv python
elif [[ -d "./env" ]]; then
# Check if env exists and activate it
echo "Activating virtual environment..."
source ./env/bin/activate
PYTHON_CMD="python" # Use the venv python
fi
# Check if we need to skip port and host for stdio
if [[ "$IMPLEMENTATION" == "stdio" ]]; then
$PYTHON_CMD -m src.cli --implementation $IMPLEMENTATION
else
$PYTHON_CMD -m src.cli --implementation $IMPLEMENTATION --port $PORT --host $HOST
fi