#!/bin/sh # MCPShield Agent Installer # Usage: curl -fsSL https://install.mcpshield.app | sh set -e RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m' CYAN='\033[0;36m'; BOLD='\033[1m'; NC='\033[0m' echo "" echo "${BLUE}╔═══════════════════════════════════════════════╗${NC}" echo "${BLUE}║ ${BOLD}MCPShield Agent Installer${NC}${BLUE} ║${NC}" echo "${BLUE}║ AI Agent Security Scanner ║${NC}" echo "${BLUE}║ https://mcpshield.app ║${NC}" echo "${BLUE}╚═══════════════════════════════════════════════╝${NC}" echo "" # Detect OS case "$OSTYPE" in darwin*) OS="macos" ;; linux*) OS="linux" ;; msys*|cygwin*) echo "Windows detected. Run: pip install mcpshield-agent"; exit 1 ;; *) echo "Unsupported OS: $OSTYPE"; exit 1 ;; esac echo "${GREEN}✓${NC} Detected: $OS" # Find Python 3.8+ PYTHON="" for cmd in python3.12 python3.11 python3.10 python3.9 python3.8 python3 python; do if command -v "$cmd" >/dev/null 2>&1; then ver=$($cmd -c 'import sys; print("%d.%d" % sys.version_info[:2])') major=$(echo "$ver" | cut -d. -f1) minor=$(echo "$ver" | cut -d. -f2) if [ "$major" -ge 3 ] && [ "$minor" -ge 8 ]; then PYTHON="$cmd"; echo "${GREEN}✓${NC} Found Python $ver ($cmd)"; break fi fi done [ -z "$PYTHON" ] && echo "${RED}✗${NC} Python 3.8+ required. Install it first." && exit 1 # Install agent echo "" echo "${CYAN}Installing mcpshield-agent...${NC}" $PYTHON -m pip install --user --upgrade --quiet mcpshield-agent echo "${GREEN}✓${NC} mcpshield-agent installed" # Locate binary MCPSHIELD="" for p in "$HOME/.local/bin/mcpshield" "/usr/local/bin/mcpshield"; do [ -f "$p" ] && MCPSHIELD="$p" && break done [ -z "$MCPSHIELD" ] && MCPSHIELD="$PYTHON -m mcpshield_agent" # Prompt for API key echo "" echo "${CYAN}Enter your API key from https://app.mcpshield.app/settings${NC}" printf "API Key: " stty -echo 2>/dev/null; read -r API_KEY; stty echo 2>/dev/null; echo "" if [ -n "$API_KEY" ]; then $MCPSHIELD configure --api-key "$API_KEY" --api-url "https://api.mcpshield.app" echo "" printf "Start background service now? [Y/n] " read -r REPLY case "$REPLY" in [Nn]*) ;; *) $MCPSHIELD start ;; esac fi # PATH hint USER_BIN="$HOME/.local/bin" case ":$PATH:" in *":$USER_BIN:"*) ;; *) echo ""; echo "${YELLOW}Add to your shell profile:${NC} export PATH=\"\$PATH:$USER_BIN\"" ;; esac echo "" echo "${GREEN}${BOLD}✓ MCPShield agent installed!${NC}" echo " Dashboard: https://app.mcpshield.app" echo " Run scan: mcpshield scan" echo ""