Replies: 1 comment 1 reply
|
This is an excellent write-up — you read the code correctly, and your proposed design is essentially what we implemented. Apologies for the long silence. Implemented in #847: a persisted Two things worth reporting back, since you did the archaeology on this: 1. The Go tray already had this flag. 2. The design constraint that shaped it. The tray and core are decoupled — they talk only over the Unix socket / HTTP — so this setting cannot live in the core’s config: the whole point is to read it when no core is running, and then there is nothing to ask. It is tray-local ( So with the toggle off and no core up, the tray idles and watches the socket — meaning a core you start yourself later (CLI, launchd, brew services) is picked up automatically, without restarting the tray. An explicit On your suggestion to persist Your report also led us to two genuine bugs in that area, now fixed in the same PR:
Thanks for the detailed analysis — including the ~1.8 GB RSS measurement, which made the case concrete. |
Uh oh!
There was an error while loading. Please reload this page.
Feature Description
Add a macOS app preference that allows the tray app to launch without immediately starting the MCPProxy Core server process.
Today, opening the macOS tray app automatically starts or attaches to the Core process. Users can stop the Core manually afterward, but the stopped state is not persisted across app launches. A user who wants MCPProxy available in the menu bar, but does not currently need any AI/MCP client, cannot keep the tray app open without also starting the Core and its downstream MCP server process tree.
The requested feature is a persistent user setting such as:
or:
When disabled, the tray app should open in a stopped/idle state and expose the existing manual action:
Motivation
MCPProxy Core can keep a significant process tree alive, especially when configured upstream MCP servers start eagerly. In one observed setup, the MCPProxy process tree, including child MCP server processes, used approximately 1.8 GB RSS.
This is wasteful if the user wants the MCPProxy tray app available but is not currently using any AI application or MCP client.
A lazy/manual Core startup mode would allow users to:
This is especially useful for users who only occasionally launch AI clients but still want MCPProxy to be easy to start from the menu bar.
Current Behavior
The macOS tray app currently starts the Core unconditionally during app launch.
Relevant file:
In
applicationDidFinishLaunching, the app calls:startCore()then creates aCoreProcessManagerand starts it:CoreProcessManager.start()checks for an existing socket and attaches to a live Core if present. Otherwise, it launches a new Core subprocess:The subprocess launch path eventually runs:
So the current launch sequence is effectively:
Existing Manual Start/Stop Support
The app already has UI and state support for manually stopping and starting the Core.
Relevant state:
Relevant menu behavior:
When stopped, the menu shows:
When running, the menu shows:
The main window banner also supports starting the Core by posting:
However,
isStoppedis currently in-memory only. It is not persisted withUserDefaults, so stopping the Core only affects the current app session. On the next app launch, Core starts automatically again.Expected Behavior
Users should be able to configure whether the macOS tray app starts the Core automatically.
Example expected behavior:
Start MCPProxy Core when app opens.Start MCPProxy Coreaction.Suggested UX
Possible UI labels:
or:
Possible placement:
Run at Startup.This setting should be separate from
Run at Startup/ Login Item behavior:Run at Startup: controls whether the tray app launches at macOS login.Start Core on App Launch: controls whether the Core server starts when the tray app opens.Proposed Implementation Direction
One possible implementation would be to add a persisted preference, for example via
UserDefaults, and use it to decide whetherapplicationDidFinishLaunchingcallsstartCore().The app already uses
UserDefaultsfor persisted UI state such asfontScale, so this would fit the existing pattern.Example concept:
Then app launch could choose between:
The default should probably remain
trueto preserve current behavior for existing users.This is only a possible implementation sketch; maintainers may prefer a different state/config structure.
Alternatives Considered
Use the existing Stop action after launch
This works only after Core has already started. It does not avoid the startup memory/process cost, and it does not persist across launches.
Disable
Run at StartupThis prevents the tray app from launching at login, but it does not solve the case where the user wants the tray app available without starting Core immediately.
Rely on external process management
Users could avoid opening the app or manually kill the Core process, but that bypasses the app’s own lifecycle/UI and is not a good user experience.
Scope / Effort Estimate
Medium.
Likely touched areas:
Potential test coverage areas:
applicationDidFinishLaunchingdoes not callstartCore()automatically.Start MCPProxy Coreaction still starts Core correctly.Stop MCPProxy Coreaction still stops Core correctly.Run at Startupremains independent fromStart Core on App Launch.Additional Context
This feature is related to resource usage and lazy startup behavior. It is particularly relevant for users with many configured MCP upstream servers or upstreams that eagerly launch heavy child processes.
Current source inspection found no existing persisted setting or environment option to prevent Core startup on macOS app launch. The app has session-level stop/start behavior, but automatic startup is currently hardcoded in
applicationDidFinishLaunching.All reactions