1+ #! /bin/bash
2+ set -e
3+
4+ # Script to create macOS DMG containing PKG installer
5+ PKG_PATH=" $1 "
6+ VERSION=" $2 "
7+ ARCH=" $3 "
8+
9+ if [ -z " $PKG_PATH " ] || [ -z " $VERSION " ] || [ -z " $ARCH " ]; then
10+ echo " Usage: $0 <pkg_path> <version> <arch>"
11+ echo " Example: $0 ./mcpproxy-v1.0.0-darwin-arm64.pkg v1.0.0 arm64"
12+ exit 1
13+ fi
14+
15+ if [ ! -f " $PKG_PATH " ]; then
16+ echo " PKG file not found: $PKG_PATH "
17+ exit 1
18+ fi
19+
20+ # Variables
21+ APP_NAME=" mcpproxy"
22+ DMG_NAME=" mcpproxy-${VERSION# v} -darwin-${ARCH} -installer"
23+ TEMP_DIR=" dmg_installer_temp"
24+
25+ echo " Creating installer DMG for ${APP_NAME} ${VERSION} (${ARCH} )"
26+
27+ # Clean up previous builds
28+ rm -rf " $TEMP_DIR "
29+ rm -f " ${DMG_NAME} .dmg"
30+
31+ # Create temporary directory
32+ mkdir -p " $TEMP_DIR "
33+
34+ # Copy PKG to temp directory
35+ cp " $PKG_PATH " " $TEMP_DIR /"
36+ PKG_FILENAME=$( basename " $PKG_PATH " )
37+
38+ # Create README file
39+ cat > " $TEMP_DIR /README.txt" << EOF
40+ Smart MCP Proxy ${VERSION# v} Installer
41+
42+ Welcome to Smart MCP Proxy!
43+
44+ INSTALLATION:
45+ 1. Double-click the ${PKG_FILENAME} file to start installation
46+ 2. Follow the installer instructions
47+ 3. The app will be installed to your Applications folder
48+ 4. CLI tool 'mcpproxy' will be available in Terminal
49+
50+ FEATURES:
51+ • Intelligent MCP server proxy with tool discovery
52+ • System tray application for easy management
53+ • Built-in security quarantine for new servers
54+ • HTTP by default, optional HTTPS with certificate trust
55+
56+ GETTING STARTED:
57+ • Open mcpproxy from Applications folder
58+ • Or run 'mcpproxy --help' in Terminal
59+ • Default mode: HTTP (works immediately)
60+ • For HTTPS: run 'mcpproxy trust-cert' first
61+
62+ OPTIONAL HTTPS SETUP:
63+ 1. Trust certificate: mcpproxy trust-cert
64+ 2. Enable HTTPS: export MCPPROXY_TLS_ENABLED=true
65+ 3. Start server: mcpproxy serve
66+
67+ For Claude Desktop with HTTPS, add to config:
68+ "env": {
69+ "NODE_EXTRA_CA_CERTS": "~/.mcpproxy/certs/ca.pem"
70+ }
71+
72+ Visit https://github.com/smart-mcp-proxy/mcpproxy-go for documentation.
73+
74+ Happy proxying! 🚀
75+ EOF
76+
77+ # Create background image directory (optional)
78+ mkdir -p " $TEMP_DIR /.background"
79+
80+ # Copy or create a simple background if you want one
81+ # For now, we'll skip the background image
82+
83+ # Create DMG using hdiutil
84+ echo " Creating DMG..."
85+ hdiutil create -size 100m -fs HFS+ -volname " Smart MCP Proxy ${VERSION# v} Installer" -srcfolder " $TEMP_DIR " " ${DMG_NAME} .dmg"
86+
87+ # Clean up
88+ rm -rf " $TEMP_DIR "
89+
90+ echo " DMG created: ${DMG_NAME} .dmg"
91+
92+ # Make DMG read-only and compressed
93+ echo " Compressing DMG..."
94+ hdiutil convert " ${DMG_NAME} .dmg" -format UDZO -o " ${DMG_NAME} -compressed.dmg"
95+ mv " ${DMG_NAME} -compressed.dmg" " ${DMG_NAME} .dmg"
96+
97+ # Sign DMG
98+ echo " Signing DMG..."
99+
100+ # Find the Developer ID certificate identity
101+ CERT_IDENTITY=$( security find-identity -v -p codesigning | grep " Developer ID Application" | head -1 | grep -o ' "[^"]*"' | tr -d ' "' )
102+
103+ # Verify we found a valid certificate
104+ if [ -n " ${CERT_IDENTITY} " ]; then
105+ echo " ✅ Found Developer ID certificate for DMG: ${CERT_IDENTITY} "
106+
107+ # Sign DMG with proper certificate and timestamp
108+ codesign --force \
109+ --sign " ${CERT_IDENTITY} " \
110+ --timestamp \
111+ " ${DMG_NAME} .dmg"
112+
113+ # Verify DMG signing
114+ echo " === Verifying DMG signature ==="
115+ codesign --verify --verbose " ${DMG_NAME} .dmg"
116+ echo " DMG verification: $? "
117+
118+ codesign --display --verbose=4 " ${DMG_NAME} .dmg"
119+
120+ echo " ✅ DMG created and signed successfully: ${DMG_NAME} .dmg"
121+ else
122+ echo " ❌ No Developer ID certificate found for DMG, using ad-hoc signature"
123+ echo " This will NOT work for notarization!"
124+ codesign --force --sign - " ${DMG_NAME} .dmg"
125+ echo " ⚠️ DMG created with ad-hoc signature: ${DMG_NAME} .dmg"
126+ fi
127+
128+ echo " Installer DMG created successfully: ${DMG_NAME} .dmg"
0 commit comments