-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
106 lines (82 loc) · 2.18 KB
/
start.sh
File metadata and controls
106 lines (82 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
# Multi-Agent MCP Startup Script
# This script starts both the backend and frontend services
echo "🤖 Starting Multi-Agent MCP System..."
# Check if we're in the right directory
if [ ! -f "README.md" ]; then
echo "❌ Please run this script from the project root directory"
exit 1
fi
# Function to check if a command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# Check prerequisites
echo "🔍 Checking prerequisites..."
if ! command_exists python3; then
echo "❌ Python 3 is required but not installed"
exit 1
fi
if ! command_exists node; then
echo "❌ Node.js is required but not installed"
exit 1
fi
if ! command_exists npm; then
echo "❌ npm is required but not installed"
exit 1
fi
echo "✅ Prerequisites check passed"
# Setup backend
echo "🐍 Setting up backend..."
cd backend
# 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 dependencies
echo "📦 Installing Python dependencies..."
pip install -r requirements.txt
# Start backend in background
echo "🚀 Starting backend server..."
python main.py &
BACKEND_PID=$!
cd ..
# Setup frontend
echo "⚛️ Setting up frontend..."
cd frontend
# Install dependencies if node_modules doesn't exist
if [ ! -d "node_modules" ]; then
echo "📦 Installing Node.js dependencies..."
npm install
fi
# Start frontend in background
echo "🚀 Starting frontend server..."
npm run dev &
FRONTEND_PID=$!
cd ..
# Wait a moment for servers to start
sleep 3
echo ""
echo "🎉 Multi-Agent MCP System is starting up!"
echo ""
echo "📱 Frontend: http://localhost:3000"
echo "🔧 Backend API: http://localhost:8000"
echo "📚 API Docs: http://localhost:8000/docs"
echo ""
echo "Press Ctrl+C to stop all services"
# Function to cleanup on exit
cleanup() {
echo ""
echo "🛑 Shutting down services..."
kill $BACKEND_PID 2>/dev/null
kill $FRONTEND_PID 2>/dev/null
echo "✅ Services stopped"
exit 0
}
# Set trap to cleanup on script exit
trap cleanup SIGINT SIGTERM
# Wait for user to stop
wait