#!/bin/bash # A1D MCP Server - Push to Hugging Face Space # Usage: ./push_to_space.sh echo "🚀 A1D MCP Server - Pushing to Hugging Face Space" echo "==================================================" # Check if we're in the right directory if [ ! -f "app.py" ]; then echo "❌ Error: app.py not found. Please run this script from the project root directory." exit 1 fi # Check if git is initialized if [ ! -d ".git" ]; then echo "❌ Error: Git repository not initialized. Please run 'git init' first." exit 1 fi echo "📋 Current git status:" git status echo "" echo "🔧 Preparing to push to Hugging Face Space..." echo "Space URL: https://huggingface.co/spaces/aigchacker/a1d-mcp-server" # Check if remote is set if ! git remote get-url origin > /dev/null 2>&1; then echo "📡 Adding remote origin..." git remote add origin https://huggingface.co/spaces/aigchacker/a1d-mcp-server else echo "✅ Remote origin already set" fi echo "" echo "🔐 Authentication Required:" echo "1. Go to: https://huggingface.co/settings/tokens" echo "2. Create a new token with 'Write' permissions" echo "3. When prompted, enter your Hugging Face username and token as password" echo "" echo "🚀 Pushing to Space..." echo "Note: You'll be prompted for your Hugging Face credentials" # Push to main branch git push -u origin main if [ $? -eq 0 ]; then echo "" echo "🎉 Successfully pushed to Hugging Face Space!" echo "📱 Your Space will be available at:" echo " https://huggingface.co/spaces/aigchacker/a1d-mcp-server" echo "" echo "⚠️ Don't forget to set the A1D_API_KEY environment variable in your Space settings!" echo " 1. Go to your Space settings" echo " 2. Add environment variable: A1D_API_KEY = your_api_key" echo " 3. Set it as 'Secret' for security" echo " 4. Restart the Space" else echo "" echo "❌ Push failed. Please check your credentials and try again." echo "" echo "🔧 Troubleshooting:" echo " - Make sure you have a valid Hugging Face token" echo " - Check your internet connection" echo " - Verify the Space URL is correct" fi