BioGuideMCP / setup.sh
stefanjwojcik's picture
Add setup script and comprehensive tests for Congressional Bioguide MCP Server
15de73a
#!/bin/bash
# Setup script for Congressional Bioguide MCP Server
set -e
echo "Setting up Congressional Bioguide MCP Server..."
echo "=============================================="
# Check for compatible Python versions
PYTHON_CMD=""
# Try to find a compatible Python version (3.10-3.13)
for version in python3.13 python3.12 python3.11 python3.10; do
if command -v $version &> /dev/null; then
PYTHON_CMD=$version
echo "βœ“ Found compatible Python: $($PYTHON_CMD --version)"
break
fi
done
# Fall back to python3 if no specific version found
if [ -z "$PYTHON_CMD" ]; then
if command -v python3 &> /dev/null; then
PYTHON_CMD=python3
PYTHON_VERSION=$($PYTHON_CMD --version 2>&1 | awk '{print $2}')
MAJOR=$(echo $PYTHON_VERSION | cut -d. -f1)
MINOR=$(echo $PYTHON_VERSION | cut -d. -f2)
echo "⚠️ Found Python $PYTHON_VERSION"
if [ "$MAJOR" -eq 3 ] && [ "$MINOR" -ge 14 ]; then
echo ""
echo "ERROR: Python 3.14+ is not compatible with FAISS library"
echo ""
echo "Please install Python 3.13 or 3.12 using pyenv:"
echo " brew install pyenv"
echo " pyenv install 3.13"
echo " pyenv local 3.13"
echo " ./setup.sh"
echo ""
exit 1
elif [ "$MAJOR" -eq 3 ] && [ "$MINOR" -lt 10 ]; then
echo "ERROR: Python 3.10 or higher required (found $PYTHON_VERSION)"
exit 1
fi
else
echo "ERROR: Python 3 not found"
exit 1
fi
fi
# Create virtual environment if it doesn't exist
if [ ! -d "venv" ]; then
echo "Creating virtual environment with $PYTHON_CMD..."
$PYTHON_CMD -m venv venv
echo "βœ“ Virtual environment created"
else
echo "βœ“ Virtual environment already exists"
fi
# Activate virtual environment
source venv/bin/activate
# Verify we're using the venv python
echo "Using Python: $(which python3)"
echo "Version: $(python3 --version)"
# Install dependencies
echo ""
echo "Installing dependencies..."
pip install --upgrade pip
pip install -r requirements.txt
echo "βœ“ Dependencies installed"
# Run ingestion
echo ""
echo "Running data ingestion..."
python3 ingest_data.py
echo ""
echo "=============================================="
echo "βœ“ Setup complete!"
echo ""
echo "To run the server:"
echo " source venv/bin/activate"
echo " python3 server.py"