wire-knowtation-mcp.sh
bash
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd
feat(calendar): enforce agent context tiers in retrieval AP…
Human
minor
⚠ breaking
1 day ago
| 1 | #!/usr/bin/env bash |
| 2 | ###################################################################### |
| 3 | # wire-knowtation-mcp.sh |
| 4 | # |
| 5 | # Smoke-tests that Paperclip can talk to the hosted Knowtation Hub via |
| 6 | # its REST API (the same endpoints the 5 skills use). |
| 7 | # |
| 8 | # Runs three checks against the Hub: |
| 9 | # 1. semantic search returns 2xx |
| 10 | # 2. get_note for the Born Free style guide returns 2xx |
| 11 | # 3. list_notes for the Born Free project returns 2xx |
| 12 | # |
| 13 | # If any of these fail, do NOT run load-skills-and-agents.sh — fix the |
| 14 | # Hub URL / JWT / vault ID first via push-secrets.sh. |
| 15 | # |
| 16 | # Run AS the paperclip user: |
| 17 | # sudo -u paperclip /opt/paperclip/scripts/wire-knowtation-mcp.sh |
| 18 | ###################################################################### |
| 19 | |
| 20 | set -euo pipefail |
| 21 | |
| 22 | ENV_FILE=/etc/paperclip/env |
| 23 | if [[ ! -r "$ENV_FILE" ]]; then |
| 24 | echo "FAIL: $ENV_FILE not readable. Run push-secrets.sh first." |
| 25 | exit 1 |
| 26 | fi |
| 27 | |
| 28 | # shellcheck disable=SC1090 |
| 29 | set -a |
| 30 | source "$ENV_FILE" |
| 31 | set +a |
| 32 | |
| 33 | REQUIRED=(KNOWTATION_HUB_URL KNOWTATION_HUB_JWT KNOWTATION_VAULT_ID) |
| 34 | for v in "${REQUIRED[@]}"; do |
| 35 | if [[ -z "${!v:-}" ]]; then |
| 36 | echo "FAIL: $v missing in $ENV_FILE. Run push-secrets.sh." |
| 37 | exit 1 |
| 38 | fi |
| 39 | done |
| 40 | |
| 41 | H_AUTH="Authorization: Bearer $KNOWTATION_HUB_JWT" |
| 42 | H_VAULT="X-Vault-Id: $KNOWTATION_VAULT_ID" |
| 43 | H_USER="X-User-Id: paperclip" |
| 44 | |
| 45 | PASS=0 |
| 46 | FAIL=0 |
| 47 | |
| 48 | check() { |
| 49 | local name="$1" |
| 50 | local status="$2" |
| 51 | if [[ "$status" =~ ^2[0-9][0-9]$ ]]; then |
| 52 | echo " [PASS] $name (HTTP $status)" |
| 53 | PASS=$((PASS + 1)) |
| 54 | else |
| 55 | echo " [FAIL] $name (HTTP $status)" |
| 56 | FAIL=$((FAIL + 1)) |
| 57 | fi |
| 58 | } |
| 59 | |
| 60 | echo "[wire-knowtation] Testing Hub connectivity at $KNOWTATION_HUB_URL" |
| 61 | echo " vault: $KNOWTATION_VAULT_ID" |
| 62 | echo "" |
| 63 | |
| 64 | # 1. Semantic search |
| 65 | STATUS=$(curl -s -o /tmp/wire-1.json -w '%{http_code}' \ |
| 66 | -X POST "$KNOWTATION_HUB_URL/api/v1/search" \ |
| 67 | -H "$H_AUTH" -H "$H_VAULT" -H "$H_USER" \ |
| 68 | -H "Content-Type: application/json" \ |
| 69 | -d '{"query":"test","mode":"semantic","limit":1}' \ |
| 70 | --max-time 15) || STATUS="000" |
| 71 | check "search (POST /api/v1/search)" "$STATUS" |
| 72 | |
| 73 | # 2. get_note for Born Free style guide |
| 74 | STATUS=$(curl -s -o /tmp/wire-2.json -w '%{http_code}' \ |
| 75 | "$KNOWTATION_HUB_URL/api/v1/notes/projects%2Fborn-free%2Fstyle-guide%2Fvoice-and-boundaries.md" \ |
| 76 | -H "$H_AUTH" -H "$H_VAULT" -H "$H_USER" \ |
| 77 | --max-time 15) || STATUS="000" |
| 78 | check "get_note (born-free style-guide)" "$STATUS" |
| 79 | |
| 80 | # 3. list_notes for Born Free project |
| 81 | STATUS=$(curl -s -o /tmp/wire-3.json -w '%{http_code}' \ |
| 82 | "$KNOWTATION_HUB_URL/api/v1/notes?project=born-free&limit=5" \ |
| 83 | -H "$H_AUTH" -H "$H_VAULT" -H "$H_USER" \ |
| 84 | --max-time 15) || STATUS="000" |
| 85 | check "list_notes (project=born-free)" "$STATUS" |
| 86 | |
| 87 | echo "" |
| 88 | echo "[wire-knowtation] $PASS passed, $FAIL failed" |
| 89 | |
| 90 | if [[ "$FAIL" -gt 0 ]]; then |
| 91 | echo "" |
| 92 | echo "Likely cause: 401 → JWT expired (default 24h). Copy a fresh JWT from" |
| 93 | echo "Hub UI → Settings → Integrations → Hub API, then push-secrets.sh." |
| 94 | echo "" |
| 95 | echo "Or: 404 → Hub URL wrong, or the Born Free style guide note does not exist yet." |
| 96 | echo "Verify in Hub UI that vault/projects/born-free/style-guide/voice-and-boundaries.md is present." |
| 97 | rm -f /tmp/wire-1.json /tmp/wire-2.json /tmp/wire-3.json |
| 98 | exit 1 |
| 99 | fi |
| 100 | |
| 101 | rm -f /tmp/wire-1.json /tmp/wire-2.json /tmp/wire-3.json |
| 102 | echo "[wire-knowtation] PASS — Paperclip can read/search the Knowtation Hub." |
| 103 | exit 0 |
File History
2 commits
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd
feat(calendar): enforce agent context tiers in retrieval AP…
Human
minor
⚠
1 day ago
sha256:9103f98c89257ed2b01c237cea895dabb3e85ea337dccb1161c175e4422355b6
docs: accept Calendar Events v0 spec with Phase 0 security …
Human
1 day ago