#!/usr/bin/env bash # Start 4 web-dev-mcp containers (one workspace each) for Codex. # Edit the WORKSPACE_* paths below, then run: # chmod +x examples/codex/run-workspaces.sh # ./examples/codex/run-workspaces.sh set -euo pipefail IMAGE='192.168.3.80/melabidi/mcp_web_dev_server:latest' # --- edit these four absolute paths --- WORKSPACE_1='/path/to/workspace1' WORKSPACE_2='/path/to/workspace2' WORKSPACE_3='/path/to/workspace3' WORKSPACE_4='/path/to/workspace4' NAMES=(web-dev-ws1 web-dev-ws2 web-dev-ws3 web-dev-ws4) PORTS=(3939 3940 3941 3942) PATHS=("$WORKSPACE_1" "$WORKSPACE_2" "$WORKSPACE_3" "$WORKSPACE_4") for i in "${!NAMES[@]}"; do name="${NAMES[$i]}" port="${PORTS[$i]}" path="${PATHS[$i]}" if [[ ! -d "$path" ]]; then echo "error: workspace path does not exist: $path" >&2 exit 1 fi docker rm -f "$name" >/dev/null 2>&1 || true # Default MCP_HTTP_HOST=127.0.0.1 inside the image — no token needed. # Publish to host loopback so only this machine can reach the MCP port. docker run -d \ --name "$name" \ --restart unless-stopped \ -p "127.0.0.1:${port}:3939" \ -v "${path}:/workspace" \ "$IMAGE" echo "Started ${name} -> http://127.0.0.1:${port}/mcp (${path})" done echo echo 'Codex MCP endpoints (see examples/codex/config.toml):' for i in "${!NAMES[@]}"; do echo " ${NAMES[$i]}: http://127.0.0.1:${PORTS[$i]}/mcp" done