Skip to content

Commit cb0e984

Browse files
committed
Enhance auto-update functionality and documentation
- Updated AUTOUPDATE.md to clarify update modes and usage instructions. - Introduced notification-only mode for user-controlled updates. - Improved handling of Homebrew installations to prevent conflicts with auto-update. - Added support for tar.gz archive updates in the tray application. - Enhanced error handling and logging for update processes.
1 parent a7fa46b commit cb0e984

2 files changed

Lines changed: 251 additions & 123 deletions

File tree

AUTOUPDATE.md

Lines changed: 138 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -2,175 +2,193 @@
22

33
This document describes the auto-update functionality and release automation system implemented for mcpproxy.
44

5-
## Features
5+
## Update Modes
66

7-
### 1. Auto-Update via System Tray
7+
### 🔄 Auto-Update (Default - Recommended)
88

9-
- **Menu Integration**: "Check for Updates…" option in the system tray menu
10-
- **Automatic Checks**: Daily background checks for new releases (when tray is enabled)
11-
- **Seamless Updates**: Downloads and applies updates automatically
12-
- **Version Validation**: Uses semantic versioning for update detection
13-
- **Cross-Platform**: Works on macOS, Windows, and Linux
9+
- **Automatic Updates**: Downloads and applies updates automatically
10+
- **Daily Checks**: Background checks every 24 hours
11+
- **Manual Checks**: "Check for Updates..." in system tray
12+
- **Smart Detection**: Avoids conflicts with package managers
1413

15-
### 2. Release Automation
16-
17-
- **GitHub Actions**: Automated building and releasing on git tags
18-
- **GoReleaser**: Cross-platform binary generation
19-
- **Package Managers**: Optional integration with Homebrew, Winget, and Linux repos
20-
- **Docker Images**: Optional container image publishing
14+
```bash
15+
# Default mode - auto-update enabled
16+
./mcpproxy --tray=true
17+
```
2118

22-
## Usage
19+
### 🚫 Disabled Mode
2320

24-
### Enable System Tray (for Auto-Update)
21+
- **No Updates**: Completely disables update checking
22+
- **Manual Only**: User must update manually
2523

2624
```bash
27-
# Start with system tray enabled (default)
25+
# Disable auto-update completely
26+
export MCPPROXY_DISABLE_AUTO_UPDATE=true
2827
./mcpproxy --tray=true
2928

30-
# Or disable tray
31-
./mcpproxy --tray=false
29+
# Or add to shell profile for permanent setting
30+
echo 'export MCPPROXY_DISABLE_AUTO_UPDATE=true' >> ~/.zshrc
3231
```
3332

34-
### Manual Update Check
33+
### 🔔 Notification-Only Mode
3534

36-
When the system tray is running, right-click the tray icon and select "Check for Updates…".
35+
- **Check Only**: Checks for updates but doesn't download
36+
- **User Choice**: Notifies user, lets them decide
37+
- **Log Messages**: Shows update info in logs
3738

38-
### Release Process
39+
```bash
40+
# Notification-only mode
41+
export MCPPROXY_UPDATE_NOTIFY_ONLY=true
42+
./mcpproxy --tray=true
43+
```
3944

40-
1. **Create a Release**:
41-
```bash
42-
# Tag a new version (triggers release workflow)
43-
git tag v1.0.0
44-
git push origin v1.0.0
45-
```
45+
## Package Manager Integration
4646

47-
2. **The GitHub Action will**:
48-
- Run tests
49-
- Build cross-platform binaries
50-
- Create GitHub release with assets
51-
- Optionally update package managers
47+
### 🍺 Homebrew (macOS)
5248

53-
### Build with Version Info
49+
Auto-update is **automatically disabled** when installed via Homebrew to prevent conflicts:
5450

5551
```bash
56-
# Using the build script
57-
./scripts/build.sh v1.0.0
58-
59-
# Manual build with version injection
60-
go build -ldflags "-X main.version=v1.0.0" ./cmd/mcpproxy
52+
# Homebrew installation - auto-update disabled automatically
53+
brew install smart-mcp-proxy/tap/mcpproxy
6154

62-
# Check version
63-
./mcpproxy --version
55+
# Use Homebrew for updates
56+
brew upgrade mcpproxy
6457
```
6558

66-
## Configuration
59+
### 📦 Other Package Managers
6760

