You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
stdio servers can't find binaries (uvx, npx) when launched from macOS .app #439
stdio servers can't find binaries (uvx, npx, etc.) when launched from macOS .app
Problem
When MCPProxy is launched from the macOS .app bundle (Finder, Dock, or Login Items), stdio MCP servers fail to start because tools like uvx, npx, node, python etc. are not found in PATH.
Launching from a terminal (open -a MCPProxy or mcpproxy serve) works fine because the process inherits the shell's full PATH.
Root Cause
macOS GUI apps launched via launchd inherit a minimal PATH: /usr/bin:/bin:/usr/sbin:/sbin. The Swift tray app passes this to the Go core via ProcessInfo.processInfo.environment, and the Go core passes it to child processes via secureenv.BuildSecureEnvironment().
The existing EnhancePath logic in secureenv/manager.go only activates when len(pathParts) <= 2, but the launchd PATH has 4 entries, so the enhancement never triggers.
The shell wrapping (zsh -l -c '...') should help, but cmd.Env is explicitly set on the child process, which can interfere with profile-based PATH setup (especially for nvm, pyenv, mise, etc. that use conditional logic).
Meanwhile, shellwrap.LoginShellPATH() already solves this exact problem for Docker credential helpers — it runs <shell> -l -c 'printf %s "$PATH"' once and caches the result — but secureenv.BuildSecureEnvironment() never calls it.
Workaround
Launch the app from a terminal: open -a MCPProxy
Environment
macOS (Apple Silicon and Intel)
Affects any stdio server using tools not in /usr/bin:/bin:/usr/sbin:/sbin
Drops the len(pathParts) <= 2 gate in secureenv.buildEnhancedPath that was blocking enhancement for the launchd-handed 4-entry PATH (/usr/bin:/bin:/usr/sbin:/sbin).
Merges in the user's interactive login-shell PATH via shellwrap.LoginShellPATH — so non-standard installs (mise / asdf / Colima / custom shims) get picked up too, not just /usr/local/bin and /opt/homebrew/bin.
Hardens LoginShellPATH against rc-file banner contamination (oh-my-zsh / motd / direnv stdout) by bracketing the captured $PATH with unique markers.
Verified locally with env -i PATH=/usr/bin:/bin:/usr/sbin:/sbin — pre-fix that 4-entry PATH leaves uvx, npx, node, brew all unresolvable; post-fix secureenv.BuildSecureEnvironment produces a 14-entry PATH and all four resolve.
v0.28.1 binaries will be available on the releases page once the cross-platform build pipeline finishes (≈10–20 min). On macOS the .dmg goes through notarization so it lands a bit later. After upgrading, please relaunch from Finder/Dock/Login-Item and confirm your stdio servers connect — and reopen the issue if anything still misbehaves.
Activity
test(secureenv): drop /usr/local/bin position assertion in TestDocker…
fix(secureenv): inherit user's interactive PATH so stdio servers find…
Dumbris commentedon Apr 30, 2026
Thank you for the detailed bug report — the diagnosis was spot-on. ✨
PR #440 is merged and tagged as v0.28.1. The fix:
len(pathParts) <= 2gate insecureenv.buildEnhancedPaththat was blocking enhancement for the launchd-handed 4-entry PATH (/usr/bin:/bin:/usr/sbin:/sbin).shellwrap.LoginShellPATH— so non-standard installs (mise / asdf / Colima / custom shims) get picked up too, not just/usr/local/binand/opt/homebrew/bin.LoginShellPATHagainst rc-file banner contamination (oh-my-zsh / motd / direnv stdout) by bracketing the captured$PATHwith unique markers.Verified locally with
env -i PATH=/usr/bin:/bin:/usr/sbin:/sbin— pre-fix that 4-entry PATH leavesuvx,npx,node,brewall unresolvable; post-fixsecureenv.BuildSecureEnvironmentproduces a 14-entry PATH and all four resolve.v0.28.1 binaries will be available on the releases page once the cross-platform build pipeline finishes (≈10–20 min). On macOS the .dmg goes through notarization so it lands a bit later. After upgrading, please relaunch from Finder/Dock/Login-Item and confirm your stdio servers connect — and reopen the issue if anything still misbehaves.