-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-all.sh
More file actions
executable file
·71 lines (56 loc) · 1.88 KB
/
Copy pathstart-all.sh
File metadata and controls
executable file
·71 lines (56 loc) · 1.88 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
#!/usr/bin/env bash
#
# Starts the full Spring AI MCP demo stack:
# 1. MCP Authorization Server (http://localhost:9000)
# 2. MCP Server (http://localhost:8082)
# 3. MCP Client (http://localhost:8083)
# 4. MCP Chatbot (Angular) (http://localhost:4200)
#
# All services run as background jobs of this script. Logs are written to
# ./logs/<service>.log. Press Ctrl+C (or kill this script) to stop everything.
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$ROOT_DIR"
LOG_DIR="$ROOT_DIR/logs"
mkdir -p "$LOG_DIR"
PIDS=()
cleanup() {
echo
echo "Stopping all services..."
for pid in "${PIDS[@]:-}"; do
if [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null; then
kill "$pid" 2>/dev/null || true
fi
done
wait 2>/dev/null || true
}
trap cleanup EXIT INT TERM
echo "=========================================================="
echo " Starting Spring AI MCP Demo stack"
echo "=========================================================="
echo "[1/4] Starting MCP Authorization Server (http://localhost:9000) ..."
./gradlew :mcp-authorization-server:bootRun > "$LOG_DIR/mcp-authorization-server.log" 2>&1 &
PIDS+=($!)
echo " Waiting for the authorization server to come up..."
sleep 15
echo "[2/4] Starting MCP Server (http://localhost:8082) ..."
./gradlew :mcp-server:bootRun > "$LOG_DIR/mcp-server.log" 2>&1 &
PIDS+=($!)
echo " Waiting for the MCP server to come up..."
sleep 10
echo "[3/4] Starting MCP Client (http://localhost:8083) ..."
./gradlew :mcp-client:bootRun > "$LOG_DIR/mcp-client.log" 2>&1 &
PIDS+=($!)
echo "[4/4] Starting MCP Chatbot (http://localhost:4200) ..."
(
cd mcp-chatbot
if [ ! -d node_modules ]; then
npm install
fi
npm start
) > "$LOG_DIR/mcp-chatbot.log" 2>&1 &
PIDS+=($!)
echo
echo "All services started. Logs are in $LOG_DIR/*.log"
echo "Press Ctrl+C to stop all services."
wait