#!/bin/bash
# MCP Setup Runner Script
# This script runs the PowerShell setup from bash/WSL
echo "🎭 MCP Puppet Production Setup Runner"
echo "====================================="
# Detect environment
if command -v pwsh &> /dev/null; then
# PowerShell Core is available
POWERSHELL_CMD="pwsh"
echo "✅ Found PowerShell Core (pwsh)"
elif command -v powershell.exe &> /dev/null; then
# Windows PowerShell via WSL
POWERSHELL_CMD="powershell.exe"
echo "✅ Found Windows PowerShell via WSL"
elif [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "cygwin" ]]; then
# Git Bash on Windows
POWERSHELL_CMD="powershell"
echo "✅ Found PowerShell via Git Bash"
else
echo "❌ PowerShell not found. This script requires PowerShell to run the MCP setup."
echo ""
echo "Options:"
echo "1. Install PowerShell Core: https://github.com/PowerShell/PowerShell"
echo "2. Use WSL with PowerShell access"
echo "3. Run the .ps1 file directly in Windows PowerShell"
exit 1
fi
# Define the PowerShell script path
PS_SCRIPT_PATH="/mnt/c/Claude/update_mcp_setup.ps1"
WINDOWS_PS_SCRIPT_PATH="C:\\Claude\\update_mcp_setup.ps1"
# Check if script exists (try different path formats)
if [[ -f "$PS_SCRIPT_PATH" ]]; then
SCRIPT_TO_RUN="$PS_SCRIPT_PATH"
echo "✅ Found script at: $PS_SCRIPT_PATH"
elif [[ -f "update_mcp_setup.ps1" ]]; then
SCRIPT_TO_RUN="./update_mcp_setup.ps1"
echo "✅ Found script in current directory"
elif [[ -f "/c/Claude/update_mcp_setup.ps1" ]]; then
SCRIPT_TO_RUN="/c/Claude/update_mcp_setup.ps1"
echo "✅ Found script at: /c/Claude/update_mcp_setup.ps1"
else
echo "❌ PowerShell script not found at expected locations:"
echo " - $PS_SCRIPT_PATH"
echo " - ./update_mcp_setup.ps1"
echo " - /c/Claude/update_mcp_setup.ps1"
echo ""
echo "Please ensure the script exists or copy it to one of these locations."
exit 1
fi
# Check if running as administrator/root
if [[ $EUID -ne 0 ]] && [[ "$POWERSHELL_CMD" != "powershell.exe" ]]; then
echo "⚠️ Warning: Not running as root. Some operations may fail."
echo "Consider running with: sudo $0"
echo ""
read -p "Continue anyway? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
fi
echo ""
echo "🚀 Running PowerShell MCP Setup Script..."
echo "========================================"
# Execute the PowerShell script
if [[ "$POWERSHELL_CMD" == "powershell.exe" ]]; then
# WSL calling Windows PowerShell
echo "Running via WSL -> Windows PowerShell..."
powershell.exe -ExecutionPolicy Bypass -File "$WINDOWS_PS_SCRIPT_PATH"
else
# PowerShell Core or other
echo "Running via $POWERSHELL_CMD..."
$POWERSHELL_CMD -ExecutionPolicy Bypass -File "$SCRIPT_TO_RUN"
fi
# Check exit code
if [[ $? -eq 0 ]]; then
echo ""
echo "✅ MCP Setup completed successfully!"
echo ""
echo "🎯 Next Steps:"
echo "1. Restart Claude Desktop"
echo "2. Test puppet production tools"
echo "3. Upload a photo to create a character"
else
echo ""
echo "❌ MCP Setup failed. Check the output above for errors."
echo ""
echo "💡 Try:"
echo "1. Running as administrator"
echo "2. Checking PowerShell execution policy"
echo "3. Running the .ps1 file directly in Windows PowerShell"
fi