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:
@@ -8,6 +8,7 @@ import (
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"supermarket/internal/db"
|
||||
@@ -21,8 +22,28 @@ type Checkin struct {
|
||||
Note string
|
||||
}
|
||||
|
||||
// hermesPrefix is how Hermes names an MCP server's tools in its own catalog.
|
||||
const hermesPrefix = "mcp__mcphub__"
|
||||
|
||||
// HubToolNames returns the names as the hub itself gives them: agents may
|
||||
// report their own prefixed names (Hermes: mcp__mcphub__espocrm_get_record),
|
||||
// and later phases look tools up by the hub's name (espocrm_get_record).
|
||||
func HubToolNames(names []string) []string {
|
||||
out := make([]string, 0, len(names))
|
||||
for _, n := range names {
|
||||
n = strings.TrimPrefix(strings.TrimSpace(n), hermesPrefix)
|
||||
if n != "" {
|
||||
out = append(out, n)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// Record stores a check-in.
|
||||
func Record(d *db.DB, c Checkin) error {
|
||||
if c.MCPHubTools != nil {
|
||||
c.MCPHubTools = HubToolNames(c.MCPHubTools)
|
||||
}
|
||||
tools, err := json.Marshal(c.MCPHubTools)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user