#!/bin/bash # Build the Apple MCP Config .app bundle set -e SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" APP_NAME="Apple MCP Config" APP_BUNDLE="$SCRIPT_DIR/$APP_NAME.app" SERVER_DIR="$(dirname "$SCRIPT_DIR")" echo "=== Building $APP_NAME ===" # Clean previous build rm -rf "$APP_BUNDLE" # Create .app bundle structure mkdir -p "$APP_BUNDLE/Contents/MacOS" mkdir -p "$APP_BUNDLE/Contents/Resources/server/apps" mkdir -p "$APP_BUNDLE/Contents/Resources/server/helpers" # Compile Swift echo "Compiling SwiftUI app..." swiftc "$SCRIPT_DIR/AppleMCPConfig.swift" \ -o "$APP_BUNDLE/Contents/MacOS/$APP_NAME" \ -target arm64-apple-macosx14.0 \ -framework SwiftUI \ -framework AppKit \ -parse-as-library \ -Osize # Create Info.plist cat > "$APP_BUNDLE/Contents/Info.plist" << 'PLIST' CFBundleName Apple MCP Config CFBundleDisplayName Apple MCP Config CFBundleIdentifier io.jfamily.apple-mcp-config CFBundleVersion 1.0 CFBundleShortVersionString 1.0 CFBundlePackageType APPL CFBundleExecutable Apple MCP Config LSMinimumSystemVersion 14.0 NSHighResolutionCapable LSApplicationCategoryType public.app-category.utilities NSRemindersUsageDescription Apple MCP Config needs access to Reminders to provide Claude with reminder data. PLIST # Bundle server files into Resources echo "Bundling server files..." cp "$SERVER_DIR/apple_mcp.py" "$APP_BUNDLE/Contents/Resources/server/" cp "$SERVER_DIR/helpers.py" "$APP_BUNDLE/Contents/Resources/server/" cp "$SERVER_DIR/requirements.txt" "$APP_BUNDLE/Contents/Resources/server/" cp "$SERVER_DIR/config.json" "$APP_BUNDLE/Contents/Resources/server/" cp "$SERVER_DIR/apps/"*.py "$APP_BUNDLE/Contents/Resources/server/apps/" # Bundle helpers (Swift source — compiled during install) cp "$SERVER_DIR/helpers/reminders_helper.swift" "$APP_BUNDLE/Contents/Resources/server/helpers/" # Also include pre-compiled binary if it exists if [ -f "$SERVER_DIR/helpers/reminders_helper" ]; then cp "$SERVER_DIR/helpers/reminders_helper" "$APP_BUNDLE/Contents/Resources/server/helpers/" fi echo "" echo "=== Build Complete ===" echo "App: $APP_BUNDLE" echo "" echo "To use: double-click '$APP_NAME.app' or run:" echo " open \"$APP_BUNDLE\""