#!/bin/bash # Quick install script for remcp # Usage: curl -sSL https://raw.githubusercontent.com/Recurse-ML/remcp/main/install.sh | bash set -e INSTALL_DIR="${HOME}/.local/bin" REPO="Recurse-ML/remcp" # Update this to your actual GitHub repo # Detect OS and architecture detect_platform() { OS=$(uname -s | tr "[:upper:]" "[:lower:]") ARCH=$(uname -m | tr "[:upper:]" "[:lower:]") # Normalize architecture names case "$ARCH" in x86_64|amd64) ARCH="amd64" ;; aarch64|arm64) ARCH="arm64" ;; *) echo "❌ Unsupported architecture: $ARCH" exit 1 ;; esac echo "${OS}-${ARCH}" } PLATFORM=$(detect_platform) BINARY_URL="https://storage.googleapis.com/remcp/releases/latest/remcp-${PLATFORM}.tar.gz" CHECKSUMS_URL="https://storage.googleapis.com/remcp/releases/latest/checksums.txt" echo "🚀 Installing remcp for ${PLATFORM}..." echo "" # Check for required dependencies echo "🔍 Checking dependencies..." missing=0 if ! command -v rg &> /dev/null; then echo " ❌ ripgrep (rg) not found" echo " Install: brew install ripgrep (or apt install ripgrep)" missing=1 else echo " ✅ ripgrep found" fi if ! command -v tree &> /dev/null; then echo " ❌ tree not found" echo " Install: brew install tree (or apt install tree)" missing=1 else echo " ✅ tree found" fi if [ $missing -eq 1 ]; then echo "" echo "❌ Missing required dependencies. Please install them and try again." exit 1 fi echo " 🎉 All dependencies found!" echo "" # Create temporary directory for download TMP_DIR=$(mktemp -d) trap "rm -rf $TMP_DIR" EXIT # Download binary echo "đŸ“Ĩ Downloading from ${BINARY_URL}..." if command -v curl > /dev/null; then curl -L --fail -o "$TMP_DIR/remcp-${PLATFORM}.tar.gz" "$BINARY_URL" curl -L --fail -o "$TMP_DIR/checksums.txt" "$CHECKSUMS_URL" 2>/dev/null || true elif command -v wget > /dev/null; then wget -q -O "$TMP_DIR/remcp-${PLATFORM}.tar.gz" "$BINARY_URL" wget -q -O "$TMP_DIR/checksums.txt" "$CHECKSUMS_URL" 2>/dev/null || true else echo "❌ Neither curl nor wget found. Please install one of them." exit 1 fi # Verify checksum if available if [ -f "$TMP_DIR/checksums.txt" ] && command -v sha256sum > /dev/null; then echo "🔐 Verifying checksum..." # Compute the checksum of the downloaded file COMPUTED_HASH=$(sha256sum "$TMP_DIR/remcp-${PLATFORM}.tar.gz" | awk '{print $1}') # Extract the expected checksum from checksums.txt EXPECTED_HASH=$(grep "remcp-${PLATFORM}.tar.gz" "$TMP_DIR/checksums.txt" | awk '{print $1}') if [ -n "$EXPECTED_HASH" ]; then if [ "$COMPUTED_HASH" = "$EXPECTED_HASH" ]; then echo "✅ Checksum verified" else echo "❌ Checksum verification failed" echo " Expected: $EXPECTED_HASH" echo " Got: $COMPUTED_HASH" exit 1 fi else echo "âš ī¸ Warning: No checksum found for remcp-${PLATFORM}.tar.gz" fi elif [ ! -f "$TMP_DIR/checksums.txt" ]; then echo "â„šī¸ Checksums not available, skipping verification" fi # Extract to temp location echo "đŸ“Ļ Extracting..." tar xzf "$TMP_DIR/remcp-${PLATFORM}.tar.gz" -C "$TMP_DIR" # The binary path needs to be executable chmod +x "$TMP_DIR/remcp/remcp" # Run preflight checks using NEW binary echo "🔍 Running pre-installation checks..." if ! "$TMP_DIR/remcp/remcp" preflight 2>/dev/null; then echo "" echo "❌ Installation aborted" exit 1 fi # All checks passed - install binary echo "đŸ“Ļ Installing to $INSTALL_DIR..." mkdir -p "$INSTALL_DIR" mkdir -p "$HOME/.remcp" rm -rf $HOME/.remcp/remcp rm -f $INSTALL_DIR/remcp mv "$TMP_DIR/remcp" "$HOME/.remcp/" ln -s $HOME/.remcp/remcp/remcp $INSTALL_DIR/remcp # Initial call to instantiate pyinstaller nohup "$INSTALL_DIR/remcp" --help > /dev/null 2>&1 & echo "" echo "✅ remcp installed successfully to $INSTALL_DIR/remcp" echo "" echo "📝 Next steps:" echo " 1. Make sure $INSTALL_DIR is in your PATH" echo " Add to ~/.bashrc or ~/.zshrc:" echo " export PATH=\"\$HOME/.local/bin:\$PATH\"" echo "" echo " 2. Authenticate with GitHub:" echo " remcp auth" echo "" echo " 3. Add MCP server to Claude Code:" echo " claude mcp add remcp --scope user -- remcp serve" echo "" echo " 4. Restart Claude Code and start using remcp!" echo ""