#!/bin/bash
echo "========================================="
echo " Quickbase MCP Integration Setup"
echo " Version 1.0.0"
echo "========================================="
# Check Python version
python_version=$(python3 --version 2>&1 | cut -d " " -f 2)
python_major=$(echo $python_version | cut -d. -f1)
python_minor=$(echo $python_version | cut -d. -f2)
echo "Detected Python version: $python_version"
if [ "$python_major" -lt 3 ] || [ "$python_major" -eq 3 -a "$python_minor" -lt 8 ]; then
echo "Error: Python 3.8 or higher is required. Found Python $python_version"
exit 1
fi
# Check Node.js version
if ! command -v node &> /dev/null; then
echo "Error: Node.js is not installed. Please install Node.js 14 or higher."
exit 1
fi
node_version=$(node --version | cut -c 2-)
node_major=$(echo $node_version | cut -d. -f1)
echo "Detected Node.js version: $node_version"
if [ "$node_major" -lt 14 ]; then
echo "Error: Node.js 14 or higher is required. Found Node.js $node_version"
exit 1
fi
echo "Environment checks passed. Proceeding with installation..."
# Create virtual environment if it doesn't exist
if [ ! -d "venv" ]; then
echo "Creating Python virtual environment..."
python3 -m venv venv
fi
# Activate virtual environment
source venv/bin/activate
# Install Python dependencies
echo "Installing Python dependencies..."
pip install --upgrade pip
pip install -r requirements.txt
# Install npm dependencies locally
echo "Installing Node.js dependencies..."
npm install
# Make scripts executable
echo "Setting up executables..."
chmod +x src/quickbase/server.js
chmod +x run_tests.sh
chmod +x test_file_operations.py
chmod +x test_pagination.py
chmod +x test_remaining_operations.py
# Create .env file with user-provided credentials
echo "Setting up Quickbase credentials..."
echo
read -p "Enter your Quickbase Realm Host (e.g., your-realm.quickbase.com): " realm_host
read -p "Enter your Quickbase User Token: " user_token
read -p "Enter your Quickbase App ID: " app_id
# Create .env file
echo "QUICKBASE_REALM_HOST=$realm_host
QUICKBASE_USER_TOKEN=$user_token
QUICKBASE_APP_ID=$app_id
MCP_SERVER_PORT=3535" > .env
echo "Credentials saved to .env file."
# Set up Claude Desktop configuration
echo
echo "Setting up Claude Desktop configuration..."
# Determine the platform and Claude Desktop config path
if [[ "$OSTYPE" == "darwin"* ]]; then
config_dir="$HOME/Library/Application Support/Claude"
config_file="$config_dir/claude_desktop_config.json"
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
config_dir="$HOME/.config/Claude"
config_file="$config_dir/claude_desktop_config.json"
elif [[ "$OSTYPE" == "msys"* || "$OSTYPE" == "cygwin"* || "$OSTYPE" == "win32"* ]]; then
config_dir="$APPDATA/Claude"
config_file="$config_dir/claude_desktop_config.json"
else
echo "Unsupported operating system. Please configure Claude Desktop manually."
config_file=""
fi
if [ ! -z "$config_file" ]; then
# Create config directory if it doesn't exist
mkdir -p "$config_dir"
# Get absolute paths
current_dir=$(pwd)
node_path=$(which node)
server_path="$current_dir/src/quickbase/server.js"
# Create or update Claude Desktop config
echo "{
\"mcpServers\": {
\"quickbase\": {
\"command\": \"$node_path\",
\"args\": [
\"$server_path\"
],
\"env\": {
\"QUICKBASE_REALM_HOST\": \"$realm_host\",
\"QUICKBASE_USER_TOKEN\": \"$user_token\",
\"QUICKBASE_APP_ID\": \"$app_id\",
\"MCP_SERVER_PORT\": \"3535\"
}
}
}
}" > "$config_file"
echo "Claude Desktop configuration created at: $config_file"
fi
echo ""
echo "Setup complete!"
echo ""
echo "Quickbase MCP connector is now installed and configured for Claude Desktop!"
echo ""
echo "Next steps:"
echo "1. Restart Claude Desktop if it's already running"
echo "2. In Claude Desktop, you can now interact with your Quickbase data"
echo " Example prompt: \"List all tables in my Quickbase app using the quickbase connector.\""
echo ""
echo "For more information, see README.md"
echo "========================================="