fix(tray): forward --listen to the spawned core process - #1015
Open
electrolobzik wants to merge 2 commits into
Open
fix(tray): forward --listen to the spawned core process#1015electrolobzik wants to merge 2 commits into
electrolobzik wants to merge 2 commits into
Conversation
The tray ignored its own command-line arguments entirely, so launching it as `mcpproxy-tray serve --listen 0.0.0.0:8181` silently dropped the listen address: on macOS the tray prefers the unix socket for tray<->core communication, buildCoreArgs() only derived --listen for TCP/HTTP core URLs, and the core was spawned as `mcpproxy serve` with no --listen at all. The core then fell back to the config-file default (typically 127.0.0.1:8080) and the advertised port never opened. Observed live on mcpproxy-tray v0.43.0 (tray log shows the shell-wrapped spawn without --listen; lsof confirms the core listening on 8080 instead of 8181). Fix: parse --listen/-l (space and = forms) from the tray's argv and always forward it to the spawned core's argv, even when the tray talks to the core over the socket/pipe — the socket only covers tray<->core communication, while the core must still open the advertised TCP address. URL/env-derived --listen behavior for TCP endpoints is unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
mcpproxy-tray serve --listen 0.0.0.0:8181silently drops the--listenflag on macOS (reproduced on tray v0.43.0):/bin/zsh -l -c exec '/mcpproxy' 'serve'— no--listen.lsofconfirms the core then listens on the config-file value (default127.0.0.1:8080); nothing ever opens the advertised port, so any tooling that probes it concludes the daemon is down.Root cause
cmd/mcpproxy-tray/main.gonever parses its own command line —serve --listen …is ignored entirely. On macOSresolveCoreURL()prefers the unix socket for tray↔core communication (#102), andbuildCoreArgs()only derives--listenfor TCP/HTTP core URLs, so on the socket path the core is spawned with no--listenat all and falls back to the config default.Fix
trayListenFromArgs()parses--listen/-l(both space and=forms) from the tray's argv; other args remain ignored as before. Malformed values (dangling flag, empty=form, value starting with-) are skipped and scanning continues to the first valid value.buildCoreArgs()now always forwards an explicit CLI--listento the spawned core's argv — including when the tray talks to the core over the socket/pipe, since the socket only covers tray↔core communication while the core must still open the advertised TCP address. Both the login-shell-wrapped spawn and the direct-exec fallback consume the same argv.--listenbehavior for TCP endpoints is unchanged.Tests
TestTrayListenFromArgscovers both flag forms plus the malformed-input regressions (--listen --config path,--listen= --listen :8181, dangling-l, continue-scan to a later valid--listen=:9090).TestBuildCoreArgs_ForwardsCLIListenOverSocketEndpoint— regression: CLI listen forwarded over a socket endpoint; no--listenon socket endpoints without the flag.🤖 Generated with Claude Code