@mosadd/mcp 3.0.0-alpha.4 → 3.0.0-alpha.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +298 -0
  2. package/README.md +70 -36
  3. package/dist/bin/mcp.js +42 -3
  4. package/dist/chunk-7ZAAJ52G.js +3475 -0
  5. package/dist/index.d.ts +115 -6
  6. package/dist/index.js +7 -3
  7. package/package.json +8 -5
  8. package/src/__tests__/golden-path.test.ts +139 -137
  9. package/src/__tests__/integration.test.ts +179 -178
  10. package/src/__tests__/knowledge-ingest.test.ts +114 -0
  11. package/src/__tests__/mdm-e2ee.test.ts +212 -178
  12. package/src/__tests__/mtalk.test.ts +122 -122
  13. package/src/__tests__/presence.test.ts +178 -0
  14. package/src/__tests__/server.test.ts +71 -67
  15. package/src/__tests__/tool-count-consistency.test.ts +164 -0
  16. package/src/bin/login.ts +138 -138
  17. package/src/bin/mcp.ts +145 -97
  18. package/src/config.ts +66 -66
  19. package/src/crypto/mdm-session.ts +502 -403
  20. package/src/index.ts +19 -17
  21. package/src/observability/sentry.ts +79 -79
  22. package/src/providers/blob-upload.ts +116 -0
  23. package/src/providers/memory-voice.ts +79 -79
  24. package/src/providers/supabase-dm.ts +122 -117
  25. package/src/providers/supabase-voice.ts +91 -91
  26. package/src/providers/supabase.ts +155 -96
  27. package/src/server.ts +60 -9
  28. package/src/tools/actions.ts +166 -0
  29. package/src/tools/attachments.ts +276 -0
  30. package/src/tools/capabilities.ts +70 -68
  31. package/src/tools/embed.ts +110 -0
  32. package/src/tools/index.ts +177 -43
  33. package/src/tools/knowledge-graph.ts +186 -0
  34. package/src/tools/knowledge.ts +327 -91
  35. package/src/tools/mail-agentbox.ts +155 -0
  36. package/src/tools/mail-aliases.ts +25 -0
  37. package/src/tools/mail-provenance.ts +137 -0
  38. package/src/tools/mail.ts +403 -89
  39. package/src/tools/mcall.ts +216 -0
  40. package/src/tools/mdm-as-agent.ts +126 -0
  41. package/src/tools/mdm-voice.ts +220 -0
  42. package/src/tools/mdm.ts +494 -392
  43. package/src/tools/mirc-edge.ts +196 -0
  44. package/src/tools/mirc-members.ts +61 -20
  45. package/src/tools/mirc-messages.ts +185 -151
  46. package/src/tools/mirc.ts +104 -10
  47. package/src/tools/mroom-messages.ts +142 -142
  48. package/src/tools/mroom.ts +221 -189
  49. package/src/tools/mtalk.ts +131 -121
  50. package/src/tools/murl.ts +314 -0
  51. package/src/tools/presence.ts +333 -0
  52. package/src/tools/ptt-ingest.ts +99 -0
  53. package/src/tools/threat.ts +123 -0
  54. package/src/types.ts +121 -85
  55. package/src/version.ts +8 -0
  56. package/src/voice/floor.ts +132 -132
  57. package/dist/chunk-YDFU6S5E.js +0 -1471
