Files

24 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Writes output/08: builds the official ext-apps basic-host, points it at this server and drives it in Chromium.
# Needs the jar (mvn -pl mcp-apps package) and harness/node_modules (npm install in harness/).
set -euo pipefail
MODULE="$(cd "$(dirname "$0")/.." && pwd)"
WORK="$(mktemp -d)"
git clone -q https://github.com/modelcontextprotocol/ext-apps.git "$WORK/ext-apps"
git -C "$WORK/ext-apps" checkout -q 87bcdc8
cp -r "$WORK/ext-apps/examples/basic-host" "$WORK/basic-host"
cd "$WORK/basic-host"
sed -i 's/"@modelcontextprotocol\/ext-apps": "\^2.1.0"/"@modelcontextprotocol\/ext-apps": "2.0.4"/' package.json
npm install --silent
npm install --silent tsx
INPUT=index.html npx vite build >/dev/null
INPUT=sandbox.html npx vite build >/dev/null
java -jar "$MODULE/target/mcp-apps.jar" --spring.profiles.active=browserhost --logging.level.root=warn &
JAVA_PID=$!
SERVERS='["http://localhost:3001/mcp"]' node_modules/.bin/tsx serve.ts &
HOST_PID=$!
trap 'kill $JAVA_PID $HOST_PID 2>/dev/null || true' EXIT
sleep 15
cd "$MODULE/harness" && node basic-host.mjs