Skip to content

The agent that grows with you

fix(mcp): move uv/uvx known-dir table into hermes_platform resolver

Hermes Agent678a4762b887
diff --git a/hermes_platform/resolver/known_dirs.py b/hermes_platform/resolver/known_dirs.py
index d22fe0ac13e..6901e195696 100644
--- a/hermes_platform/resolver/known_dirs.py
+++ b/hermes_platform/resolver/known_dirs.py
@@ -25,6 +25,17 @@ def rust_tool_dirs() -> tuple[str, ...]:
return ("~/.cargo/bin",) if _POSIX else ("%USERPROFILE%/.cargo/bin",)
+def uv_tool_dirs() -> tuple[str, ...]:
+ """uv's install locations outside PATH, in uv's own install order: the per-user
+ installer's ``~/.local/bin`` (every OS — that is where uv's docs put it), then
+ Homebrew (Apple Silicon ``/opt``, Intel / from-source ``/usr/local``). The tilde
+ form is deliberate: callers that only ``expanduser`` (the stdio launcher
+ fallback) get the same result as ``locate_command``'s expandvars+expanduser."""
+ if _POSIX:
+ return ("~/.local/bin", "/opt/homebrew/bin", "/usr/local/bin")
+ return ("~/.local/bin",)
+
+
def node_tool_dirs() -> tuple[str, ...]:
return ("~/.npm-global/bin", "~/.bun/bin", "~/.volta/bin") if _POSIX else ("%APPDATA%/npm", "%USERPROFILE%/.bun/bin", "%LOCALAPPDATA%/Volta/bin")
diff --git a/tools/mcp_tool_config.py b/tools/mcp_tool_config.py
index 9fe3e11cced..fe6c821d359 100644
--- a/tools/mcp_tool_config.py
+++ b/tools/mcp_tool_config.py
@@ -172,18 +172,18 @@ def _launcher_fallback(command: str, *, windows: Optional[bool] = None) -> str:
``uv``/``uvx``: GUI launches (the Electron desktop app, macOS LaunchAgents) inherit the bare
``/usr/bin:/bin:/usr/sbin:/sbin`` PATH, which carries none of uv's install locations, so a bare
``command: uvx`` MCP server fails with ENOENT at ``execvp`` from Desktop even though it works
- from an interactive terminal (#37589). Probed in the order uv's own docs install it: the
- Hermes-managed ``<home>/bin`` first, then the per-user installer's ``~/.local/bin``, then
- Homebrew (Apple Silicon ``/opt``, Intel ``/usr/local``)."""
+ from an interactive terminal (#37589). The directory table lives in
+ ``hermes_platform.resolver.known_dirs.uv_tool_dirs`` (probed in the order uv's own docs install
+ it: the per-user installer first, then Homebrew); the Hermes-managed ``<home>/bin`` is probed
+ before it."""
from hermes_constants import get_hermes_home
+ from hermes_platform.resolver.known_dirs import uv_tool_dirs
home = os.path.expanduser("~")
if command in {"uv", "uvx"}:
- directories = [
- os.path.join(str(get_hermes_home()), "bin"),
- os.path.join(home, ".local", "bin"), # uv's official installer
- os.path.join(os.sep, "opt", "homebrew", "bin"), # Apple Silicon Homebrew
- os.path.join(os.sep, "usr", "local", "bin"), # Intel Homebrew / from-source
- ]
+ # expanduser: the table carries the ``~`` form so both this walk and
+ # locate_command's expandvars+expanduser agree on one spelling.
+ directories = [os.path.join(str(get_hermes_home()), "bin"),
+ *(os.path.expanduser(d) for d in uv_tool_dirs())]
else:
from hermes_constants import iter_hermes_node_dirs
# /usr/local/bin: canonical Node location (from-source Linux, Hermes Docker image, Intel