-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_server.sh
More file actions
executable file
·43 lines (37 loc) · 1.21 KB
/
Copy pathstart_server.sh
File metadata and controls
executable file
·43 lines (37 loc) · 1.21 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
#!/bin/bash
# Start the SQL Local MCP Server
echo "Starting SQL Local MCP Server..." >&2
# Get the directory where this script is located
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# Create virtual environment if it doesn't exist
if [ ! -d "$DIR/venv" ]; then
echo "Creating virtual environment..." >&2
python3 -m venv "$DIR/venv"
if [ $? -ne 0 ]; then
echo "Error: Failed to create virtual environment" >&2
exit 1
fi
echo "Virtual environment created successfully" >&2
fi
# Activate virtual environment
echo "Activating virtual environment..." >&2
source "$DIR/venv/bin/activate"
if [ $? -ne 0 ]; then
echo "Error: Failed to activate virtual environment" >&2
exit 1
fi
# Install/update requirements if requirements.txt exists
if [ -f "$DIR/requirements.txt" ]; then
echo "Installing/updating requirements..." >&2
pip install -r "$DIR/requirements.txt" >&2
if [ $? -ne 0 ]; then
echo "Error: Failed to install requirements" >&2
exit 1
fi
echo "Requirements installed successfully" >&2
else
echo "Warning: requirements.txt not found" >&2
fi
# Run the MCP server
echo "Starting MCP server..." >&2
python3 "$DIR/mcp_server.py"