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 <noreply@anthropic.com>
This commit is contained in:
@@ -99,20 +99,28 @@ from `~/.hermes/.env`, so `config.yaml` holds no secret:
|
||||
mcp_servers:
|
||||
mcphub:
|
||||
url: "https://mcphub.<CORE_DOMAIN>/sse?as_user=<CORE_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:<data folder>/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=<base64 of user:password, from a hidden prompt>
|
||||
SUPERMARKET_MCP_TOKEN=<random, generated by install.sh, also in /data/secrets>
|
||||
MCPHUB_AUTH=<the user's own hub token from the Core (the part after "Basic "), from a hidden prompt>
|
||||
```
|
||||
|
||||
How `install.sh` does it, safely and idempotently:
|
||||
@@ -120,9 +128,9 @@ How `install.sh` does it, safely and idempotently:
|
||||
CoreDesktop's `configure hermes` calls Hermes. Hermes edits its YAML
|
||||
with comment-preserving ruamel, so we never hand-edit its 2,400-line config.
|
||||
If an `mcphub` entry already exists, it's left alone.
|
||||
2. It asks whether Hermes may reach `mcphub.<CORE_DOMAIN>` and
|
||||
`127.0.0.1:8470`. On yes, it adds them to `network.allowedDomains` in
|
||||
`~/.config/coredesktop/sandbox/hermes.json`. Hermes' sandbox blocks both
|
||||
2. It asks whether Hermes may reach `mcphub.<CORE_DOMAIN>`. On yes, it adds
|
||||
it to `network.allowedDomains` in
|
||||
`~/.config/coredesktop/sandbox/hermes.json`. Hermes' sandbox blocks it
|
||||
by default, and that file is the one no sandbox can write.
|
||||
3. It stops the gateway (`hermes gateway stop`; Hermes starts it on demand) so the
|
||||
servers load, then checks that Hermes lists the hub's tools.
|
||||
@@ -258,9 +266,43 @@ done, and so is the tooling for item 8. What changed from the plan:
|
||||
times are imported into SQLite, and its X/LinkedIn/YouTube clients and
|
||||
fetcher are kept for Phase 1. Until Phase 1 lands, there's no way to post.
|
||||
|
||||
Still to do for item 8, on a real CoreDesktop machine: run `install.sh`,
|
||||
ask Hermes the check-in question, and confirm that sandboxed Hermes reaches
|
||||
`127.0.0.1:8470` and lists the hub's EspoCRM tools.
|
||||
**Status (2026-11-20): Phase 0 is done, on `phase0-foundation`.** Item 8
|
||||
works end to end: Hermes loads the hub's tools and checks in with the app.
|
||||
|
||||
What item 8 turned up:
|
||||
- Sandboxed Hermes **can't** reach `127.0.0.1:8470` (see "Why a socket" in
|
||||
the Hermes bridge section), so it reaches the app through `/data/mcp.sock`
|
||||
with `socat`.
|
||||
- `hermes config set` writes nested `mcp_servers.*` keys correctly, lists
|
||||
(`args`) included.
|
||||
- The hub rejected the shared admin token (401 at Traefik). The Core moved
|
||||
to per-user tokens, still sent as `Authorization: "Basic <token>"`, with
|
||||
`as_user=<user>` kept. The setup asks for the token, checks it with the
|
||||
hub, and `supermarket hermes --reconfigure` re-enters it.
|
||||
- The hub (FastMCP "mcpserver-hub" 3.2.0) speaks only SSE: a POST to `/sse`
|
||||
gets 405. Hermes tries Streamable HTTP first, and that try ran out of its
|
||||
60-second connect time, so setup.sh sets `transport: sse`. `tools/list`
|
||||
takes about 10 seconds.
|
||||
- A running Hermes gateway keeps its old servers, and `gateway stop` from
|
||||
outside the sandbox didn't always stop it. setup.sh now checks the pid
|
||||
file and says so when the gateway is still running.
|
||||
- The hub offers 213 tools: Nextcloud 155, Listmonk 29, Superpanel 9,
|
||||
Baserow 8, Plausible 6 and EspoCRM 6 (`espocrm_search_records`,
|
||||
`espocrm_get_record`, `espocrm_get_related_records`,
|
||||
`espocrm_create_record`, `espocrm_update_record`,
|
||||
`espocrm_delete_record`). Hermes reports them with its own `mcp__mcphub__`
|
||||
prefix, and the app stores the hub's names. Phase 2 builds on the generic
|
||||
EspoCRM record tools.
|
||||
- The per-user token also sees `nextcloud_admin_list_users` and
|
||||
`nextcloud_admin_get_contacts`, both described as admin-only. To raise with
|
||||
the Core's developer: it isn't known yet whether the hub blocks them for
|
||||
non-admins.
|
||||
|
||||
Next: start Phase 1.
|
||||
|
||||
Supermarket's half can be checked before the token arrives: ask Hermes the
|
||||
check-in question now. It should reach `bridge_checkin` and note that
|
||||
mcphub failed.
|
||||
|
||||
1. Restructure into the layout above. Port config and the JSON stores to
|
||||
SQLite, with import from the old files.
|
||||
@@ -278,11 +320,10 @@ ask Hermes the check-in question, and confirm that sandboxed Hermes reaches
|
||||
7. Inventory module: list, edit, import (from the old config and from YAML),
|
||||
and relationship labels.
|
||||
8. **Hermes bridge test** (do this early, since Phases 2 and 4 depend on it):
|
||||
- Can sandboxed Hermes reach `127.0.0.1:8470` once it's in `hermes.json`?
|
||||
Each sandbox has its own network; LAN servers work this way, but this
|
||||
machine's loopback is untested.
|
||||
- Does `hermes config set` write nested `mcp_servers.*.headers` keys
|
||||
correctly?
|
||||
- ~~Can sandboxed Hermes reach `127.0.0.1:8470` once it's in
|
||||
`hermes.json`?~~ No. Answered 2026-11-19: it uses the MCP socket instead.
|
||||
- ~~Does `hermes config set` write nested `mcp_servers.*.headers` keys
|
||||
correctly?~~ Yes.
|
||||
- What EspoCRM tools does the hub expose?
|
||||
- Can Hermes cron jobs call MCP tools?
|
||||
- How reliable is a run of 50 queued actions?
|
||||
@@ -409,6 +450,11 @@ Phases 1, 3, 5 and the Stripe half of 4 depend only on Phase 0.
|
||||
`as_user=` to act as the user. Can the hub issue per-user credentials or
|
||||
tokens instead? An admin password in each desktop's Hermes `.env` gives an
|
||||
agent that reads untrusted web content admin access to the Core.
|
||||
*2026-11-19:* the Core's developer confirmed it's always the admin token
|
||||
today. After the admin token failed with a 401, they said the hub will
|
||||
likely move to per-user tokens.
|
||||
*2026-11-20:* resolved. The hub now issues per-user tokens, still sent as
|
||||
`Authorization: "Basic <token>"`, with `as_user=<user>` kept in the URL.
|
||||
2. **MCP hub URL**: is it always `mcphub.<CORE_DOMAIN>`, so it can be worked out
|
||||
from `core.conf`?
|
||||
3. **Gitea**: which Gitea do sites live on (the Core's, at
|
||||
|
||||
Reference in New Issue
Block a user