auth-helper.sh•3.95 kB
#!/bin/bash
# Manual Authentication Helper for MCP Google Drive Server
# Use this when running on a headless server
echo "╔══════════════════════════════════════════════════════════════════════╗"
echo "║ MANUAL OAUTH AUTHENTICATION FOR HEADLESS SERVER ║"
echo "╚══════════════════════════════════════════════════════════════════════╝"
echo ""
echo "Since this is a headless server without a browser, you have two options:"
echo ""
echo "════════════════════════════════════════════════════════════════════════"
echo "OPTION 1: SSH Port Forwarding (Recommended)"
echo "════════════════════════════════════════════════════════════════════════"
echo ""
echo "From your Windows machine, reconnect to this server with port forwarding:"
echo ""
echo " ssh -L 3000:localhost:3000 pi@192.168.1.114"
echo ""
echo "Then from this terminal, run:"
echo " npm run start:http"
echo ""
echo "The OAuth flow will redirect to localhost:3000 which will tunnel through"
echo "SSH to this server, completing the authentication."
echo ""
echo "════════════════════════════════════════════════════════════════════════"
echo "OPTION 2: Use Environment Variable Display"
echo "════════════════════════════════════════════════════════════════════════"
echo ""
echo "Set DISPLAY environment variable to force URL display:"
echo ""
echo " export DISPLAY=:0"
echo " npm run start:http"
echo ""
echo "This will show the authentication URL that you can copy and open"
echo "on your Windows browser."
echo ""
echo "════════════════════════════════════════════════════════════════════════"
echo "OPTION 3: Copy token from existing installation (Easiest)"
echo "════════════════════════════════════════════════════════════════════════"
echo ""
echo "If you have already authenticated on your Windows machine with this"
echo "Google Drive MCP server, you can copy the token file:"
echo ""
echo "Windows location (typically):"
echo " c:\\Users\\akona\\OneDrive\\Dev\\Google_Drive_MCP\\mcp-gdrive\\.gdrive-server-credentials.json"
echo ""
echo "Or in your credentials directory on Windows, find:"
echo " .gdrive-server-credentials.json"
echo " token.json"
echo ""
echo "Copy to this server at:"
echo " /home/pi/.config/mcp-gdrive/.gdrive-server-credentials.json"
echo ""
echo "Example command (if you have the file):"
echo " # From Windows (using WSL or Git Bash):"
echo " scp /path/to/.gdrive-server-credentials.json pi@192.168.1.114:/home/pi/.config/mcp-gdrive/"
echo ""
echo " # Or using WinSCP/FileZilla GUI tools"
echo ""
echo "════════════════════════════════════════════════════════════════════════"
echo ""
read -p "Press Enter to continue..."