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:
+12
-1
@@ -7,6 +7,9 @@
|
||||
// SUPERMARKET_ADDR listen address (default :8080)
|
||||
// SUPERMARKET_PUBLIC_URL the address the browser uses (default http://localhost:8470)
|
||||
// SUPERMARKET_CORE_CONF CoreDesktop's core.conf (default <data>/core.conf)
|
||||
// SUPERMARKET_MCP_SOCKET Unix socket for agents' MCP (default <data>/mcp.sock)
|
||||
// SUPERMARKET_HOST_DATA the data folder's path on the host, to show in
|
||||
// setup instructions (default: same as the data folder)
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -60,6 +63,8 @@ func run(log *slog.Logger) error {
|
||||
addr := env("SUPERMARKET_ADDR", ":8080")
|
||||
publicURL := strings.TrimRight(env("SUPERMARKET_PUBLIC_URL", "http://localhost:8470"), "/")
|
||||
coreConf := env("SUPERMARKET_CORE_CONF", filepath.Join(dataDir, "core.conf"))
|
||||
mcpSocket := env("SUPERMARKET_MCP_SOCKET", filepath.Join(dataDir, "mcp.sock"))
|
||||
hostData := env("SUPERMARKET_HOST_DATA", dataDir)
|
||||
|
||||
// Everything the app writes (database, secrets, clones) is for this user
|
||||
// only: it will hold contacts and credentials.
|
||||
@@ -108,6 +113,7 @@ func run(log *slog.Logger) error {
|
||||
PublicURL: publicURL,
|
||||
Version: version,
|
||||
MCPToken: token,
|
||||
MCPSocket: filepath.Join(hostData, filepath.Base(mcpSocket)),
|
||||
MCP: mcpserver.Handler(database, token, version),
|
||||
Log: log,
|
||||
ImportStatus: status,
|
||||
@@ -126,7 +132,12 @@ func run(log *slog.Logger) error {
|
||||
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
||||
defer stop()
|
||||
|
||||
errCh := make(chan error, 1)
|
||||
errCh := make(chan error, 2)
|
||||
go func() {
|
||||
if err := mcpserver.ServeSocket(ctx, database, version, mcpSocket, log); err != nil {
|
||||
errCh <- fmt.Errorf("MCP socket %s: %w", mcpSocket, err)
|
||||
}
|
||||
}()
|
||||
go func() {
|
||||
log.Info("Supermarket is running", "version", version, "listen", addr, "open", publicURL)
|
||||
errCh <- httpServer.ListenAndServe()
|
||||
|
||||
Reference in New Issue
Block a user