Repository navigation
Description
What happened?
After brew upgrade --cask mcpproxy the menu bar shows two MCPProxy icons: the old tray (still running from the replaced bundle) and the freshly launched new one.
The quit-first fix from #957 / Spec 092 FR-004 lives in packaging/macos/postinstall.sh, but that script is not the one shipped in the release pkg. The pkg the cask installs (mcpproxy-<ver>-darwin-arm64.pkg inside *-installer.dmg) is built by scripts/create-pkg.sh and runs scripts/postinstall.sh, which only does:
/bin/launchctl asuser "$REAL_UID" /usr/bin/env -i ... \
/usr/bin/open -a "$APP_BUNDLE" --env MCPPROXY_LAUNCHED_BY=installerwith no quit/pgrep/pkill step. Confirmed in /var/log/install.log for a 0.75.0 upgrade: the postinstall output is the scripts/postinstall.sh one ("CLI symlink created", "Installation Summary", "Launching mcpproxy tray (installer-tagged) with clean env"), and none of the packaging/macos/postinstall.sh lines ("asking the running MCPProxy to quit", "no MCPProxy instance running") appear.
installd: PackageKit: Parent bundle com.smartmcpproxy.mcpproxy will be atomically shoved.
./postinstall: Starting mcpproxy post-installation setup...
./postinstall: ✅ CLI symlink created: /usr/local/bin/mcpproxy
./postinstall: 🎉 mcpproxy installation complete!
./postinstall: Launching mcpproxy tray (installer-tagged) with clean env: /Applications/MCPProxy.app
Because PackageKit "atomically shoves" the bundle, the running tray now belongs to a bundle that no longer exists on disk, so open -a starts a new process instead of activating the old one. The tray has no single-instance guard of its own (Spec 092 supersede handles a stale core, not a second tray), so both stay up.
sequenceDiagram
participant B as brew upgrade
participant P as PackageKit
participant S as scripts/postinstall.sh
participant Old as Old tray (running)
participant New as New tray
B->>P: installer -pkg mcpproxy-<ver>.pkg
P->>P: atomically replace /Applications/mcpproxy.app
Note over Old: keeps running from replaced bundle
P->>S: run postinstall
S->>New: open -a /Applications/MCPProxy.app
Note over Old,New: two menu bar icons
Expected behavior
The upgrade ends with exactly one tray running the new version, same as the DMG flow fixed in #957.
Suggested fix
Any of these, ideally the first two together:
- Make
scripts/create-pkg.shshippackaging/macos/postinstall.sh(or port itsquit_running_instancestep intoscripts/postinstall.sh), so there is a single postinstall for every pkg. - Add
quit: "com.smartmcpproxy.mcpproxy"to the cask'suninstallstanza inhomebrew-mcpproxy/Casks/mcpproxy.rb, so Homebrew quits the old app before replacing it. - Defense in depth: on launch, the tray checks
NSRunningApplication.runningApplications(withBundleIdentifier:)for another instance and either exits or asks the older one to terminate.
Side note while porting the quit step: packaging/macos/postinstall.sh matches pgrep -f "MCPProxy.app/Contents/MacOS/MCPProxy", but the pkg payload installs the bundle as lowercase Applications/mcpproxy.app (see pkgutil --files com.smartmcpproxy.mcpproxy.pkg). pgrep -f is case-sensitive, so on an existing lowercase install that pattern would not match the running process (/Applications/mcpproxy.app/Contents/MacOS/MCPProxy) and the quit step would be skipped. Using pgrep -if or matching Contents/MacOS/MCPProxy would avoid that.
Steps to reproduce
brew install --cask smart-mcp-proxy/mcpproxy/mcpproxy(an older version) and start the tray.brew upgrade --cask mcpproxy.- Look at the menu bar: two MCPProxy icons.
pgrep -lf MCPProxy.appshows two tray processes.
MCPProxy version
v0.75.0 (Homebrew cask, darwin/arm64)
Operating system
macOS 27 (Darwin 27.0.0), Apple Silicon
Relevant logs
/var/log/install.log excerpt above (2026-11-23 17:01, upgrade to 0.75.0).
Pre-submission checklist
- I searched existing issues and did not find a duplicate (closest: [Bug]: old version App still after upgrade #957, fixed only for
packaging/macos/postinstall.sh; Homebrew cask not auto-updated on release (only formula is) #366 is about cask auto-updates) - I ran
mcpproxy doctorand reviewed the output
Activity
fix(macos): quit the running tray in the PKG preinstall
Dumbris commentedon Nov 24, 2026
Thank you @rantoniuk, this was a very good report. Your diagnosis was right: the quit step from #957 was never in the shipped pkg, and the case-sensitive match would have missed the installed app anyway.
The fix is in #2024: the pkg now quits the running tray in a
preinstallstep, before the bundle is replaced. It will be in the next release. If you still see two icons after that upgrade, please reopen this issue.fix(cask): quit the running tray before uninstalling on upgrade (#7)
fix(macos): quit the running tray in the PKG preinstall (smart-mcp-pr…