#!/bin/sh # hedwigai — add the workbooks MCP server to every agent on this machine. # # curl -fsSL https://mcp.hedwigai.com/install.sh | sh # # Finds Claude Code, Codex, Cursor and VS Code and registers https://mcp.hedwigai.com in each, # and gives Claude Code, Codex and Cursor a short hedwigai skill saying when to # reach for it. Nothing secret is written: every one of them signs in through # the browser the first time it uses the server. Safe to run twice. set -u URL="https://mcp.hedwigai.com" NAME="hedwigai" added="" skipped="" todo="" say() { printf '%s\n' "$*"; } have() { command -v "$1" >/dev/null 2>&1; } note_added() { added="$added ✓ $1"; } note_skip() { skipped="$skipped · $1"; } note_todo() { todo="$todo → $1"; } # The skill: when to use the server, in the agent's own skills folder. A file # without the marker line is someone's own edit and is left alone. MARK="" skill() { dir="$1/skills/$NAME" f="$dir/SKILL.md" if [ -f "$f" ] && ! grep -qF "$MARK" "$f" 2>/dev/null; then return 0 fi mkdir -p "$dir" 2>/dev/null || return 0 cat >"$f" <\` to turn one on, \` --help\` for usage. - \`funding recent \` — companies that filed a Form D raise this month, with the people the filing names. \`funding search \` for one company. - \`company-hiring openings \` — open roles from company job boards. - \`outreach people role \` — who holds a role there. \`outreach email search ""\` — a work email with a \`risk\`: confirmed, published, format, unchecked or guess. Write only to confirmed or published addresses; a guess may bounce. - \`ucc\`, \`fcc\`, \`fda\`, \`us-trademarks\`, \`h1b-hiring\`, \`sec-filings\`, \`us-business-license\`, \`us-motor-carriers\`, \`trade\` — public registers. A lead worth writing to has a reason (the filing, the posting) and a person named in or near it. Quote the reason in the message; it is why they reply. **Workbooks** (\`list_workbooks\`, \`create_workbook\`, \`ask\` …) are documents a run writes and keeps current, citing every source. Calls that cost money draw on prepaid credits — no seats. The \`credits\` tool shows the balance and a top-up link for the person to open. Say the cost of a large job before running it. SKILL note_added "$2 skill" } say "" say " hedwigai — connecting your agents to $URL" say "" # ── Claude Code ───────────────────────────────────────────────────────── if have claude; then if claude mcp get "$NAME" >/dev/null 2>&1; then note_skip "Claude Code (already added)" elif claude mcp add --transport http --scope user "$NAME" "$URL" >/dev/null 2>&1; then note_added "Claude Code" note_todo "Claude Code: type /mcp, choose $NAME, then Authenticate" else note_todo "Claude Code: run claude mcp add --transport http --scope user $NAME $URL" fi skill "$HOME/.claude" "Claude Code" fi # ── Codex ─────────────────────────────────────────────────────────────── if have codex; then if codex mcp get "$NAME" >/dev/null 2>&1; then note_skip "Codex (already added)" elif codex mcp add "$NAME" --url "$URL" >/dev/null 2>&1; then note_added "Codex" note_todo "Codex: run codex mcp login $NAME" else note_todo "Codex: run codex mcp add $NAME --url $URL" fi skill "${CODEX_HOME:-$HOME/.codex}" "Codex" fi # ── Cursor ────────────────────────────────────────────────────────────── # Cursor reads ~/.cursor/mcp.json. A new file is written whole; an existing # one is merged with python3 or node, never overwritten. if [ -d "$HOME/.cursor" ] || have cursor; then f="$HOME/.cursor/mcp.json" if [ -f "$f" ] && grep -q "\"$NAME\"" "$f" 2>/dev/null; then note_skip "Cursor (already added)" elif [ ! -s "$f" ]; then mkdir -p "$HOME/.cursor" printf '{\n "mcpServers": {\n "%s": { "url": "%s" }\n }\n}\n' "$NAME" "$URL" >"$f" note_added "Cursor" note_todo "Cursor: Settings → MCP → Connect beside $NAME" else merged="" if have python3; then python3 - "$f" "$NAME" "$URL" <<'PY' && merged=1 import json, sys path, name, url = sys.argv[1:4] with open(path) as fh: cfg = json.load(fh) cfg.setdefault("mcpServers", {})[name] = {"url": url} with open(path, "w") as fh: json.dump(cfg, fh, indent=2) fh.write("\n") PY elif have node; then node -e ' const fs = require("fs"); const [p, n, u] = process.argv.slice(1); const c = JSON.parse(fs.readFileSync(p, "utf8")); (c.mcpServers = c.mcpServers || {})[n] = { url: u }; fs.writeFileSync(p, JSON.stringify(c, null, 2) + "\n");' "$f" "$NAME" "$URL" && merged=1 fi if [ -n "$merged" ]; then note_added "Cursor" note_todo "Cursor: Settings → MCP → Connect beside $NAME" else note_todo "Cursor: add \"$NAME\": { \"url\": \"$URL\" } under mcpServers in $f" fi fi skill "$HOME/.cursor" "Cursor" fi # ── VS Code ───────────────────────────────────────────────────────────── if have code; then if code --add-mcp "{\"name\":\"$NAME\",\"type\":\"http\",\"url\":\"$URL\"}" >/dev/null 2>&1; then note_added "VS Code" note_todo "VS Code: open the MCP servers list and Start $NAME" else note_todo "VS Code: Command Palette → MCP: Add Server → HTTP → $URL" fi fi # ── Report ────────────────────────────────────────────────────────────── if [ -z "$added$skipped" ]; then say " No agent found (looked for Claude Code, Codex, Cursor, VS Code)." say " In Claude on the web or desktop: Settings → Connectors →" say " Add custom connector → $URL" say "" exit 0 fi [ -n "$added" ] && say " Added:$added" && say "" [ -n "$skipped" ] && say " Already set up:$skipped" if [ -n "$todo" ]; then say "" say " One step left in each — sign in to hedwigai when the browser opens:$todo" fi say "" say " Claude on the web or desktop: Settings → Connectors → Add custom connector → $URL" say " No account yet? https://app.hedwigai.com/signin?utm_source=mcp&utm_medium=install&utm_campaign=mcp-install" say ""