68-
### Repository Settings
61+
The system detects common package manager paths and disables auto-update accordingly.
6962

70-
Update these files to match your repository:
63+
## Technical Details
7164

72-
1. **internal/tray/tray.go**:
73-
```go
74-
const (
75-
repo = "smart-mcp-proxy/mcpproxy-go" // Actual repository
76-
)
77-
```
65+
### Update Process Flow
7866

79-
2. **.goreleaser.yaml**:
80-
```yaml
81-
release:
82-
github:
83-
owner: smart-mcp-proxy # Actual organization
84-
name: mcpproxy-go
85-
```
67+
```
68+
1. Check for Updates (Daily timer or manual click)
69+
2. Query GitHub API for latest release
70+
3. Compare versions using semantic versioning
71+
4. Detect installation type (standalone vs package manager)
72+
5. Download appropriate archive for OS/architecture
73+
6. Extract binary from archive
74+
7. Replace current executable atomically
75+
8. Restart application
76+
```
8677

87-
3. **Workflow files** (`.github/workflows/*.yml`):
88-
- Repository references are configured correctly
78+
### File Format Support
8979

90-
### GitHub Token
80+
- **Windows**: `.zip` archives
81+
- **macOS**: `.tar.gz` archives
82+
- **Linux**: `.tar.gz` archives
9183

92-
The release workflow uses `GITHUB_TOKEN` which is automatically provided by GitHub Actions. No additional setup needed.
84+
### Asset Detection Priority
9385

94-
## Architecture
86+
1. **Latest Assets**: `mcpproxy-latest-{os}-{arch}.{ext}`
87+
2. **Versioned Assets**: `mcpproxy-{version}-{os}-{arch}.{ext}`
9588

96-
### Auto-Update Flow
89+
### Security Features
9790

98-
```
99-
1. System Tray Menu Click / Daily Timer
100-
2. Query GitHub API for latest release
101-
3. Compare versions using semver
102-
4. Download appropriate binary for OS/arch
103-
5. Apply update using go-update library
104-
6. Restart application (OS handles restart via LaunchAgent/systemd/etc.)
105-
```
91+
- **HTTPS Only**: All downloads use HTTPS
92+
- **Atomic Updates**: Safe binary replacement with rollback
93+
- **Version Validation**: Semantic version checking prevents downgrades
94+
- **Package Manager Detection**: Prevents conflicts with system package managers
10695

107-
### Release Asset Naming
96+
## Configuration
97+
98+
### Environment Variables
99+
100+
| Variable | Values | Description |
101+
|----------|---------|-------------|
102+
| `MCPPROXY_DISABLE_AUTO_UPDATE` | `true`/`false` | Completely disable auto-update |
103+
| `MCPPROXY_UPDATE_NOTIFY_ONLY` | `true`/`false` | Check for updates but don't download |
104+
105+
### System Tray Menu
108106

109-
GoReleaser creates assets with this naming convention:
110107
```
111-
mcpproxy_v1.0.0_darwin_x86_64.tar.gz
112-
mcpproxy_v1.0.0_linux_x86_64.tar.gz
113-
mcpproxy_v1.0.0_windows_x86_64.zip
108+
mcpproxy
109+
├── Status: Running (localhost:8080)
110+
├── ─────────────────────────────
111+
├── Start/Stop Server
112+
├── ─────────────────────────────
113+
├── Check for Updates... ← Manual update check
114+
│ ├── Auto-update: Enabled ← Shows current mode
115+
│ └── [Disabled for Homebrew] ← If package manager detected
116+
├── ─────────────────────────────
117+
└── Quit
114118
```
115119

116-
The auto-updater automatically detects the correct asset for the current platform.
120+
## Troubleshooting
121+
122+
### Common Issues
117123

118-
## Platform-Specific Notes
124+
#### ❌ "no suitable asset found for darwin-arm64.zip"
125+
**Fixed**: Now looks for correct `.tar.gz` files on macOS/Linux
119126

120-
### macOS
121-
- App should be bundled in `.app` for proper tray functionality
122-
- LaunchAgent can restart the app after updates
123-
- Consider code signing for distribution
127+
#### ⚠️ "auto-update disabled for Homebrew installations"
128+
**Expected**: Prevents conflicts with `brew upgrade`
124129

