#!/usr/bin/env bash # Mint a session on the local instance and print the environment the MCP server # and CLI expect, so they can be pointed at it instead of the live Schulcloud. # # eval "$(./scripts/mcp-env.sh)" # as the demo student # eval "$(./scripts/mcp-env.sh klara.fall@schul-cloud.org Schulcloud1\!)" # # Nothing is written to the repo: the output contains a live session token, and # a throwaway instance is still no reason to start committing those. set -euo pipefail # `localhost`, not `127.0.0.1`: it must match SC_DOMAIN, because urls the server # hands back (Etherpad pads, for one) are built from it, and the client refuses # to follow a url onto a different host rather than leak a session cookie there. URL=${LOCAL_SC_URL:-http://localhost:4400} USER=${1:-demo-schueler@schul-cloud.org} PASS=${2:-schulcloud} token=$(curl -fsS -X POST "$URL/api/v3/authentication/local" \ -H 'Content-Type: application/json' \ -d "$(printf '{"username":%s,"password":%s}' \ "$(printf '%s' "$USER" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))')" \ "$(printf '%s' "$PASS" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))')")" \ | python3 -c 'import json,sys; print(json.load(sys.stdin)["accessToken"])') # The index and mirror are pinned too, not just the instance. The repo's .env # normally points at the live account, and process env beats --env-file, so # without these a local smoke run would crawl this throwaway instance straight # into the live index — and a per-course refresh carries everything outside its # scope forward, so the fixtures would outlive the run. Fixtures in real data # is exactly the accident the store tests' "test" guard exists to prevent. ROOT=$(cd "$(dirname "$0")/../.." && pwd) cat <