Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- Config, docs, scripts, and backup manifests - Submodule refs unchanged (m = modified content in submodules) Made-with: Cursor
106 lines
3.4 KiB
Bash
Executable File
106 lines
3.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Setup script for Proxmox MCP Server and workspace
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
ENV_FILE="$HOME/.env"
|
|
ENV_EXAMPLE="$PROJECT_ROOT/.env.example"
|
|
ENV_REPO="$PROJECT_ROOT/.env"
|
|
CLAUDE_CONFIG_DIR="$HOME/.config/Claude"
|
|
CLAUDE_CONFIG="$CLAUDE_CONFIG_DIR/claude_desktop_config.json"
|
|
CLAUDE_CONFIG_EXAMPLE="$SCRIPT_DIR/claude_desktop_config.json.example"
|
|
|
|
echo "🚀 Proxmox MCP Server Setup"
|
|
echo "============================"
|
|
echo ""
|
|
|
|
# Step 1: Ensure .env exists (repo root and/or ~/.env)
|
|
# Many scripts source PROJECT_ROOT/.env; load-env.sh and some scripts use ~/.env
|
|
if [ -f "$ENV_EXAMPLE" ]; then
|
|
if [ ! -f "$ENV_REPO" ]; then
|
|
echo "📝 Creating repo root .env from template..."
|
|
cp "$ENV_EXAMPLE" "$ENV_REPO"
|
|
echo "✅ Created $ENV_REPO"
|
|
else
|
|
echo "✅ Repo root .env already exists at $ENV_REPO"
|
|
fi
|
|
if [ ! -f "$ENV_FILE" ]; then
|
|
echo "📝 Creating ~/.env from template..."
|
|
cp "$ENV_EXAMPLE" "$ENV_FILE"
|
|
echo "✅ Created $ENV_FILE"
|
|
else
|
|
echo "✅ ~/.env already exists at $ENV_FILE"
|
|
fi
|
|
echo "⚠️ Edit $ENV_REPO and/or $ENV_FILE with your credentials (Proxmox, Cloudflare, NPM, etc.)"
|
|
else
|
|
# Fallback: create minimal ~/.env if no template
|
|
if [ ! -f "$ENV_FILE" ]; then
|
|
echo "📝 Creating minimal ~/.env (no template found at $ENV_EXAMPLE)..."
|
|
cat > "$ENV_FILE" << 'EOF'
|
|
# Proxmox MCP Server Configuration
|
|
# Fill in your actual values below
|
|
|
|
# Proxmox Configuration (REQUIRED)
|
|
PROXMOX_HOST=your-proxmox-ip-or-hostname
|
|
PROXMOX_USER=root@pam
|
|
PROXMOX_TOKEN_NAME=your-token-name
|
|
PROXMOX_TOKEN_VALUE=your-token-secret
|
|
|
|
# Security Settings (REQUIRED)
|
|
# ⚠️ WARNING: Setting PROXMOX_ALLOW_ELEVATED=true enables DESTRUCTIVE operations
|
|
PROXMOX_ALLOW_ELEVATED=false
|
|
|
|
# Optional Settings
|
|
# PROXMOX_PORT=8006 # Defaults to 8006 if not specified
|
|
EOF
|
|
echo "✅ Created $ENV_FILE"
|
|
echo "⚠️ Please edit $ENV_FILE and add your Proxmox credentials!"
|
|
fi
|
|
fi
|
|
|
|
# Step 2: Setup Claude Desktop config
|
|
echo ""
|
|
echo "📝 Setting up Claude Desktop configuration..."
|
|
|
|
if [ ! -d "$CLAUDE_CONFIG_DIR" ]; then
|
|
mkdir -p "$CLAUDE_CONFIG_DIR"
|
|
echo "✅ Created Claude config directory: $CLAUDE_CONFIG_DIR"
|
|
fi
|
|
|
|
if [ ! -f "$CLAUDE_CONFIG" ]; then
|
|
echo "📝 Creating Claude Desktop config from template..."
|
|
if [ -f "$CLAUDE_CONFIG_EXAMPLE" ]; then
|
|
# Replace the path in the example with the actual path
|
|
sed "s|/home/intlc/projects/proxmox|$SCRIPT_DIR|g" "$CLAUDE_CONFIG_EXAMPLE" > "$CLAUDE_CONFIG"
|
|
echo "✅ Created $CLAUDE_CONFIG"
|
|
echo "⚠️ Please verify the configuration and restart Claude Desktop!"
|
|
else
|
|
echo "❌ Template file not found: $CLAUDE_CONFIG_EXAMPLE"
|
|
exit 1
|
|
fi
|
|
else
|
|
echo "✅ Claude Desktop config already exists at $CLAUDE_CONFIG"
|
|
echo "⚠️ Skipping creation to avoid overwriting existing config"
|
|
echo " If you want to update it, manually edit: $CLAUDE_CONFIG"
|
|
fi
|
|
|
|
# Step 3: Install dependencies
|
|
echo ""
|
|
echo "📦 Installing workspace dependencies..."
|
|
cd "$PROJECT_ROOT"
|
|
pnpm install
|
|
|
|
echo ""
|
|
echo "✅ Setup complete!"
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo "1. Edit $ENV_FILE with your Proxmox credentials"
|
|
echo "2. Verify Claude Desktop config at $CLAUDE_CONFIG"
|
|
echo "3. Restart Claude Desktop"
|
|
echo "4. Test the MCP server with: pnpm test:basic"
|
|
|