From f3e5b9eff6e145ba4e4e4385ba5824144f37adf0 Mon Sep 17 00:00:00 2001 From: David Young Date: Fri, 20 Nov 2026 12:31:14 -0700 Subject: [PATCH] Connect Hermes to the Core's MCP hub and to Supermarket Hermes runs in CoreDesktop's sandbox, with its own network, so it can't reach 127.0.0.1:8470. The app now also serves MCP on a Unix socket in its data folder (/data/mcp.sock), which Hermes reaches with socat. HTTP /mcp with the bearer token remains for other agents. hermes/setup.sh asks for the user's own hub token (the Core now issues per-user tokens), checks it with the hub, and stores it in Hermes' .env. The hub only speaks SSE, and Hermes' Streamable HTTP attempt can use up its connect time, so the setup sets transport: sse. It also warns when Hermes' gateway is still running with the old servers. Check-ins store the hub's own tool names, without Hermes' mcp__mcphub__ prefix. Co-Authored-By: Claude Opus 5.5 --- PLAN.md | 82 ++++++++++++++---- README.md | 15 ++-- cmd/supermarket/main.go | 13 ++- compose.yaml | 2 + hermes/setup.sh | 122 ++++++++++++++++++++++----- internal/bridge/bridge.go | 21 +++++ internal/bridge/bridge_test.go | 20 +++++ internal/mcpserver/mcpserver.go | 64 ++++++++++++-- internal/mcpserver/mcpserver_test.go | 94 +++++++++++++++++++++ internal/web/pages.go | 21 ++--- internal/web/server.go | 1 + internal/web/templates/core.html | 6 +- 12 files changed, 393 insertions(+), 68 deletions(-) create mode 100644 internal/bridge/bridge_test.go create mode 100644 internal/mcpserver/mcpserver_test.go diff --git a/PLAN.md b/PLAN.md index 4e5781e..cead556 100644 --- a/PLAN.md +++ b/PLAN.md @@ -99,20 +99,28 @@ from `~/.hermes/.env`, so `config.yaml` holds no secret: mcp_servers: mcphub: url: "https://mcphub./sse?as_user=" + transport: sse headers: Authorization: "Basic ${MCPHUB_AUTH}" supermarket: - url: "http://127.0.0.1:8470/mcp" - headers: - Authorization: "Bearer ${SUPERMARKET_MCP_TOKEN}" + command: socat + args: ["STDIO", "UNIX-CONNECT:/mcp.sock"] ``` -**`~/.hermes/.env`** (written through `hermes config set`, which routes -UPPER_SNAKE names to `.env`): +**Why a socket, not `http://127.0.0.1:8470/mcp`** (found 2026-11-19). +CoreDesktop runs Hermes under srt, in its own network namespace. Hermes +always dials loopback directly, never through the proxy, and finds nothing +there. srt's proxy, in turn, refuses any name that resolves to loopback. +Unix sockets are allowed in Hermes' sandbox, so the app serves stdio-style +MCP on `/data/mcp.sock`, and Hermes runs `socat` as a stdio MCP server. The +socket is 0600, which is the same protection as the token file beside it. +The HTTP endpoint with its bearer token stays for unsandboxed agents +(Claude Code). + +**`~/.hermes/.env`**: ``` -MCPHUB_AUTH=