feat(matrix mcp): add resolve_invite tool to accept or reject pending invites

This commit is contained in:
damocles 2026-06-05 21:55:04 +02:00
commit 86f0de751f
6 changed files with 121 additions and 19 deletions

View file

@ -27,9 +27,15 @@ a second stdio MCP server. Tools land as `mcp__matrix__<name>`:
- `invite_user(room, user_id)` — invite `@user:server` into a room
you're already in; you must have a high enough power level.
The invitee sees a pending invite and accepts via `join_room`.
- `join_room(room)` — join a room by id or alias, or accept a
pending invite.
The invitee sees a pending invite and resolves it via
`resolve_invite`.
- `resolve_invite(room, action)` — accept or reject a pending invite.
`action` is `"accept"` (join the room) or `"reject"` (decline and
leave). This is the path for invites; `join_room` is for joining a
public room you weren't invited to.
- `join_room(room)` — join a public room by id or alias. Also accepts
a pending invite if one exists, but prefer `resolve_invite` for
invites (it can reject too).
- `list_invites()` — rooms this agent has been invited to but not
yet joined (`{ id, canonical_alias, name }` per room).
@ -64,13 +70,14 @@ loose-ends list between turns.
`m.room.member` invite event, it writes the invite to
`mcp-loose-ends/matrix.json` and fires a hyperhive wake. The daemon
does **not** auto-join — the agent calls `list_invites` to see pending
invites and `join_room` to accept (or ignore).
invites and `resolve_invite` to accept or reject them.
**Pending invites as loose ends**: pending invites are written to
`mcp-loose-ends/matrix.json` and appear in `get_loose_ends` output as
`[matrix] pending invite: <room> — use list_invites to see, join_room
to accept`. The file is updated atomically after each invite event
and after each `join_room` call clears the entry.
`[matrix] pending invite: <room> — use list_invites to see,
resolve_invite to accept or reject`. The file is updated atomically
after each invite event and after each `resolve_invite` (or
`join_room`) call clears the entry.
See [`docs/matrix.md`](../matrix.md) for the homeserver setup,
provisioning flow, and federation config.