#!/bin/sh # Rippit agent setup: # # curl -fsSL https://rippit.com/install | sh # # Adds Rippit's MCP server (https://mcp.rippit.com/mcp) to Claude Code, Codex, # Gemini CLI and Cursor when they are installed, and installs the Rippit skill # so those agents know when to use Rippit. It installs no CLI and creates no # account: each agent asks you to sign in to Rippit in your browser the first # time it uses the server. set -u URL="https://mcp.rippit.com/mcp" SKILL_URL="https://docs.rippit.com/.well-known/skills/rippit/SKILL.md" main() { failed=0 found=0 skill="" say() { printf '%s\n' "$*"; } fail() { printf '%s\n' "$*" >&2; failed=1; } have() { command -v "$1" >/dev/null 2>&1; } tmp="$(mktemp -d)" || { fail "couldn't create a temporary folder"; exit 1; } trap 'rm -rf "$tmp"' EXIT if have curl; then curl -fsSL "$SKILL_URL" -o "$tmp/SKILL.md" &1)"; then say "Claude Code: added Rippit. To sign in, type /mcp in Claude Code, pick rippit and choose Authenticate." elif printf '%s' "$out" | grep -q "already exists"; then say "Claude Code: Rippit was already added." else fail "Claude Code: couldn't add Rippit: $out" fi install_skill "${CLAUDE_CONFIG_DIR:-$HOME/.claude}/skills" "Claude Code" fi codex_home="${CODEX_HOME:-$HOME/.codex}" if have codex || [ -d "$codex_home" ]; then found=1 mkdir -p "$codex_home" config="$codex_home/config.toml" codex_ok() { have codex && (cd "$HOME" && CODEX_HOME="$codex_home" codex mcp "$@") /dev/null 2>&1; } if have codex && ! codex_ok list; then fail "Codex: couldn't read $config, so it was left unchanged." elif codex_ok get rippit; then say "Codex: Rippit was already added." elif ! have codex && grep -qE "^[[:space:]]*\[[[:space:]]*mcp_servers[[:space:]]*\.[[:space:]]*(rippit|\"rippit\"|'rippit')[[:space:]]*\]" "$config" 2>/dev/null; then say "Codex: Rippit was already added." elif ! have codex && [ -s "$config" ]; then fail "Codex: without the codex command to check it, $config was left unchanged. Add a [mcp_servers.rippit] section with url = \"$URL\" to it." else existed=0 if [ -f "$config" ]; then existed=1; cp "$config" "$tmp/config.toml"; fi { if [ -s "$config" ]; then [ -n "$(tail -c 1 "$config")" ] && printf '\n' printf '\n' fi printf '[mcp_servers.rippit]\nurl = "%s"\n' "$URL" } >>"$config" if have codex && ! codex_ok get rippit; then if [ "$existed" -eq 1 ]; then cat "$tmp/config.toml" >"$config"; else rm -f "$config"; fi fail "Codex: adding Rippit to $config would stop Codex loading it, so it was left unchanged." else say "Codex: added Rippit. To sign in, run: codex mcp login rippit" fi fi install_skill "$codex_home/skills" "Codex" fi if have gemini; then found=1 if (cd "$HOME" && gemini mcp add --scope user --transport http rippit "$URL") /dev/null 2>&1; then say "Gemini CLI: added Rippit. To sign in, run /mcp auth rippit in Gemini CLI." else fail "Gemini CLI: couldn't add Rippit. Run: gemini mcp add --scope user --transport http rippit $URL" fi install_skill "${GEMINI_CLI_HOME:-$HOME}/.gemini/skills" "Gemini CLI" fi cursor="$HOME/.cursor/mcp.json" if have cursor || [ -d "$HOME/.cursor" ]; then found=1 if [ ! -s "$cursor" ]; then mkdir -p "$HOME/.cursor" printf '{\n "mcpServers": {\n "rippit": {\n "url": "%s"\n }\n }\n}\n' "$URL" >"$cursor" say "Cursor: added Rippit. To sign in, open Cursor Settings, then Tools & MCPs." elif have node; then node -e ' const fs = require("fs"); const [file, url] = process.argv.slice(1); const path = fs.realpathSync(file); const config = JSON.parse(fs.readFileSync(path, "utf8")) ?? {}; if (typeof config !== "object" || Array.isArray(config)) process.exit(1); const servers = config.mcpServers ?? {}; if (typeof servers !== "object" || Array.isArray(servers)) process.exit(1); if (Object.keys(servers).some(name => name.toLowerCase() === "rippit")) process.exit(3); config.mcpServers = { ...servers, rippit: { url } }; const tmp = path + ".rippit-tmp"; fs.rmSync(tmp, { force: true }); fs.writeFileSync(tmp, JSON.stringify(config, null, 2) + "\n", { mode: 0o600 }); fs.chmodSync(tmp, fs.statSync(path).mode & 0o777); fs.renameSync(tmp, path); ' "$cursor" "$URL" /dev/null case $? in 0) say "Cursor: added Rippit. To sign in, open Cursor Settings, then Tools & MCPs." ;; 3) say "Cursor: Rippit was already added." ;; *) fail "Cursor: couldn't read $cursor, so it was left unchanged. Add \"rippit\": { \"url\": \"$URL\" } under mcpServers in it." ;; esac elif grep -qi '"rippit"' "$cursor"; then say "Cursor: Rippit was already added." else fail "Cursor: couldn't update $cursor without Node. Add \"rippit\": { \"url\": \"$URL\" } under mcpServers in it." fi install_skill "$HOME/.cursor/skills" "Cursor" fi if [ "$found" -eq 0 ]; then say "No Claude Code, Codex, Gemini CLI or Cursor found. Add $URL as an MCP server in your agent: https://docs.rippit.com/supported-clients" fi exit "$failed" } main "$@"