#!/bin/sh # Forepop: connect your AI agents to Forepop (https://forepop.com). # Runs each agent's own "add MCP server" command for the agents found on this computer: Claude Code, Codex, # Gemini CLI and VS Code. No key, no sudo, nothing downloaded. Each agent signs in to Forepop the first time. set -u main() { URL="https://forepop.com/api/mcp" NAME="forepop" found=0 say() { printf '%s\n' "$*"; } have() { command -v "$1" >/dev/null 2>&1; } say "" say "Connecting your AI agents to Forepop" say "" if have claude; then found=1 if claude mcp get "$NAME" /dev/null 2>&1; then say " Claude Code already connected" elif claude mcp add --transport http --scope user "$NAME" "$URL" /dev/null 2>&1; then say " Claude Code added. In Claude Code, type /mcp and pick forepop to sign in." else say " Claude Code couldn't add it. Run: claude mcp add --transport http --scope user $NAME $URL" fi fi if have codex; then found=1 if codex mcp get "$NAME" /dev/null 2>&1; then say " Codex already connected" elif codex mcp add "$NAME" --url "$URL" /dev/null 2>&1; then say " Codex added. Run: codex mcp login $NAME" else say " Codex couldn't add it. Run: codex mcp add $NAME --url $URL" fi fi if have gemini; then found=1 if gemini mcp add --scope user --transport http "$NAME" "$URL" /dev/null 2>&1; then say " Gemini CLI added. In Gemini CLI, type /mcp auth $NAME to sign in." else say " Gemini CLI couldn't add it. Run: gemini mcp add --scope user --transport http $NAME $URL" fi fi if have code; then found=1 if code --add-mcp '{"name":"forepop","type":"http","url":"https://forepop.com/api/mcp"}' /dev/null 2>&1; then say " VS Code added. Start forepop from the MCP servers list to sign in." else say " VS Code couldn't add it. Add an HTTP MCP server named $NAME at $URL" fi fi say "" if [ "$found" -eq 0 ]; then say "No AI agent found on this computer." fi say "In the Claude or ChatGPT app, add a custom connector with this address:" say " $URL" say "" say "Then ask your agent: Use Forepop to find out how US adults would answer my survey." say "" } main "$@"