package/CHANGELOG.md ADDED
@@ -0,0 +1,298 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@mosadd/mcp` are documented here.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project follows the `3.0.0-alpha.N` pre-release line until the hosted
7
+ gateway (Phase 2) ships.
8
+
9
+ ## [Unreleased]
10
+
11
+ _Nothing yet._
12
+
13
+ ## [3.0.0-alpha.33] — 2026-08-11
14
+
15
+ **The republish that closes a three-week gap between the repo and the client's disk.**
16
+ `3.0.0-alpha.32` was published 2026-07-19 and every change since then lived only in git.
17
+ Measured on the published tarball that day: it registers **71** tools while its own npm
18
+ description advertises **69** and the website advertises **77**. Three numbers, one
19
+ package. This release makes the published artifact the thing the docs describe.
20
+
21
+ ### Added
22
+ - **`mAYL_send_as_agent`** re-registered (2026-07-29) after the hub-claim → mp0st-send
23
+ chain was proven on an authenticated call.
24
+ - **`mTALK_ingest_ptt`** re-registered (2026-07-29) after the ingest path was repointed
25
+ at `rag-transcribe` and returned a real `200 {"queued":true}` on prod.
26
+ - **`mAYL_agentbox_provision` / `_list` / `_extend` / `_release`** (2026-08-06,
27
+ LINEAR-5201) — an agent mints, lists, extends and releases its OWN two-way disposable
28
+ inbox (`agent-<hex>@mosadd.com`). `create_inbox` parity with AgentMail, on our stack.
29
+ - **`mRAG_graph_refresh` / `_overview` / `_neighbors` / `_timeline`** (2026-08-11) — the MCP
30
+ door onto the per-user knowledge graph (`kg_*` RPCs). Search finds text; these walk who/what/
31
+ when (parties, connections, dated timelines), built from message METADATA only, never bodies.
32
+ - Stdio hub-key auth (`MOSADD_API_KEY`) in `src/bin/mcp.ts` — the local stdio server can
33
+ exchange a hub key instead of requiring the BYOK env trio.
34
+
35
+ Tool count **71 → 81**: six tools existed in the repo but had **never been published**
36
+ (71 → 77 — an agent installing `@mosadd/mcp` got 71 while every doc surface promised 77),
37
+ AND four new `mRAG_graph_*` knowledge-graph traversal tools were added 2026-08-11 (77 → 81).
38
+ `TOOL_COUNT` (`= allTools.length`) stays the single source of truth.
39
+
40
+ ### Changed
41
+ - **`mRAG_search` can now filter on the source types the writers actually stamp.**
42
+ The `source_types` enum was missing `file` and `ptt` — `file` is what `mRAG_ingest`
43
+ itself writes (its default, and where `note` ingests are mapped), `ptt` is what
44
+ `mTALK_ingest_ptt` writes. Measured on prod 2026-08-11: 63 indexed rows were
45
+ unreachable by any `source_types` filter. The tool advertised a filter that could not
46
+ see its own writes.
47
+ - **`mURL_create` no longer promises a status it does not set.** `murl-manage` applies
48
+ `status` only on the INSERT of a new row; on an existing channel it writes owner +
49
+ branding and leaves status untouched. Since mURL rooms auto-create on first activity,
50
+ "already exists" is the COMMON case — so the old "set initial status" wording was
51
+ wrong nearly every time it was read. Schema + description now say so and point at
52
+ `mURL_update`.
53
+ - **`mIRC_post_message` encryption wording.** It posts server-readable plaintext base64
54
+ on EVERY access mode, private and password channels included; the app's group-key
55
+ encryption is not something the toolkit holds a key for.
56
+
57
+ ### Fixed
58
+ - Doc surfaces across the repo that hand-typed **73** while `TOOL_COUNT` was 77 (README
59
+ breakdown, `packages/mcp/README.md`, `apps/mcp-http/README.md`, dev docs, Realm,
60
+ examples). The anti-drift vitest gate pinned one regex per file, so a single corrected
61
+ line kept the gate green while the sentence around it stayed wrong — the gate now pins
62
+ the PER-MODULE numbers too, not just the total.
63
+
64
+ ## [3.0.0-alpha.32] — 2026-07-19
65
+
66
+ ### Added
67
+ - **`mIRC_discover`** — browse the PUBLIC channel directory (open channels whose
68
+ owners set `discoverable=true`). Filter by name, paginated; join a result with
69
+ `mIRC_join` (open = one-click). Private/password/partner channels never appear.
70
+ - **`mIRC_report`** — report a channel for abuse/moderation (routes to the shared
71
+ `content_reports` store as `channel:<id>`), the moderation floor for public discovery.
72
+ - **`discoverable`** flag on `mIRC_create` / `mIRC_update` (honoured only for
73
+ `access_mode=open`), plus `voice` + `files` added to the capabilities enum.
74
+ - Tool count **69 → 71** (mIRC **22 → 24**); `TOOL_COUNT` (`= allTools.length`) stays
75
+ the single source of truth.
76
+
77
+ ### Changed
78
+ - **Encryption posture wording corrected across docs.** `mIRC_post_message` posts a
79
+ **server-readable** plaintext payload — the per-channel group-key TEXT E2EE is the
80
+ mosadd.com **app** (supported clients), not the toolkit (parity is the next crypto
81
+ milestone). Tool descriptions, README, MANIFESTO, e2ee-posture and the registry
82
+ copy now state this instead of implying private/password channels are E2EE via the
83
+ toolkit. Voice/PTT is always server-relayed (LiveKit SFU, DTLS-SRTP hop-by-hop).
84
+
85
+ ## [3.0.0-alpha.31] — 2026-07-17
86
+
87
+ ### Fixed
88
+ - **`mURL_create` / `mURL_update` branding validation.** The `branding` arg used
89
+ `z.record(z.any())` — the Zod v3 single-argument form — which fails typecheck under
90
+ this project's Zod v4, where `z.record` requires both a key and a value schema. Now
91
+ `z.record(z.string(), z.any())`. alpha.30 shipped with the pre-fix source; alpha.31
92
+ corrects it so the published package builds clean and validates branding correctly.
93
+ - **CI green (repo).** Synced the version refs (`server.json`, `server.ts` serverInfo,
94
+ `marketplace.json`) to `package.json`, and updated the MCP smoke test to expect
95
+ `mAYL_send` — the `mp0st_*` aliases were retired in alpha.28.
96
+
97
+ ## [3.0.0-alpha.30] — 2026-07-17
98
+
99
+ ### Added
100
+ - **`comms_embed_create` RE-REGISTERED — tool count 68 → 69.** The paste-in
101
+ live-channel widget is finally end-to-end real: `https://embed.mosadd.com/v1.js`
102
+ is deployed (served by the mosadd Vercel project; skins are inlined in the
103
+ bundle), and the whole backend (`embed-keys` publishable keys, `mirc-embed-token`
104
+ Origin-allowlisted 5-min JWTs with MAT plan tiers, `embed-plan-settings` PAYG,
105
+ GDPR `embed-dsr-delete`) was already live. The tool mints an `m_pk_live_…` key
106
+ and returns a `<script>` snippet with skin + position (incl. sidebar-left/right)
107
+ options. Part of the mURL→mIRC rework P3 ("open WWW channel: dedicated page +
108
+ branding + embed").
109
+
110
+ ## [3.0.0-alpha.29] — 2026-07-17
111
+
112
+ ### Added
113
+ - **mURL owner-side management — 3 new tools.** `mURL_create` (claim a domain channel and
114
+ become its owner; idempotent, 409 if another account owns it), `mURL_update` (set branding /
115
+ mark `claimed` / `blocked` to close / reopen as `open`), `mURL_delete` (remove a channel you
116
+ own). Wired to the deployed, owner-scoped `murl-manage` EF via the same user-JWT auth as
117
+ `mURL_list_channels action='mine'`. mURL goes from read-only (read/post/presence/list) to a
118
+ full lifecycle — an agent can now provision and manage a domain's room, not just chat in it.
119
+ - **`TOOL_COUNT` export** (`= allTools.length`) — one source of truth for the callable-tool
120
+ count, mirroring `@mosadd/threat-engine`'s `THREAT_EVENT_COUNT`. Docs reference it, not a
121
+ hand-typed number that drifts.
122
+
123
+ ### Changed
124
+ - **Tool count corrected to 68** — it had been advertised inconsistently as "70+" / "65" across
125
+ READMEs, docs, registry submissions and the dev site. The registry holds exactly 68 callable
126
+ tools: mDM 14 · mIRC 22 · mURL 7 · mAYL 11 · mTALK 5 · mRAG 4 · comms_ 3 · Irondome (`threat_*`) 2.
127
+ Also fixed two stale claims in the reference table: `threat_*` IS registered (was labelled
128
+ "unregistered"), and the `mp0st_*` mAYL aliases are retired (were claimed as still functioning).
129
+
130
+ ## [3.0.0-alpha.23] — 2026-06-26
131
+
132
+ Toolkit hardening pass: every registered tool's request/response contract was
133
+ adversarially verified against the deployed edge functions. Two tools were broken on
134
+ every call; the rest had silent field drops, wrong results, or a confidentiality/access gap.
135
+
136
+ ### Fixed
137
+ - **Edge-function errors are now legible.** `invokeFunction` only ever surfaced the fixed
138
+ string "Edge Function returned a non-2xx status code"; the real reason lives in
139
+ `error.context`. It now reads that body (and the HTTP status), so every EF-backed tool
140
+ returns an actionable error the agent can act on — the single highest-impact fix.
141
+ - **mDM_edit no longer strips E2EE.** It used to store a server-readable plaintext body even
142
+ on an E2EE thread (and the forward-only ratchet means an edit can't be re-sealed). It now
143
+ refuses to edit E2EE messages (use delete + re-send) and only edits legacy plaintext.
144
+ - **mp0st_send cc/bcc/reply_to are actually delivered** — the backend dropped them silently;
145
+ now forwarded to the mail provider (edge-function fix, deployed).
146
+ - **mDM call rooms are access-gated (security)** — call-room tokens were mintable by any
147
+ authenticated user who learned the room name; the backend now restricts them to the two
148
+ participants, and the room name is per-pair so the gate is robust (edge-function fix, deployed).
149
+ - **mDM_call_end / mDM_voice_note** now return the real message id (was always undefined).
150
+ - **mp0st_view** no longer advertises a `received_at` field the backend doesn't return (it's `sent_at`).
151
+
152
+ ### Changed
153
+ - **Unregistered `comms_embed_create`** — its `embed-keys` edge function isn't deployed (404
154
+ on every call) and the embed surface is parked. Tool count **62 → 61**. Re-register when the
155
+ backend + widget ship.
156
+ - **mIRC tools stop advertising fields the backend ignores.** Removed: `mIRC_kick` `reason`,
157
+ `mIRC_request_access` `message`, `mIRC_ban` `reason`+`until` (the latter silently made a
158
+ "temporary" ban permanent), and `access_mode` on `mIRC_update`/`mIRC_list` (no-ops). Added
159
+ `wrapped_group_key` to `mIRC_create`/`mIRC_approve_request` so E2EE (password/private)
160
+ channels are honestly callable. Descriptions corrected to match.
161
+ - **mp0st_consent** now fails fast client-side when `check`/`optin` is missing a recipient.
162
+
163
+ ### Verified (no changes needed)
164
+ - Install/boot, full build + typecheck across all packages, dependency-export resolution, and
165
+ the mDM X3DH + Double-Ratchet crypto round-trip all pass.
166
+
167
+ ## [3.0.0-alpha.22] — 2026-06-26
168
+
169
+ ### Fixed
170
+ - **alpha.21 was broken on a fresh install** — it crashed on startup with
171
+ `SyntaxError: The requested module '@mosadd/crypto' does not provide an export named
172
+ 'initRatchetInitiator'`. The workspace dependency packages (`@mosadd/crypto`, `protocol`,
173
+ `providers`, `threat-engine`) had drifted: their *source* gained new exports (the mDM
174
+ Double-Ratchet work) but their version was never bumped, so npm still served the stale
175
+ alpha.4/alpha.5 builds while `@mosadd/mcp` was built against the newer API. Bumped the whole
176
+ alpha-line in lockstep to alpha.22 and republished so every published package matches current
177
+ source and `workspace:*` cross-deps resolve. Verified: a clean `npm i @mosadd/mcp@alpha`
178
+ now boots and lists 62 tools. (The previous alpha.20 was broken-on-install the same way.)
179
+
180
+ ### Changed
181
+ - **Unregistered 2 scaffold tools that failed on every call.** `mp0st_send_as_agent`
182
+ (POSTed to a non-existent `hub-claim-mint` endpoint → 404, and sent provenance body
183
+ fields the deployed `mp0st-send` EF never reads) and `mTALK_ingest_ptt` (request body
184
+ didn't match the deployed `ptt-ingest` EF → 400). Both are now commented out in
185
+ `tools/index.ts` like the other not-registered modules, so an agent only ever discovers
186
+ tools that actually work. Registered tool count **64 → 62** (mp0st 12→11, mTALK 6→5).
187
+ Source is kept; both re-register once their backend contracts are wired + tested.
188
+
189
+ ### Fixed
190
+ - **mIRC `reject_request` / `approve_request` field (LINEAR-3522):** the tools sent
191
+ `request_id` but `channel-members-manage` reads `target_identity_id` → 400 every
192
+ call. Renamed to `identity_id` (normalized to `target_identity_id`). `reject` now
193
+ works; `approve` of an E2EE channel still needs a wrapped group key (LINEAR-3523).
194
+ - **mDM / mIRC message pagination (LINEAR-3524):** `mDM_list` read `cursor`/`has_more`
195
+ but `message-list` history mode returns `next_before`, and `mIRC_list_messages`
196
+ sent `cursor` (ignored; EF reads `before`) and read `next_cursor` (never returned)
197
+ → neither paged past page 1. Send `before`, read `next_before`.
198
+
199
+ ## [3.0.0-alpha.19] — 2026-06-19
200
+
201
+ ### Removed
202
+ - **BREAKING — mROOM module killed (LINEAR-3414):** the 11 `mROOM_*` tools
203
+ (`mROOM_create`, `mROOM_create_guest_link`, `mROOM_join`, `mROOM_leave`,
204
+ `mROOM_close`, `mROOM_list`, `mROOM_voice_join`, `mROOM_send_message`,
205
+ `mROOM_list_messages`, `mROOM_send_voice`, `mROOM_send_file`) are no longer
206
+ registered. Ephemeral private rooms are re-cut into private mIRC channels.
207
+ The source stays in `tools/mroom*.ts` (unregistered, like mURL/mCALL).
208
+
209
+ ### Added
210
+ - **Defensive threat engine as MCP tools (LINEAR-3498):** `threat_catalog`
211
+ (list the canonical 160+ threat-event taxonomy) and `threat_classify`
212
+ (pure `evaluateEvent` decision → action/severity/reason). Wraps
213
+ `@mosadd/threat-engine`; deterministic, offline, `requires: "any"`.
214
+
215
+ Net: 70 → **64 callable tools** across 5 live modules + comms + threat.
216
+
217
+ ### Changed
218
+ - **BREAKING — mail tool rename:** the 12 email MCP tools are renamed
219
+ `mAIL_*` → `mp0st_*` (`mp0st_list`, `mp0st_send`, `mp0st_view`, `mp0st_delete`,
220
+ `mp0st_stats`, `mp0st_events`, `mp0st_metrics`, `mp0st_revoke`,
221
+ `mp0st_audit_export`, `mp0st_consent`, `mp0st_notify`, `mp0st_send_as_agent`).
222
+ No aliases — the old `mAIL_*` names no longer resolve. Backend Edge Functions
223
+ (`mp0st-*`) are unchanged.
224
+
225
+ ## [3.0.0-alpha.18] — 2026-06-18
226
+
227
+ ### Added
228
+ - **`comms_embed_create`** — embed a LIVE mosadd channel into an app/site a builder-agent is
229
+ generating (Lovable / Bolt / Cursor / v0). Mints a publishable embed key (`m_pk_live_…`,
230
+ origin-scoped, via the `embed-keys` EF) and returns a paste-in widget snippet
231
+ (`<div>` + `<script src="https://embed.mosadd.com/v1.js" data-key=…>`). The widget exchanges
232
+ the publishable key for a short-lived channel-scoped JWT at runtime; the hub key never enters
233
+ the browser. Extends `mROOM_create_guest_link` (link → embeddable widget). CDN override via
234
+ `MOSADD_EMBED_CDN`. (Widget served from the dedicated `embed.mosadd.com` deploy.)
235
+
236
+ ## [3.0.0-alpha.17] — 2026-06-18
237
+
238
+ ### Added
239
+ - **Action Links — screen share.** `comms_action_create` gains a `screen_share` action
240
+ type, and a new `comms_action_frame_get` tool lets the creating agent read frames of the
241
+ recipient's shared screen (consent-gated, browser-sandbox only). Turns Action Links into
242
+ "remote-desktop-lite" — the agent sees what the human chooses to share.
243
+
244
+ ### Changed
245
+ - **Durable `mosadd login`.** The saved session (`~/.mosadd/session.json`) is now refreshed
246
+ from its refresh token at server boot, so a single `mosadd login` keeps working across
247
+ restarts — no more re-login when the access token expires.
248
+ - Onboarding README restructured (recommended auth path — `mosadd login` — first; hub API
249
+ key second; DevTools JWT demoted), and the 61→70 / `mosadd.dev`→`mosadd.com` reconciliation
250
+ (first shipped on the published package with this release).
251
+
252
+ ## [3.0.0-alpha.16] — 2026-06-17
253
+
254
+ ### Fixed
255
+ - `mAIL_view` now calls the `mp0st-get` Edge Function (read a message by id,
256
+ owner-scoped) instead of `mp0st-view` (the tracking-pixel endpoint, which
257
+ returned "Missing tracking ID"). ([LINEAR-2917])
258
+ - CI publish drops `--provenance` — npm returned 422 because the source repo
259
+ (`mosadd-os`) is private, so provenance attestation is not available.
260
+
261
+ ### Added (cumulative since alpha.4 — tool count 61 → 70)
262
+ - **Action links (Tier 1):** `comms_action_create` mints a one-link browser
263
+ action an agent can hand to a human (run-with-consent in the mosadd sandbox).
264
+ - **mAIL provenance:** `mAIL_send_as_agent` stamps agent/human provenance on the
265
+ message so the recipient sees who actually sent it.
266
+ - **File & voice attachments:** `mDM_send_voice` / `mDM_send_file`,
267
+ `mROOM_send_voice` / `mROOM_send_file`, `mIRC_send_voice` / `mIRC_send_file`
268
+ (reuse the existing `chat-files` bucket — no new transport).
269
+ - **mTALK → RAG:** `mTALK_ingest_ptt` feeds push-to-talk audio into the RAG index
270
+ (opt-in, gated server-side).
271
+ - **mROOM:** `mROOM_create_guest_link` (single-call, no-account guest links) and
272
+ `mROOM_voice_join`.
273
+ - **mIRC edge transport:** `mIRC_mint_channel_token`, `mIRC_send_edge`,
274
+ `mIRC_history_edge` — the low-latency path the agent-coordination skill rides.
275
+
276
+ ### Changed
277
+ - README, `package.json`, and the plugin `marketplace.json` reconciled to the
278
+ current surface: **70 tools across 6 modules** + `comms_capabilities`
279
+ discovery (71 callable), version `alpha.16`, and `mosadd.dev` → `mosadd.com`
280
+ (the dev surface was consolidated into the main site). ([LINEAR-3391])
281
+ - `mCALL` (telephony, carrier-pending) and `mURL` (brand/consumer surface)
282
+ remain **unregistered** in `tools/index.ts` — an agent only ever discovers
283
+ tools that actually work.
284
+
285
+ ## [3.0.0-alpha.4]
286
+
287
+ ### Added
288
+ - Initial public alpha: **61 tools across 6 live modules** — mDM (incl. voice),
289
+ mIRC, mROOM, mAIL, mTALK, mRAG — plus the `comms_capabilities` discovery tool.
290
+ - BYOK mode: the server talks to your own mosadd Supabase backend via
291
+ `MOSADD_SUPABASE_URL` / `MOSADD_SUPABASE_ANON_KEY` / `MOSADD_USER_JWT`.
292
+ - Apache-2.0 license; tool names follow [RFC 0001] (`m<MODULE>_<operation>`).
293
+
294
+ [3.0.0-alpha.16]: https://github.com/Hei33enberg/mosadd-os/tree/main/packages/mcp
295
+ [3.0.0-alpha.4]: https://github.com/Hei33enberg/mosadd-os/tree/main/packages/mcp
296
+ [LINEAR-2917]: https://linear.app/ip-ra/issue/LINEAR-2917
297
+ [LINEAR-3391]: https://linear.app/ip-ra/issue/LINEAR-3391
298
+ [RFC 0001]: https://github.com/Hei33enberg/mosadd-os/blob/main/docs/rfcs/0001-module-naming.md
package/README.md CHANGED
@@ -1,64 +1,86 @@
1
1
  # @mosadd/mcp
2
2
 
3
- MCP server for [mosadd](https://mosadd.dev) — exposes the OS modules (m\*) as Model Context Protocol tools so any agent runtime can talk to mosadd: Claude Code, Cursor, Windsurf, Cline, ChatGPT Apps, Lovable, Bolt, Goose, Manus, custom.
3
+ **They're apps. We're the layer.** The MCP server for [mosADD](https://mosadd.com) — the omnichannel comms layer for humans, agents, and robots. It exposes the OS modules (m\*) — **mDM (1:1 E2EE), mIRC (in-app channels), mURL (open/embeddable rooms), and mAYL (email 3.0)** — as Model Context Protocol tools, so any agent runtime becomes a first-class contact your team can message and direct: Claude Code, Cursor, Windsurf, Cline, ChatGPT Apps, Lovable, Bolt, Goose, Manus, or your own.
4
4
 
5
- > **3.0.0-alpha** — `mDM` only, wired to the m0ssad-3 Supabase backend as a strangler-fig step. Phase 1 full will add mTALK / mAIL / mCALL / mIRC / mIRL / mROOM + bridges. Phase 2 routes through the hosted gateway at `mcp.mosadd.com` with the 167-event radar in front.
5
+ One key, one server, 84 tools — MCP-native, no SDK to wire up. **Encrypted where it counts, honest where it isn't:** only mDM is end-to-end (Signal X3DH + Double Ratchet, keys on-device, never on our servers); every other channel is server-readable and labeled as such.
6
6
 
7
- ## Install
7
+ > **82 tools** across **4 modules** (mDM, mIRC, mURL, mAYL) + cross-cutting capabilities (mTALK voice, mRAG search, comms agent-actions) + agent→user action links + the `comms_capabilities` discovery tool, wired to the mosADD backend (BYOK) as a strangler-fig step. Phase 2 routes through the hosted gateway at `mcp.mosadd.com`.
8
8
 
9
- ### Claude Code
9
+ ## Connect your agent
10
+
11
+ Three ways to authenticate, friendliest first — all three end with the same 82 tools.
12
+
13
+ ### 1. `mosadd login` — recommended (one command, stays logged in)
14
+
15
+ Sign in once; the session is saved to `~/.mosadd/session.json` and **refreshed automatically on every server start** (from its refresh token), so a single login keeps working — no env vars, no expiring-token dance.
16
+
17
+ ```bash
18
+ npx -y @mosadd/mcp@alpha login
19
+ # prompts for your Supabase URL + anon key (both public) and your mosADD email + password
20
+ ```
21
+
22
+ Then register the server with **no env block**:
10
23
 
11
24
  ```bash
12
- claude mcp add mosadd npx -- -y @mosadd/mcp
25
+ # Claude Code
26
+ claude mcp add mosadd -- npx -y @mosadd/mcp@alpha
27
+ ```
28
+
29
+ ```json
30
+ // Claude Desktop / Cursor / Cline / Windsurf — mcpServers config, no env needed
31
+ {
32
+ "mcpServers": {
33
+ "mosadd": { "command": "npx", "args": ["-y", "@mosadd/mcp@alpha"] }
34
+ }
35
+ }
13
36
  ```
14
37
 
15
- ### Cursor
38
+ `npx @mosadd/mcp@alpha whoami` shows who you're signed in as; `… logout` clears it.
39
+
40
+ ### 2. `MOSADD_API_KEY` — headless / CI (one long-lived key)
16
41
 
17
- `~/.cursor/mcp.json`:
42
+ A `mosadd_sk_live_…` hub key does not expire; the server exchanges it for a fresh session on every start. Best for servers, cron, and our own `mosadd-agent`.
18
43
 
19
44
  ```json
20
45
  {
21
46
  "mcpServers": {
22
47
  "mosadd": {
23
48
  "command": "npx",
24
- "args": ["-y", "@mosadd/mcp"],
25
- "env": {
26
- "MOSADD_SUPABASE_URL": "https://<your-project>.supabase.co",
27
- "MOSADD_SUPABASE_ANON_KEY": "<anon key>",
28
- "MOSADD_USER_JWT": "<your session JWT>"
29
- }
49
+ "args": ["-y", "@mosadd/mcp@alpha"],
50
+ "env": { "MOSADD_API_KEY": "mosadd_sk_live_…" }
30
51
  }
31
52
  }
32
53
  }
33
54
  ```
34
55
 
35
- ### Standalone
36
-
37
- ```bash
38
- MOSADD_SUPABASE_URL=... MOSADD_SUPABASE_ANON_KEY=... MOSADD_USER_JWT=... npx @mosadd/mcp
39
- ```
56
+ Mint a key at **[mosadd.com/keys](https://mosadd.com/keys)** — the hub shows it once, in the `mosadd_sk_live_…` format above. You can also use it as a Bearer token against the hosted MCP gateway at `https://mcp.mosadd.com/mcp`.
40
57
 
41
- ## BYOK — get your env values
58
+ ### 3. BYOK + `MOSADD_USER_JWT` — advanced / debugging
42
59
 
43
- While the hosted gateway is in development, the alpha runs in **local BYOK mode** — you supply your own Supabase credentials to talk to your own m0ssad-3 backend.
60
+ Bring your own Supabase URL + anon key + a raw session token. **The JWT expires (~1h)** — prefer option 1 or 2 for anything ongoing.
44
61
 
45
62
  - `MOSADD_SUPABASE_URL` — your Supabase project URL (e.g. `https://abc.supabase.co`)
46
63
  - `MOSADD_SUPABASE_ANON_KEY` — the public anon key from project settings
47
- - `MOSADD_USER_JWT` — a Supabase session token for your mosadd user. Get it from the browser:
48
- 1. Sign in to mosadd.com
49
- 2. Open DevTools → Application → Local Storage → `sb-<ref>-auth-token`
50
- 3. Copy the `access_token` field
64
+ - `MOSADD_USER_JWT` — sign in to mosadd.com → DevTools → Application → Local Storage → `sb-<ref>-auth-token` → copy the `access_token` field
51
65
 
52
- In Phase 2, run `mosadd login` to OAuth into hub.mosadd.com — no JWT-juggling required.
66
+ In Phase 2 the hosted gateway at `mcp.mosadd.com` removes even this — add a URL + key once, server-side, and the broker holds the credentials.
53
67
 
54
68
  ## Tools shipped in alpha
55
69
 
56
- | Tool | Description |
57
- |---|---|
58
- | `mDM_list_contacts` | List your mosadd contacts (returns `identity_id` to use elsewhere) |
59
- | `mDM_send` | Send a DM. `{ to: identity_id, text, thread_label?, reply_to_id? }` |
60
- | `mDM_list` | Read DM thread |
61
- | `mDM_respond_request` | Accept/reject incoming DM request |
70
+ **82 tools** — 4 modules (mDM, mIRC, mURL, mAYL) + capabilities (mTALK voice, mRAG search + knowledge-graph traversal, comms agent-actions) + the `comms_capabilities` discovery tool. Highlights per module:
71
+
72
+ | Module | Tools | What it does |
73
+ |---|---|---|
74
+ | **mDM** (16) | `mDM_list_contacts`, `mDM_send`, `mDM_send_unencrypted` (DEPRECATED — migration-window fallback, only when the peer hasn't published keys), `mDM_edit`, `mDM_delete`, `mDM_list`, `mDM_publish_keys`, `mDM_respond_request`, `mDM_call_start/answer/end`, `mDM_voice_note`, `mDM_send_voice`, `mDM_send_file` | 1:1 text, voice notes, calls + file/voice attachments. Multi-thread per contact. `mDM_send` is end-to-end encrypted by default (X3DH / Double Ratchet, `mosadd.e2ee.v2`); the operator cannot read message content |
75
+ | **mIRC** (24) | `mIRC_create/list/get/update/delete/discover/report`, member RBAC (`mIRC_join/leave/kick/ban/unban/set_role/set_ptt/approve_request/reject_request/request_access`), `mIRC_post_message`, `mIRC_list_messages`, edge (`mIRC_mint_channel_token`, `mIRC_send_edge`, `mIRC_history_edge`), `mIRC_send_voice/file` | Persistent Discord/Slack-style channels + the agent-coordination edge transport |
76
+ | **mURL** (7) | `mURL_read_channel`, `mURL_post`, `mURL_presence`, `mURL_list_channels`, `mURL_create`, `mURL_update`, `mURL_delete` | IRC-for-URLs — open-web text rooms, agent-native. Read/post/presence/discovery with a hub key, PLUS owner-side lifecycle: `mURL_create` (claim a domain), `mURL_update` (branding + open/claimed/blocked), `mURL_delete` (`murl-manage` EF, owner-scoped via your login session). Transport-encrypted, server-readable/public by design |
77
+ | **mAYL** (16) | `mAYL_send`, `mAYL_view`, `mAYL_list`, `mAYL_delete`, `mAYL_stats`, `mAYL_events`, `mAYL_metrics`, `mAYL_revoke`, `mAYL_audit_export`, `mAYL_consent`, `mAYL_notify`, `mAYL_send_as_agent`, `mAYL_agentbox_provision`, `mAYL_agentbox_list`, `mAYL_agentbox_extend`, `mAYL_agentbox_release` | Mail; every user gets `<id>@mosadd.com`. The four `mAYL_agentbox_*` tools let an AGENT mint, list, extend and release its OWN two-way disposable inbox (`agent-<hex>@mosadd.com`) — `create_inbox` parity with AgentMail, on our stack, with provenance. Transport + at-rest encrypted (server-readable), NOT E2EE. `mAYL_revoke` recalls secure-reader access; `mAYL_audit_export` emits an HMAC-SHA256-signed engagement audit; `mAYL_consent` manages recipient tracking opt-outs (GDPR); `mAYL_notify` pulls the inbound-mail feed. (Was the mp0st codename; the `mp0st_*` aliases are retired — mAYL is the one name) |
78
+ | **mTALK** (6) | `mTALK_open`, `mTALK_join`, `mTALK_press`, `mTALK_release`, `mTALK_state`, `mTALK_ingest_ptt` | Half-duplex push-to-talk: one speaker, FIFO queue, anti-hog auto-release + transcript ingest to mRAG |
79
+ | **mRAG** (8) | `mRAG_ingest`, `mRAG_search`, `mRAG_list_sources`, `mRAG_delete`, `mRAG_graph_refresh`, `mRAG_graph_overview`, `mRAG_graph_neighbors`, `mRAG_graph_timeline` | RAG recall over the user's own data (hybrid vector + BM25) + knowledge-graph traversal (who/what/when) |
80
+ | **comms_** (4) | `comms_action_create`, `comms_action_frame_get`, `comms_capabilities`, `comms_embed_create` | `comms_action_create` mints an agent→user one-link browser action (Tier 1); `comms_action_frame_get` fetches a framed action; `comms_capabilities` is one-call discovery of every tool's transport `requires` flag; `comms_embed_create` mints a publishable embed key + a paste-in `<script>` snippet that drops a live mIRC channel into any website (`embed.mosadd.com/v1.js`, skins + sidebar/launcher modes) |
81
+ | **Irondome** (2) | `threat_catalog`, `threat_classify` | On-device defensive classification over the 193-event threat taxonomy — pure, offline, no backend and no surveillance. The engine decides, the caller acts. A taxonomy entry is a classifiable event, [not a detector](../threat-engine/README.md#read-this-first-a-taxonomy-entry-is-not-a-detector) |
82
+
83
+ Module tools: mDM (16) + mIRC (24) + mURL (7) + mAYL (16) = 61; capabilities: mTALK (6) + mRAG (8) + comms_ (5, incl. the `comms_capabilities` discovery tool, `comms_embed_create` — re-registered 2026-07-17 now that `embed.mosadd.com/v1.js` is live — and `comms_session_attach`, added 2026-08-14) + Irondome (2) = 21 — **84 callable tools** in total. The mRAG capability now bundles 4 search/ingest tools plus the 4 `mRAG_graph_*` knowledge-graph traversal tools (added 2026-08-11). The exact live number is exported as `TOOL_COUNT` (`= allTools.length`) — reference that, never a hand-typed figure. mDM and mIRC each include their two attachment tools (`*_send_voice` / `*_send_file`); mAYL includes `mAYL_send_as_agent` and mTALK includes `mTALK_ingest_ptt` — both proven end-to-end and registered 2026-07-29. Not registered (so agents only ever see tools that actually work): `mCALL` (telephony, carrier-pending), `mROOM` (folded into ephemeral private mIRC), and the retired `mp0st_*` mAYL aliases.
62
84
 
63
85
  All tool names follow [RFC 0001](https://github.com/Hei33enberg/mosadd-os/blob/main/docs/rfcs/0001-module-naming.md) — `m<MODULE>_<operation>` snake_case.
64
86
 
@@ -72,7 +94,7 @@ Claude calls `mDM_list_contacts` → you see your contact list.
72
94
 
73
95
  > Send "hello from Claude" to <id> with thread label `notes`.
74
96
 
75
- Claude calls `mDM_send({ to, text, thread_label: "notes" })` → message appears in your mosadd app under a `notes` thread.
97
+ Claude calls `mDM_send({ to, text, thread_label: "notes" })` → message appears in your mosADD app under a `notes` thread.
76
98
 
77
99
  ## Architecture
78
100
 
@@ -86,7 +108,7 @@ Agent (Claude / Cursor / ...)
86
108
  │ supabase.functions.invoke('message-send', ...)
87
109
  │ + Authorization: Bearer <MOSADD_USER_JWT>
88
110
  ▼
89
- m0ssad-3 Edge Function
111
+ mosADD backend Edge Function
90
112
  │
91
113
  │ RLS-checked insert
92
114
  ▼
@@ -97,20 +119,32 @@ Postgres `messages` table
97
119
  mosadd.com app (receiver)
98
120
  ```
99
121
 
100
- For PTT / CALL / ROOM (real-time media), the architecture separates **control plane** (MCP) from **data plane** (WebRTC daemon). See [docs/architecture/control-data-plane.md](https://github.com/Hei33enberg/mosadd-os/blob/main/docs/architecture/control-data-plane.md) when it lands.
122
+ For PTT / CALL (real-time media), the architecture separates **control plane** (MCP) from **data plane** (WebRTC daemon). See [docs/architecture/control-data-plane.md](https://github.com/Hei33enberg/mosadd-os/blob/main/docs/architecture/control-data-plane.md) when it lands.
101
123
 
102
124
  ## Configuration via env vars
103
125
 
104
126
  | Env | Description | Required |
105
127
  |---|---|---|
106
- | `MOSADD_SUPABASE_URL` | Supabase project URL | yes |
107
- | `MOSADD_SUPABASE_ANON_KEY` | Supabase anon key | yes |
128
+ | `MOSADD_SUPABASE_URL` | Supabase project URL — DM / IRC / mail / KB backend | yes (BYOK) |
129
+ | `MOSADD_SUPABASE_ANON_KEY` | Supabase anon key | yes (BYOK) |
108
130
  | `MOSADD_USER_JWT` | User session token | yes (for tools that touch user data) |
131
+ | `MOSADD_RESEND_API_KEY` | Resend API key — enables `mAYL` outbound mail (the `mp0st_*` aliases are retired — `mAYL_*` is the one name) | no (mAYL disabled if unset) |
132
+ | `MOSADD_LIVEKIT_URL` | LiveKit `wss://…` URL — enables `mTALK` voice | no (voice disabled if unset) |
133
+ | `MOSADD_LIVEKIT_API_KEY` | LiveKit API key | no (with `…_URL` / `…_API_SECRET`) |
134
+ | `MOSADD_LIVEKIT_API_SECRET` | LiveKit API secret | no |
109
135
  | `MOSADD_API_KEY` | Hub API key (Phase 2 hosted mode) | no |
110
136
  | `MOSADD_HUB_URL` | Override hub url | no |
111
137
  | `MOSADD_MODE` | `local` / `cloud` / `self-host` | no (auto-detected) |
112
138
  | `MOSADD_LOG_LEVEL` | `debug` / `info` / `warn` / `error` | no (default `info`) |
113
139
 
140
+ Missing optional keys fail closed — that channel is simply absent from `comms_capabilities`.
141
+
142
+ ## Links
143
+
144
+ - **Mint a key + docs** — [mosadd.com/keys](https://mosadd.com/keys) · [mosadd.com/docs](https://mosadd.com/docs) · [mosadd.com/mcp](https://mosadd.com/mcp)
145
+ - **Hosted gateway** — `https://mcp.mosadd.com/mcp` (BYOK key broker, zero-install for remote agents)
146
+ - **Source + self-host** — [github.com/Hei33enberg/mosADD-OS](https://github.com/Hei33enberg/mosADD-OS) (Apache-2.0)
147
+
114
148
  ## License
115
149
 
116
150
  Apache-2.0. See repo [LICENSE](https://github.com/Hei33enberg/mosadd-os/blob/main/LICENSE) and [NOTICE](https://github.com/Hei33enberg/mosadd-os/blob/main/NOTICE).
package/dist/bin/mcp.js CHANGED
@@ -1,11 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  createMosaddServer
4
- } from "../chunk-YDFU6S5E.js";
5
- import "../chunk-Z7WR52GE.js";
4
+ } from "../chunk-7ZAAJ52G.js";
5
+ import {
6
+ isSessionExpired,
7
+ loadSession,
8
+ saveSession
9
+ } from "../chunk-Z7WR52GE.js";
6
10
 
7
11
  // src/bin/mcp.ts
8
12
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
13
+ import { createClient } from "@supabase/supabase-js";
9
14
  var DEFAULT_EXCHANGE = "https://rooffhgbxafyjcwmwpsy.supabase.co/functions/v1/hub-key-exchange";
10
15
  async function bootstrapFromApiKey() {
11
16
  const apiKey = process.env.MOSADD_API_KEY;
@@ -33,6 +38,36 @@ async function bootstrapFromApiKey() {
33
38
  );
34
39
  }
35
40
  }
41
+ async function bootstrapFromSavedSession() {
42
+ if (process.env.MOSADD_USER_JWT) return;
43
+ const session = loadSession();
44
+ if (!session?.refreshToken) return;
45
+ if (!isSessionExpired(session)) return;
46
+ try {
47
+ const client = createClient(session.url, session.anonKey, {
48
+ auth: { persistSession: false, autoRefreshToken: false, detectSessionInUrl: false }
49
+ });
50
+ const { data, error } = await client.auth.refreshSession({ refresh_token: session.refreshToken });
51
+ if (error || !data.session) {
52
+ process.stderr.write(
53
+ JSON.stringify({ level: "warn", msg: "mosadd session refresh failed \u2014 run `mosadd login`", error: error?.message }) + "\n"
54
+ );
55
+ return;
56
+ }
57
+ saveSession({
58
+ url: session.url,
59
+ anonKey: session.anonKey,
60
+ accessToken: data.session.access_token,
61
+ refreshToken: data.session.refresh_token ?? session.refreshToken,
62
+ expiresAt: data.session.expires_at,
63
+ email: data.user?.email ?? session.email
64
+ });
65
+ } catch (err) {
66
+ process.stderr.write(
67
+ JSON.stringify({ level: "warn", msg: "mosadd session refresh error \u2014 run `mosadd login`", error: String(err) }) + "\n"
68
+ );
69
+ }
70
+ }
36
71
  async function main() {
37
72
  const sub = process.argv[2];
38
73
  if (sub === "login" || sub === "logout" || sub === "whoami") {
@@ -41,11 +76,15 @@ async function main() {
41
76
  return;
42
77
  }
43
78
  await bootstrapFromApiKey();
79
+ await bootstrapFromSavedSession();
44
80
  const server = createMosaddServer({
45
81
  apiKey: process.env.MOSADD_API_KEY,
46
82
  hubUrl: process.env.MOSADD_HUB_URL,
47
83
  mode: process.env.MOSADD_MODE,
48
- logLevel: process.env.MOSADD_LOG_LEVEL
84
+ logLevel: process.env.MOSADD_LOG_LEVEL,
85
+ // stdio is single-tenant: the session lives in env (set by bootstrapFromApiKey
86
+ // above), so auto-publish this identity's prekeys on boot → mDM is reachable.
87
+ autoPublishKeys: true
49
88
  });
50
89
  const transport = new StdioServerTransport();
51
90
  await server.connect(transport);