#!/bin/sh # Oxynet MCP installer. curl -fsSL https://app.oxynet.net/install | sh # # Registers the Oxynet MCP server with whichever assistant CLI you have, then # verifies the key works. Read it before running it. It is short on purpose. # # Your key is NOT written into any config file: the server entry references # $OXYNET_API_KEY and the installer puts the export in your shell profile, so # the secret never lands in agent config or in a command line. set -eu BASE="https://app.oxynet.net" MCP_URL="$BASE/oxynet-mcp" printf 'Oxynet MCP setup ' if [ -n "${OXYNET_API_KEY:-}" ]; then KEY="$OXYNET_API_KEY" printf 'Using OXYNET_API_KEY from your environment. ' else printf 'Paste your Oxynet API key (starts with sk_live_): ' # Read from the terminal, not stdin, because stdin is the piped script. if [ -r /dev/tty ]; then stty -echo 2>/dev/null || true read -r KEY < /dev/tty stty echo 2>/dev/null || true printf ' ' else printf ' No terminal available. Re-run as: ' printf ' OXYNET_API_KEY=sk_live_... sh -c "$(curl -fsSL %s/install)" ' "$BASE" exit 1 fi fi case "$KEY" in sk_*) ;; *) printf 'That does not look like an Oxynet key (expected sk_live_...). '; exit 1 ;; esac printf 'Checking the key... ' CODE=$(curl -s -o /dev/null -w '%{http_code}' -H "X-API-Key: $KEY" "$BASE/v1/capabilities") if [ "$CODE" != "200" ]; then printf 'rejected (HTTP %s). ' "$CODE" printf 'The key may be wrong, expired, or not yet active. ' exit 1 fi printf 'ok. ' # Persist the key for future shells. The MCP entry references it by name. PROFILE="" for f in "$HOME/.zshrc" "$HOME/.bashrc" "$HOME/.profile"; do [ -f "$f" ] && PROFILE="$f" && break done [ -z "$PROFILE" ] && PROFILE="$HOME/.profile" if ! grep -q 'OXYNET_API_KEY' "$PROFILE" 2>/dev/null; then printf ' export OXYNET_API_KEY=%s ' "$KEY" >> "$PROFILE" printf 'Added OXYNET_API_KEY to %s ' "$PROFILE" fi INSTALLED=0 if command -v claude >/dev/null 2>&1; then claude mcp add-json oxynet "{\"type\":\"http\",\"url\":\"$MCP_URL\",\"headers\":{\"X-API-Key\":\"\${OXYNET_API_KEY}\"}}" --scope user >/dev/null 2>&1 && { printf 'Registered with Claude Code. '; INSTALLED=1; } fi if [ -d "$HOME/.gemini" ]; then printf 'Gemini CLI detected. Add this to ~/.gemini/settings.json: ' printf ' {"mcpServers": {"oxynet": {"httpUrl": "%s", ' "$MCP_URL" printf ' "headers": {"X-API-Key": "%s"}}}} ' '' fi if [ "$INSTALLED" = "0" ]; then printf ' No supported CLI found. Connect manually: ' printf ' %s/connect ' "$BASE" exit 0 fi printf ' Done. Run: export OXYNET_API_KEY=%s ' "$KEY" printf 'in this shell (new shells pick it up automatically), then start claude ' printf 'and ask: "analyse this CPET with Oxynet". '