85 lines
2.9 KiB
PowerShell
85 lines
2.9 KiB
PowerShell
# GPTEdit MCP Server Launcher (PowerShell)
|
|
# This script starts the GPTEdit MCP server with proper environment setup
|
|
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
Write-Host "GPTEdit MCP Server Launcher" -ForegroundColor Cyan
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
# Change to script directory
|
|
Set-Location $PSScriptRoot
|
|
|
|
# Check if Python is available
|
|
try {
|
|
$pythonVersion = python --version 2>&1
|
|
Write-Host "Found: $pythonVersion" -ForegroundColor Green
|
|
} catch {
|
|
Write-Host "ERROR: Python is not installed or not in PATH" -ForegroundColor Red
|
|
Write-Host "Please install Python 3.8+ and add it to PATH" -ForegroundColor Yellow
|
|
Read-Host "Press Enter to exit"
|
|
exit 1
|
|
}
|
|
|
|
# Check if .env file exists
|
|
if (-not (Test-Path ".env")) {
|
|
Write-Host "WARNING: .env file not found" -ForegroundColor Yellow
|
|
if (Test-Path ".env.example") {
|
|
Write-Host "Creating .env from .env.example..." -ForegroundColor Yellow
|
|
Copy-Item ".env.example" ".env"
|
|
Write-Host "Please edit .env file with your OPENAI_API_KEY" -ForegroundColor Yellow
|
|
Read-Host "Press Enter to continue"
|
|
} else {
|
|
Write-Host "ERROR: .env.example not found" -ForegroundColor Red
|
|
Read-Host "Press Enter to exit"
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
# Check if virtual environment exists
|
|
if (Test-Path "venv\Scripts\Activate.ps1") {
|
|
Write-Host "Using virtual environment..." -ForegroundColor Green
|
|
& "venv\Scripts\Activate.ps1"
|
|
} else {
|
|
Write-Host "No virtual environment found, using system Python" -ForegroundColor Yellow
|
|
}
|
|
|
|
# Install/update dependencies
|
|
Write-Host "Checking dependencies..." -ForegroundColor Cyan
|
|
pip install -q -r requirements.txt 2>$null
|
|
|
|
# Create necessary directories
|
|
if (-not (Test-Path "generated_images")) {
|
|
New-Item -ItemType Directory -Path "generated_images" | Out-Null
|
|
Write-Host "Created generated_images directory" -ForegroundColor Green
|
|
}
|
|
|
|
if (-not (Test-Path "temp")) {
|
|
New-Item -ItemType Directory -Path "temp" | Out-Null
|
|
Write-Host "Created temp directory" -ForegroundColor Green
|
|
}
|
|
|
|
# Display configuration
|
|
Write-Host ""
|
|
Write-Host "Starting GPTEdit MCP Server..." -ForegroundColor Cyan
|
|
Write-Host "----------------------------------------" -ForegroundColor Gray
|
|
Write-Host "Output directory: " -NoNewline
|
|
Write-Host "generated_images\" -ForegroundColor Yellow
|
|
Write-Host "Log file: " -NoNewline
|
|
Write-Host "gptedit.log" -ForegroundColor Yellow
|
|
Write-Host "Config file: " -NoNewline
|
|
Write-Host ".env" -ForegroundColor Yellow
|
|
Write-Host "----------------------------------------" -ForegroundColor Gray
|
|
Write-Host ""
|
|
|
|
# Start the server
|
|
try {
|
|
python main.py
|
|
} catch {
|
|
Write-Host ""
|
|
Write-Host "ERROR: Server exited with error" -ForegroundColor Red
|
|
Write-Host "Check gptedit.log for details" -ForegroundColor Yellow
|
|
Write-Host $_.Exception.Message -ForegroundColor Red
|
|
}
|
|
|
|
Read-Host "Press Enter to exit"
|