SPB Git

spb/akos

Public
1.9 KB · 24 lines shellscript
1#!/bin/bash2# Register AKOS in Claude Code WITHOUT touching existing settings: adds only the `akos` MCP server (user scope) and,3# with --with-hooks, merges one SessionStart hook into ~/.claude/settings.json (backup written first, existing hooks kept).4#   AKOS_TOKEN=akos_… integrations/claude-code/install.sh [--url https://akos.spboucher.ai] [--scope user|project|local] [--with-hooks] [--uninstall]5set -euo pipefail6URL="${AKOS_URL:-https://akos.spboucher.ai}"; SCOPE="user"; HOOKS=0; UNINSTALL=07while [ $# -gt 0 ]; do case "$1" in --url) URL="$2"; shift 2;; --scope) SCOPE="$2"; shift 2;; --with-hooks) HOOKS=1; shift;; --uninstall) UNINSTALL=1; shift;; *) echo "unknown arg $1"; exit 2;; esac; done8command -v claude >/dev/null || { echo "claude CLI not found"; exit 1; }9HERE="$(cd "$(dirname "$0")" && pwd)"10if [ "$UNINSTALL" = 1 ]; then11  claude mcp remove akos -s "$SCOPE" 2>/dev/null || true12  python3 "$HERE/merge_hooks.py" --remove13  echo "akos removed from Claude Code ($SCOPE scope); hooks removed if present"; exit 014fi15TOKEN="${AKOS_TOKEN:-$(python3 -c 'import json,os;p=os.path.expanduser(os.environ.get("AKOS_CONFIG","~/.config/akos/config.json"));print(json.load(open(p)).get("token","")) if os.path.exists(p) else print("")')}"16[ -n "$TOKEN" ] || { echo "AKOS_TOKEN not set and no ~/.config/akos/config.json — run 'akos login' first"; exit 1; }17curl -fsS -m 15 "$URL/api/v1/health" >/dev/null || { echo "AKOS not reachable at $URL"; exit 1; }18claude mcp remove akos -s "$SCOPE" >/dev/null 2>&1 || true19claude mcp add --transport http akos "$URL/mcp" --header "Authorization: Bearer $TOKEN" -s "$SCOPE" >/dev/null20echo "MCP server 'akos' registered ($SCOPE scope) → $URL/mcp"21if [ "$HOOKS" = 1 ]; then python3 "$HERE/merge_hooks.py" --add "$HERE/session_start.sh"; fi22claude mcp get akos | head -523echo "Verify inside a session: /mcp  →  akos should be connected; tools: search_knowledge, inspect_api, discover_api, execute_api, …"24
Files · c744bcc51af6f1462b2f0d25ff87b7354eea4551
Menu

Theme