125-
### Windows
126-
- Use `-H windowsgui` build flag to avoid console window
127-
- Registry Run key can restart the app after updates
128-
- Consider code signing for SmartScreen
130+
#### 🔄 Updates Not Working
131+
1. Check network connectivity
132+
2. Verify GitHub access: `curl -I https://api.github.com/repos/smart-mcp-proxy/mcpproxy-go/releases/latest`
133+
3. Check logs for specific errors
134+
4. Try notification-only mode to debug
129135

130-
### Linux
131-
- Requires display server with system tray support
132-
- systemd user service can restart the app after updates
133-
- See `scripts/mcpproxy.service` for systemd integration
136+
### Manual Update Methods
134137

135-
## Security Considerations
138+
#### Standalone Installation
139+
```bash
140+
# Download from GitHub releases
141+
curl -L -o mcpproxy.tar.gz https://github.com/smart-mcp-proxy/mcpproxy-go/releases/latest/download/mcpproxy-latest-darwin-arm64.tar.gz
142+
tar -xzf mcpproxy.tar.gz
143+
chmod +x mcpproxy
144+
./mcpproxy --version
145+
```
136146

137-
- **HTTPS Only**: All GitHub API and download requests use HTTPS
138-
- **Checksum Verification**: GoReleaser generates checksums for all assets
139-
- **Version Validation**: Semantic version validation prevents downgrade attacks
140-
- **Atomic Updates**: go-update library provides atomic binary replacement with rollback
147+
#### Homebrew
148+
```bash
149+
brew upgrade mcpproxy
150+
```
141151

142-
## Troubleshooting
152+
#### Go Install (Development)
153+
```bash
154+
go install github.com/smart-mcp-proxy/mcpproxy-go/cmd/mcpproxy@latest
155+
```
143156

144-
### Update Fails
145-
- Check network connectivity
146-
- Verify GitHub repository access
147-
- Check logs for specific error messages
157+
## Best Practices
148158

149-
### Tray Not Showing
150-
- Ensure display server supports system tray
151-
- Check if other tray applications work
152-
- Try running without `--tray=false`
159+
### For End Users
160+
- **Use Default Mode**: Auto-update provides the best experience
161+
- **Homebrew Users**: Let Homebrew handle updates
162+
- **Corporate/Restricted**: Use notification-only mode
153163

154-
### Version Mismatch
155-
- Ensure proper semantic versioning (v1.0.0 format)
156-
- Check that git tags match expected format
157-
- Verify build includes version injection
164+
### For Developers
165+
- **Test Updates**: Use development builds before releases
166+
- **Version Tags**: Follow semantic versioning (v1.0.0)
167+
- **Asset Naming**: Maintain consistent asset naming conventions
158168

159-
## Development
169+
### For System Administrators
170+
- **Disable Auto-Update**: Use `MCPPROXY_DISABLE_AUTO_UPDATE=true` for controlled environments
171+
- **Monitor Logs**: Watch for update notifications and errors
172+
- **Network Access**: Ensure GitHub API access for update checks
160173

161-
### Testing Releases
162-
Use the PR build workflow to test cross-platform compilation without creating actual releases.
174+
## Release Process
163175

164-
### Local Testing
176+
### Creating a Release
165177
```bash
166-
# Test build script
167-
./scripts/build.sh v0.1.0-test
168-
169-
# Test with specific version
170-
go run -ldflags "-X main.version=v0.1.0-test" ./cmd/mcpproxy --version
178+
# Tag a new version
179+
git tag v1.0.0
180+
git push origin v1.0.0
181+
182+
# GitHub Actions will:
183+
# 1. Build cross-platform binaries
184+
# 2. Create both versioned and latest assets
185+
# 3. Create GitHub release with download links
171186
```
172187

173-
### Dependencies
174-
- `fyne.io/systray` - System tray functionality
175-
- `github.com/inconshreveable/go-update` - Binary update mechanism
176-
- `golang.org/x/mod/semver` - Semantic version comparison
188+
### Asset Structure
189+
Each release includes:
190+
- `mcpproxy-v1.0.0-linux-amd64.tar.gz` (versioned)
191+
- `mcpproxy-latest-linux-amd64.tar.gz` (latest)
192+
- Similar files for all supported platforms
193+
194+
The auto-updater prioritizes "latest" assets for consistency with website download links.

0 commit comments

Comments
 (0)