Watch
0
0
Fork
You've already forked hyperhive
0
hyperhive/hive-matrix-mcp
Repository files (latest commit first)
Filename Latest commit message Latest commit date
damocles b89ca3955a hive-matrix: the unread sweep after a sync looks at the rooms the sync touched, not at every joined room
Each room the sweep looks at costs a live /messages fetch of up to 50 events, and the sweep ran for every joined room after every sync response, so a busy account fetched thousands of times an hour whatever the sync itself carried. The sweep now covers the rooms the response names (sliding sync's UpdateSummary rooms, classic's joined rooms), with a full pass first and every five minutes.
2026-11-11 17:05:57 +01:00
..
src hive-matrix: the unread sweep after a sync looks at the rooms the sync touched, not at every joined room 2026-11-11 17:05:57 +01:00
Cargo.toml hive-matrix: sliding sync starts again, the crypto store's classic /sync token is reset before it is sent as to_device.since 2026-11-11 10:09:33 +01: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).