Skip to content

stdio servers can't find binaries (uvx, npx) when launched from macOS .app #439

Closed

Description

@roeseth

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

Activity

  1. added a commit that references this issue on Apr 30, 2026
    2e47b9c
  2. Dumbris commented on Apr 30, 2026

    @Dumbris
    Member

    Thank you for the detailed bug report — the diagnosis was spot-on. ✨

    PR #440 is merged and tagged as v0.28.1. The fix:

    • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions