#!/bin/bash
# BerryRAG Setup Script
# Sets up the complete RAG system with dependencies
set -e
echo "π Setting up BerryRAG..."
# Check if we're in the right directory
if [ ! -f "package.json" ]; then
echo "β Please run this script from the berry-rag project root"
exit 1
fi
# Check dependencies
echo "π Checking dependencies..."
# Check Node.js
if ! command -v node &> /dev/null; then
echo "β Node.js is required. Please install Node.js first."
exit 1
fi
# Check Python
if ! command -v python3 &> /dev/null; then
echo "β Python 3 is required. Please install Python 3 first."
exit 1
fi
# Check npm
if ! command -v npm &> /dev/null; then
echo "β npm is required. Please install npm first."
exit 1
fi
# Check pip
if ! command -v pip3 &> /dev/null && ! command -v pip &> /dev/null; then
echo "β pip is required. Please install pip first."
exit 1
fi
echo "β
Dependencies check passed"
# Install Node.js dependencies
echo "π¦ Installing Node.js dependencies..."
npm install
# Install Python dependencies
echo "π Installing Python dependencies..."
if command -v pip3 &> /dev/null; then
pip3 install -r requirements.txt
else
pip install -r requirements.txt
fi
# Create .env file if it doesn't exist
if [ ! -f ".env" ]; then
echo "π Creating .env file..."
cp .env.example .env
echo "β
Created .env file (customize as needed)"
fi
# Build TypeScript
echo "π¨ Building TypeScript MCP server..."
npm run build
# Setup directories and instructions
echo "π Setting up directories..."
python3 src/playwright_integration.py setup
# Create Claude Desktop config suggestion
echo "π€ Creating Claude Desktop configuration..."
cat > claude_desktop_config.json << EOF
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"]
},
"berry-rag": {
"command": "node",
"args": ["mcp_servers/vector_db_server.js"],
"cwd": "$(pwd)"
}
}
}
EOF
echo "π Created claude_desktop_config.json"
# Test the system
echo "π§ͺ Testing the system..."
python3 src/rag_system.py stats
echo ""
echo "π BerryRAG setup complete!"
echo ""
echo "Next steps:"
echo "1. Add the contents of claude_desktop_config.json to your Claude Desktop config"
echo "2. Restart Claude Desktop"
echo "3. Start scraping with Playwright MCP:"
echo " 'Use Playwright to scrape documentation and save to scraped_content'"
echo "4. Process scraped content:"
echo " 'Process scraped files into the BerryRAG vector database'"
echo "5. Search your knowledge base:"
echo " 'Search BerryRAG for information about [topic]'"
echo ""
echo "π See README.md for detailed usage instructions"
echo "π Project location: $(pwd)"