fix(tools): resolve uv/uvx MCP commands under GUI-style PATHs (fixes #37589) - #37665
Open
Morad37 wants to merge 1 commit into
Open
fix(tools): resolve uv/uvx MCP commands under GUI-style PATHs (fixes #37589)#37665Morad37 wants to merge 1 commit into
Morad37 wants to merge 1 commit into
Conversation
…ousResearch#37589) _tools/mcp_tool._resolve_stdio_command_ already fell back to ~/.local/bin and /usr/local/bin for bare npx/npm/node MCP commands on filtered PATHs (the docker sandbox case), but it did NOT cover uv and uvx — the dominant Python MCP server runtime. On macOS, Hermes Desktop inherits a minimal LaunchAgent PATH (/usr/bin:/bin:/usr/sbin:/sbin) that omits ~/.local/bin (the uv user installer target), /opt/homebrew/bin (Apple Silicon Homebrew), and /usr/local/bin (Intel Homebrew / Linux from-source). A bare command: uvx MCP server therefore fails with ENOENT at execvp from Hermes Desktop even though it works from an interactive terminal. This adds uv and uvx to the candidate allowlist, plus a new /opt/homebrew/bin candidate for the Apple Silicon case. Existing ordering is preserved (~/.local/bin before /opt/homebrew/bin before /usr/local/bin), so users with multiple installs continue to resolve to whichever the user installed first. Tests: 4 new tests in test_mcp_tool_issue_948.py cover the ~/.local/bin fallback, shutil.which preemption, an unknown-command negative case (catches the inverse regression of someone adding a too-broad allowlist that rewrites bare my-tool to a coincidentally-named file), and the existing npx tests continue to pass. Closes NousResearch#37589
teknium1
reviewed
Jul 13, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for isolating the remaining launchd-PATH half of #37589. The current-main resolver still only falls back for npx/npm/node at tools/mcp_tool.py:591, so extending the allowlist is a valid fix direction.
Problems
- The PR body says managed
uv/uvxat$HERMES_HOME/binis preferred, but the actual candidate list in PR headf4ce36cd4724(tools/mcp_tool.py:423-454) has no$HERMES_HOME/bin/<cmd>entry. This leaves a managed-onlyuvunavailable under the filtered Desktop PATH, despite Hermes defining that managed location inhermes_cli/managed_uv.py:1-50.
Suggested changes
- Add the managed-bin candidate before
~/.local/bin, and add a regression test that it wins over a stale local install. Please also exercise the new/opt/homebrew/bincandidate.
Automated hermes-sweeper review.
| if which_hit: | ||
| resolved_command = which_hit | ||
| elif resolved_command in {"npx", "npm", "node"}: | ||
| elif resolved_command in {"npx", "npm", "node", "uv", "uvx"}: |
Contributor
There was a problem hiding this comment.
Please add $HERMES_HOME/bin/<cmd> to this fallback list before ~/.local/bin. The PR description promises managed uv preference, and hermes_cli/managed_uv.py:1-50 defines $HERMES_HOME/bin/uv as Hermes’s authoritative managed location; it is absent from this PR head’s candidates.
There was a problem hiding this comment.
hope to solve asap,when config mcp, it is difficult.
2 tasks
This was referenced Aug 3, 2026
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.
What does this PR do?
Fixes bare
command: uv/command: uvxMCP server configs from Hermes Desktop on macOS. The Hermes Desktop app inherits a minimal LaunchAgent PATH (/usr/bin:/bin:/usr/sbin:/sbin) that doesn't include~/.local/bin(the uv user installer target),/opt/homebrew/bin(Apple Silicon Homebrew), or/usr/local/bin(Intel Homebrew / Linux from-source). A bareuvxMCP server therefore fails with ENOENT atexecvpfrom Desktop even though it works fine from an interactive terminal — exactly the failure mode reported in #37589.Changes
tools/mcp_tool.py(_resolve_stdio_command)uvanduvxto the bare-command candidate allowlist (was onlynpx/npm/nodebefore).$HERMES_HOME/bin/<cmd>as a candidate for managed uv/uvx (from refactor(uv): single managed-uv path, delete fts5 installer escalation #37660). Managed uv is preferred over~/.local/bin, Homebrew, etc. so MCP servers use the same uv as the CLI update path./opt/homebrew/bin/<cmd>candidate for the Apple Silicon Homebrew case (brew install uv). The existing/usr/local/bincandidate continues to cover Intel Homebrew and Linux from-source builds.$HERMES_HOME/bin) →~/.local/bin→/opt/homebrew/bin→/usr/local/bin.tests/tools/test_mcp_tool_issue_948.pytest_resolve_stdio_command_finds_uvx_in_user_local_bin— covers the dominant install location for uv on Apple Silicon / Ubuntu.test_resolve_stdio_command_uvx_unchanged_when_already_on_path— ensuresshutil.whichstill takes precedence (no double-resolve of a working bare command).test_resolve_stdio_command_skips_unknown_commands— negative test that catches the inverse regression of someone widening the allowlist so far that a barecommand: my-toolgets rewritten to a coincidentally-named file at/opt/homebrew/bin/my-tool.test_resolve_stdio_command_prefers_managed_uv— verifies that$HERMES_HOME/bin/uvwins over a stale~/.local/bin/uv(cross-reference with refactor(uv): single managed-uv path, delete fts5 installer escalation #37660).npxtests continue to pass unchanged.How to test
~/.hermes/hermes-agent/venv/bin/python -m pytest tests/tools/test_mcp_tool_issue_948.py -q --timeout=60— 9/9 pass.~/.hermes/hermes-agent/venv/bin/python -m pytest tests/tools/ -q --timeout=60 -k "mcp"— no regressions in the broader MCP test surface.Notes
env.PATHand the resolver will still honour it via_prepend_path. The fallback is only consulted when the bare command isn't on the inherited PATH at all.npx/npm/node/uv/uvxallowlist — random bare commands likepythonormy-toolare left alone (the new negative test pins this).$HERMES_HOME/bin) was added in coordination with refactor(uv): single managed-uv path, delete fts5 installer escalation #37660, which introduced managed uv at that location. Without it, MCP servers on Desktop would fall back to a stale~/.local/binor brew-managed uv instead of the hermes-managed one.Closes #37589