hyperhive/hive-matrix-mcp
Repository files (latest commit first)
Filename Latest commit message Latest commit date
atlas 7ee7080b21 matrix: remove the registration token
Nothing reads it any more: hive-c0re creates accounts as the hive's
appservice, so the mint, the host file, the bind mount, the
`LoadCredential` entry and tuwunel's `registration_token_file` all go.

⚠️ `allow_registration` has to go to `false` in the same change, and not
as hardening. tuwunel refuses to START when registration is allowed with
no token configured — it demands
`yes_i_am_very_very_sure_…_open_registration_…` instead — so dropping the
token and leaving the flag true is not a lax homeserver, it is one that
does not boot. The flag is checked only for requests arriving without an
appservice token, so hive-c0re provisions exactly as before and everyone
else is refused outright.

The swarm secret store keeps its role, repointed at the credential that
replaced the token (`swarm/hives/<hive>/matrix/appservice-token`). Its
unit now also re-runs hive-matrix's own registration renderer after
writing the file: the token is half an agreement, and a registration
still naming the previous value authenticates nobody. The renderer is
shared through an internal option rather than copied, so the
registration's shape has one home.

Both spellings of `registrationTokenFile` become
`mkRemovedOptionModule` with a message naming what replaced them. A hive
that never set the option — the default — is unaffected; one that pinned
it fails to evaluate with instructions instead of a silent no-op.

An upgraded hive needs no intervention: the activation script has both
halves in place before the homeserver restarts, existing agents keep the
tokens their devices already hold, and the old token file is left on
disk read by nothing. docs/integrations/matrix.md spells the path out.

Refs #4402
2026-09-15 19:58:10 +02:00
..
src matrix: remove the registration token 2026-09-15 19:58:10 +02:00
Cargo.toml refactor(sock): one socket client, retry as a policy value 2026-07-26 22:44:48 +02:00
README.md feat(#2659): serve hive-matrix-mcp over persistent streamable-http, drop stdio bridge 2026-07-24 12:44:39 +02:00

hive-matrix-mcp

Per-agent matrix integration: a long-running daemon (hive-matrix-daemon) that holds a matrix-sdk Client + sync loop per configured account and serves the matrix tool surface (send_message, send_dm, list_rooms, read_room, …) directly over streamable-http. No stdio bridge, no per-turn respawn — claude reconnects to the same stable URL every turn.

When to use it

Look here when changing matrix tool behaviour, multi-account handling, or the incoming-event → todo/wake path. The daemon owns the whole lifecycle: per-account bring-up (accounts.rs, client.rs), the sync loop that sweeps invites/unread rooms into the harness's in-agent todo socket (timeline.rs, wake.rs), and the MCP tool router itself (mcp.rs).

Shape

One bin (hive-matrix-daemon, src/main.rs) built from the crate's own lib (src/lib.rs):

  • accounts.rs — multi-account config + the account→Client dispatch registry (main is always the hive-internal primary; extras come from HIVE_MATRIX_ACCOUNTS).
  • client.rs — session restore, stale-token recovery, avatar sync, cross-signing bootstrap.
  • timeline.rs / wake.rs — per-sync-callback invite/unread sweeps that push todos onto HIVE_AGENT_SOCKET.
  • handlers.rs — per-tool dispatch, returns protocol::DaemonResponse.
  • mcp.rs — the rmcp tool router + serve_http, resolving each call's optional account arg against the registry before calling into handlers.
  • paths.rs — per-agent path resolution (token file, matrix-sdk state dir, homeserver URL, accounts snapshot).