-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·112 lines (99 loc) · 2.86 KB
/
setup.sh
File metadata and controls
executable file
·112 lines (99 loc) · 2.86 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
107
108
109
110
111
112
#!/bin/bash
set -e
echo "=== MCP Deployment Setup ==="
# 1. Check Docker Installation
if ! command -v docker &> /dev/null; then
echo "❌ Error: Docker is not installed."
echo "Please install Docker first:"
echo " sudo apt-get update && sudo apt-get install docker.io docker-compose"
exit 1
fi
echo "✅ Docker is installed"
# 2. Check/Install Gemini CLI
CLI_PKG="@google/gemini-cli"
if ! command -v gemini &> /dev/null; then
echo "Installing Gemini CLI..."
if command -v npm &> /dev/null; then
sudo npm install -g "$CLI_PKG"
echo "✅ Gemini CLI installed"
else
echo "❌ Error: npm not found. Please install Node.js/npm first."
exit 1
fi
else
echo "✅ Gemini CLI already installed"
fi
# 3. Build and Start Container
echo "Building and starting Docker container..."
docker compose up -d --build
echo "Waiting for container to be ready..."
sleep 2
# 4. Generate Settings
SETTINGS_DIR="$HOME/.gemini"
SETTINGS_FILE="$SETTINGS_DIR/settings.json"
mkdir -p "$SETTINGS_DIR"
BACKUP_FILE="$SETTINGS_FILE.bak.$(date +%s)"
if [ -f "$SETTINGS_FILE" ]; then
echo "Backing up existing settings to $BACKUP_FILE"
cp "$SETTINGS_FILE" "$BACKUP_FILE"
fi
echo "Generating $SETTINGS_FILE..."
# We use docker exec to run the python scripts inside the container.
# Paths inside container are /app/servers/...
cat > "$SETTINGS_FILE" <<EOF
{
"security": {
"auth": {
"selectedType": "oauth-personal"
}
},
"mcpServers": {
"ssh": {
"command": "npx",
"args": [
"-y",
"@idletoaster/ssh-mcp-server@latest"
],
"env": {}
},
"verifier": {
"command": "docker",
"args": ["exec", "-i", "mcp-toolbox", "python", "/app/servers/verifier/server.py"],
"env": {}
},
"deployer": {
"command": "docker",
"args": ["exec", "-i", "mcp-toolbox", "python", "/app/servers/deployer/server.py"],
"env": {}
},
"observer": {
"command": "docker",
"args": ["exec", "-i", "mcp-toolbox", "python", "/app/servers/observer/server.py"],
"env": {}
},
"librarian": {
"command": "docker",
"args": ["exec", "-i", "mcp-toolbox", "python", "/app/servers/librarian/server.py"],
"env": {}
},
"ipam": {
"command": "docker",
"args": ["exec", "-i", "mcp-toolbox", "python", "/app/servers/ipam/server.py"],
"env": {}
},
"auditor": {
"command": "docker",
"args": ["exec", "-i", "mcp-toolbox", "python", "/app/servers/auditor/server.py"],
"env": {}
},
"traffic_gen": {
"command": "docker",
"args": ["exec", "-i", "mcp-toolbox", "python", "/app/servers/traffic_gen/server.py"],
"env": {}
}
}
}
EOF
echo "=== Setup Complete ==="
echo "You can now use the Gemini CLI with your Dockerized MCP servers."
echo "Try running: gemini"