@mosadd/mcp 3.0.0-alpha.54 → 3.0.0-alpha.55

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 (51) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +150 -150
  3. package/dist/bin/mcp.js +1 -1
  4. package/dist/{chunk-3PUOM4R5.js → chunk-IWUGKLDX.js} +54 -20
  5. package/dist/index.js +1 -1
  6. package/package.json +1 -1
  7. package/src/__tests__/blob-upload.test.ts +93 -93
  8. package/src/__tests__/channel-e2ee.test.ts +62 -62
  9. package/src/__tests__/flota-jawnie.test.ts +244 -0
  10. package/src/__tests__/golden-path.test.ts +139 -139
  11. package/src/__tests__/integration.test.ts +182 -182
  12. package/src/__tests__/mdm-e2ee.test.ts +212 -212
  13. package/src/__tests__/mdm-mcp-readable.test.ts +390 -386
  14. package/src/__tests__/mirc-invite.test.ts +112 -112
  15. package/src/__tests__/mtalk.test.ts +122 -122
  16. package/src/__tests__/server.test.ts +71 -71
  17. package/src/__tests__/tool-count-consistency.test.ts +199 -199
  18. package/src/bin/login.ts +138 -138
  19. package/src/bin/mcp.ts +145 -145
  20. package/src/config.ts +66 -66
  21. package/src/crypto/channel-e2ee.ts +288 -288
  22. package/src/crypto/mdm-session.ts +842 -842
  23. package/src/index.ts +19 -19
  24. package/src/observability/sentry.ts +79 -79
  25. package/src/providers/memory-voice.ts +79 -79
  26. package/src/providers/supabase-dm.ts +202 -202
  27. package/src/providers/supabase-voice.ts +91 -91
  28. package/src/server.ts +195 -195
  29. package/src/tools/actions.ts +166 -166
  30. package/src/tools/attachments.ts +276 -276
  31. package/src/tools/capabilities.ts +70 -70
  32. package/src/tools/channel-payload.ts +69 -0
  33. package/src/tools/embed.ts +110 -110
  34. package/src/tools/index.ts +181 -181
  35. package/src/tools/knowledge.ts +344 -344
  36. package/src/tools/mail-aliases.ts +25 -25
  37. package/src/tools/mail-provenance.ts +137 -137
  38. package/src/tools/mail.ts +403 -403
  39. package/src/tools/mdm-as-agent.ts +126 -126
  40. package/src/tools/mdm.ts +26 -11
  41. package/src/tools/mirc-edge.ts +196 -196
  42. package/src/tools/mirc-members.ts +287 -287
  43. package/src/tools/mirc-messages.ts +9 -13
  44. package/src/tools/mirc.ts +308 -308
  45. package/src/tools/mroom-messages.ts +4 -12
  46. package/src/tools/mroom.ts +221 -221
  47. package/src/tools/mtalk.ts +131 -131
  48. package/src/tools/presence.ts +442 -442
  49. package/src/tools/voice-format.ts +28 -28
  50. package/src/types.ts +121 -121
  51. package/src/voice/floor.ts +132 -132
package/CHANGELOG.md CHANGED
@@ -21,6 +21,30 @@ gateway (Phase 2) ships.
21
21
 
22
22
  Tool count **84 → 85** (mIRC **24 → 25**); `TOOL_COUNT` (`= allTools.length`) stays the truth.
23
23
 
24
+ ## [3.0.0-alpha.55] — 2026-09-29
25
+
26
+ ### Fixed
27
+ - **Channel/room reader: the King's posts read as text, not `<ciphertext>`** (ZERO SZYFROWANIA,
28
+ rozkaz Krola 28.09). `mIRC_list_messages` and `mROOM_list_messages` understood only a JSON
29
+ `mosadd.chat.v1` envelope and stamped everything else `<ciphertext>` — including every post
30
+ the app writes (plain UTF-8 in base64, `ircApi.ts encodePayload`) on the OPEN, keyless #adm and
31
+ #command (measured 28–29.09: f159c8d7, 776b3e9a). New shared decoder `tools/channel-payload.ts`
32
+ (same rule as `mdm.ts unpackPayload` and the mKEEPER bridge `decodePayload.mjs`): envelope →
33
+ its `text`; plain UTF-8 → the text; other JSON (voice `{audio, mime, dur}`) → raw, so
34
+ `formatVoiceIfAny` shapes it (mROOM now too). `<ciphertext>` stays ONLY for a sealed envelope
35
+ the line cannot open — group-key `{iv, ciphertext, hmac}` without the key, `mosadd.e2ee.*` —
36
+ and for bytes that are not UTF-8 text.
37
+ - **`mDM_send`: conversations with fleet lines and with the King always in the clear.** Besides
38
+ an agent line on either side (alpha.54), a note to SELF (`to === selfId`) now goes plain too
39
+ (MCP sessions on the King's key sealed his own thread; `message-send` refuses envelopes there
40
+ with `fleet_plaintext_only`). The result carries `reason: "fleet_plaintext"` (plain) or
41
+ `"human_to_human"` (E2EE). Person↔person stays X3DH + Double Ratchet, unchanged.
42
+ - **Tool descriptions:** `mDM_send_unencrypted` is no longer "DEPRECATED / prefer mDM_send / will
43
+ be removed" — that text steered every LLM line to the sealing tool. Both DM send tools now say:
44
+ conversations with fleet lines and with the King are ALWAYS in the clear.
45
+ - Lock `src/__tests__/flota-jawnie.test.ts` (13 tests): red on alpha.54 (7/13, the King's text →
46
+ `<ciphertext>`), red under five sabotages of the new rules, green after.
47
+
24
48
  ## [3.0.0-alpha.54] — 2026-09-27
25
49
 
26
50
  ### Fixed
package/README.md CHANGED
@@ -1,150 +1,150 @@
1
- # @mosadd/mcp
2
-
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
-
5
- One key, one server, 85 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
-
7
- > **85 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
-
9
- ## Connect your agent
10
-
11
- Three ways to authenticate, friendliest first — all three end with the same 85 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**:
23
-
24
- ```bash
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
- }
36
- ```
37
-
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)
41
-
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`.
43
-
44
- ```json
45
- {
46
- "mcpServers": {
47
- "mosadd": {
48
- "command": "npx",
49
- "args": ["-y", "@mosadd/mcp@alpha"],
50
- "env": { "MOSADD_API_KEY": "mosadd_sk_live_…" }
51
- }
52
- }
53
- }
54
- ```
55
-
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`.
57
-
58
- ### 3. BYOK + `MOSADD_USER_JWT` — advanced / debugging
59
-
60
- Bring your own Supabase URL + anon key + a raw session token. **The JWT expires (~1h)** — prefer option 1 or 2 for anything ongoing.
61
-
62
- - `MOSADD_SUPABASE_URL` — your Supabase project URL (e.g. `https://abc.supabase.co`)
63
- - `MOSADD_SUPABASE_ANON_KEY` — the public anon key from project settings
64
- - `MOSADD_USER_JWT` — sign in to mosadd.com → DevTools → Application → Local Storage → `sb-<ref>-auth-token` → copy the `access_token` field
65
-
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.
67
-
68
- ## Tools shipped in alpha
69
-
70
- **85 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** (25) | `mIRC_create/list/get/update/delete/discover/report`, member RBAC (`mIRC_join/leave/invite/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 (25) + mURL (7) + mAYL (16) = 64; 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 — **85 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.
84
-
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.
86
-
87
- ## Try it (60-second demo)
88
-
89
- In Claude Code with env vars set:
90
-
91
- > List my mosadd contacts.
92
-
93
- Claude calls `mDM_list_contacts` → you see your contact list.
94
-
95
- > Send "hello from Claude" to <id> with thread label `notes`.
96
-
97
- Claude calls `mDM_send({ to, text, thread_label: "notes" })` → message appears in your mosADD app under a `notes` thread.
98
-
99
- ## Architecture
100
-
101
- ```
102
- Agent (Claude / Cursor / ...)
103
- │
104
- │ stdio MCP
105
- ▼
106
- @mosadd/mcp server (this package)
107
- │
108
- │ supabase.functions.invoke('message-send', ...)
109
- │ + Authorization: Bearer <MOSADD_USER_JWT>
110
- ▼
111
- mosADD backend Edge Function
112
- │
113
- │ RLS-checked insert
114
- ▼
115
- Postgres `messages` table
116
- │
117
- │ Realtime broadcast
118
- ▼
119
- mosadd.com app (receiver)
120
- ```
121
-
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.
123
-
124
- ## Configuration via env vars
125
-
126
- | Env | Description | Required |
127
- |---|---|---|
128
- | `MOSADD_SUPABASE_URL` | Supabase project URL — DM / IRC / mail / KB backend | yes (BYOK) |
129
- | `MOSADD_SUPABASE_ANON_KEY` | Supabase anon key | yes (BYOK) |
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 |
135
- | `MOSADD_API_KEY` | Hub API key (Phase 2 hosted mode) | no |
136
- | `MOSADD_HUB_URL` | Override hub url | no |
137
- | `MOSADD_MODE` | `local` / `cloud` / `self-host` | no (auto-detected) |
138
- | `MOSADD_LOG_LEVEL` | `debug` / `info` / `warn` / `error` | no (default `info`) |
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
-
148
- ## License
149
-
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).
1
+ # @mosadd/mcp
2
+
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
+
5
+ One key, one server, 85 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
+
7
+ > **85 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
+
9
+ ## Connect your agent
10
+
11
+ Three ways to authenticate, friendliest first — all three end with the same 85 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**:
23
+
24
+ ```bash
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
+ }
36
+ ```
37
+
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)
41
+
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`.
43
+
44
+ ```json
45
+ {
46
+ "mcpServers": {
47
+ "mosadd": {
48
+ "command": "npx",
49
+ "args": ["-y", "@mosadd/mcp@alpha"],
50
+ "env": { "MOSADD_API_KEY": "mosadd_sk_live_…" }
51
+ }
52
+ }
53
+ }
54
+ ```
55
+
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`.
57
+
58
+ ### 3. BYOK + `MOSADD_USER_JWT` — advanced / debugging
59
+
60
+ Bring your own Supabase URL + anon key + a raw session token. **The JWT expires (~1h)** — prefer option 1 or 2 for anything ongoing.
61
+
62
+ - `MOSADD_SUPABASE_URL` — your Supabase project URL (e.g. `https://abc.supabase.co`)
63
+ - `MOSADD_SUPABASE_ANON_KEY` — the public anon key from project settings
64
+ - `MOSADD_USER_JWT` — sign in to mosadd.com → DevTools → Application → Local Storage → `sb-<ref>-auth-token` → copy the `access_token` field
65
+
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.
67
+
68
+ ## Tools shipped in alpha
69
+
70
+ **85 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** (25) | `mIRC_create/list/get/update/delete/discover/report`, member RBAC (`mIRC_join/leave/invite/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 (25) + mURL (7) + mAYL (16) = 64; 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 — **85 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.
84
+
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.
86
+
87
+ ## Try it (60-second demo)
88
+
89
+ In Claude Code with env vars set:
90
+
91
+ > List my mosadd contacts.
92
+
93
+ Claude calls `mDM_list_contacts` → you see your contact list.
94
+
95
+ > Send "hello from Claude" to <id> with thread label `notes`.
96
+
97
+ Claude calls `mDM_send({ to, text, thread_label: "notes" })` → message appears in your mosADD app under a `notes` thread.
98
+
99
+ ## Architecture
100
+
101
+ ```
102
+ Agent (Claude / Cursor / ...)
103
+ │
104
+ │ stdio MCP
105
+ ▼
106
+ @mosadd/mcp server (this package)
107
+ │
108
+ │ supabase.functions.invoke('message-send', ...)
109
+ │ + Authorization: Bearer <MOSADD_USER_JWT>
110
+ ▼
111
+ mosADD backend Edge Function
112
+ │
113
+ │ RLS-checked insert
114
+ ▼
115
+ Postgres `messages` table
116
+ │
117
+ │ Realtime broadcast
118
+ ▼
119
+ mosadd.com app (receiver)
120
+ ```
121
+
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.
123
+
124
+ ## Configuration via env vars
125
+
126
+ | Env | Description | Required |
127
+ |---|---|---|
128
+ | `MOSADD_SUPABASE_URL` | Supabase project URL — DM / IRC / mail / KB backend | yes (BYOK) |
129
+ | `MOSADD_SUPABASE_ANON_KEY` | Supabase anon key | yes (BYOK) |
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 |
135
+ | `MOSADD_API_KEY` | Hub API key (Phase 2 hosted mode) | no |
136
+ | `MOSADD_HUB_URL` | Override hub url | no |
137
+ | `MOSADD_MODE` | `local` / `cloud` / `self-host` | no (auto-detected) |
138
+ | `MOSADD_LOG_LEVEL` | `debug` / `info` / `warn` / `error` | no (default `info`) |
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
+
148
+ ## License
149
+
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,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  createMosaddServer
4
- } from "../chunk-3PUOM4R5.js";
4
+ } from "../chunk-IWUGKLDX.js";
5
5
  import {
6
6
  isSessionExpired,
7
7
  loadSession,
@@ -821,13 +821,15 @@ async function mDM_send(input, ctx) {
821
821
  const threadId = dmThreadId(selfId, input.to, input.thread_label);
822
822
  const keys = ctx.providers.keys;
823
823
  const selfKind = await selfKindOf(dm);
824
- const peerKind = selfKind === "agent" || input.to === selfId ? selfKind : await peerKindOf(dm, input.to);
825
- if (selfKind === "agent" || peerKind === "agent") {
824
+ const noteToSelf = input.to === selfId;
825
+ const peerKind = selfKind === "agent" || noteToSelf ? selfKind : await peerKindOf(dm, input.to);
826
+ if (selfKind === "agent" || peerKind === "agent" || noteToSelf) {
826
827
  const payload = packPlaintextPayload(input.text);
827
- ctx.log("debug", "mDM_send plaintext agent lane (rozkaz Krola 20.09)", {
828
+ ctx.log("debug", "mDM_send fleet plaintext (rozkaz Krola 20.09 + 28.09)", {
828
829
  thread_id: threadId,
829
830
  self_kind: selfKind,
830
- peer_kind: peerKind
831
+ peer_kind: peerKind,
832
+ note_to_self: noteToSelf
831
833
  });
832
834
  const plainArgs = {
833
835
  to: input.to,
@@ -843,6 +845,7 @@ async function mDM_send(input, ctx) {
843
845
  thread_id: threadId,
844
846
  encrypted: false,
845
847
  mode: "plaintext_agent_lane",
848
+ reason: "fleet_plaintext",
846
849
  sender_copy: true,
847
850
  recipient_copy: true,
848
851
  identity: "untouched"
@@ -893,6 +896,7 @@ async function mDM_send(input, ctx) {
893
896
  thread_id: threadId,
894
897
  encrypted: true,
895
898
  mode: "e2ee",
899
+ reason: "human_to_human",
896
900
  sender_copy: !!selfPayload,
897
901
  recipient_copy: !!recipientSelfPayload,
898
902
  identity
@@ -903,7 +907,7 @@ async function mDM_send_unencrypted(input, ctx) {
903
907
  const selfId = await dm.selfId();
904
908
  const threadId = dmThreadId(selfId, input.to, input.thread_label);
905
909
  const payload = packPlaintextPayload(input.text);
906
- ctx.log("warn", "mDM_send_unencrypted (deprecated, plaintext) via DmProvider", {
910
+ ctx.log("debug", "mDM_send_unencrypted (plaintext) via DmProvider", {
907
911
  thread_id: threadId,
908
912
  bytes: payload.byteLength
909
913
  });
@@ -1103,19 +1107,19 @@ var mdmTools = [
1103
1107
  },
1104
1108
  {
1105
1109
  name: "mDM_send",
1106
- title: "Send encrypted DM",
1110
+ title: "Send DM",
1107
1111
  annotations: { readOnlyHint: false },
1108
1112
  requires: "any",
1109
- description: "Send a direct message via mosadd mDM. Between two PEOPLE it is END-TO-END-ENCRYPTED; when either side is an agent line it goes in the clear (mosadd rule: agents must read their DMs), exactly like the mosadd app. Pass `to` as the recipient's mosadd identity_id (look it up with mDM_list_contacts). Establishes an X3DH + Double Ratchet session on first contact (the recipient must have run mDM_publish_keys). Optional thread_label puts the message in a named thread \u2014 mosadd USP: multiple threads per contact, unlike WhatsApp/Telegram. If the recipient has no published keys yet, use mDM_send_unencrypted.",
1113
+ description: 'Send a direct message via mosadd mDM. Conversations with fleet lines and with the King: ALWAYS in the clear \u2014 when either side is an agent line, or you write to yourself, the message goes as plain text (result `encrypted: false, reason: "fleet_plaintext"`), exactly like the mosadd app. Only between two PEOPLE is it END-TO-END-ENCRYPTED (X3DH + Double Ratchet; the recipient must have published keys). Pass `to` as the recipient\'s mosadd identity_id (look it up with mDM_list_contacts). Optional thread_label puts the message in a named thread \u2014 mosadd USP: multiple threads per contact, unlike WhatsApp/Telegram.',
1110
1114
  inputSchema: mDM_send_input,
1111
1115
  handler: mDM_send
1112
1116
  },
1113
1117
  {
1114
1118
  name: "mDM_send_unencrypted",
1115
- title: "Send unencrypted DM",
1119
+ title: "Send plain-text DM",
1116
1120
  annotations: { readOnlyHint: false },
1117
1121
  requires: "any",
1118
- description: "DEPRECATED migration-window fallback: send a direct message WITHOUT end-to-end encryption (plaintext envelope). Only use when the recipient has not yet published prekeys (mDM_send fails with that hint). Prefer mDM_send. Will be removed once E2EE is universal.",
1122
+ description: "Send a direct message as plain text, never encrypted. Conversations with fleet lines and with the King: ALWAYS in the clear \u2014 this is the path for every agent line writing to the King, to another line or to itself, and it is permanent. Pass `to` as the recipient's mosadd identity_id (look it up with mDM_list_contacts); optional thread_label puts it in a named thread. mDM_send picks the same plain-text path by itself whenever a fleet line is a party.",
1119
1123
  inputSchema: mDM_send_input,
1120
1124
  handler: mDM_send_unencrypted
1121
1125
  },
@@ -1890,6 +1894,44 @@ async function decryptChannelPayload(channelId, payloadB64) {
1890
1894
  return decryptWithGroupKey(groupKey, payloadB64);
1891
1895
  }
1892
1896
 
1897
+ // src/tools/channel-payload.ts
1898
+ var CIPHERTEXT_MARKER = "<ciphertext>";
1899
+ var STRICT_BASE64 = /^[A-Za-z0-9+/]*={0,2}$/;
1900
+ var CONTROL_CHARS = /[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/;
1901
+ function isSealedEnvelope(obj) {
1902
+ if (!obj || typeof obj !== "object") return false;
1903
+ const o = obj;
1904
+ if (typeof o.iv === "string" && typeof o.ciphertext === "string") return true;
1905
+ if (typeof o.v === "string" && o.v.startsWith("mosadd.e2ee")) return true;
1906
+ return false;
1907
+ }
1908
+ function decodeStoredPayloadText(payload) {
1909
+ if (typeof payload !== "string" || payload.length === 0) return "";
1910
+ let raw;
1911
+ const compact = payload.replace(/\s+/g, "");
1912
+ if (compact.length % 4 === 0 && STRICT_BASE64.test(compact)) {
1913
+ try {
1914
+ raw = new TextDecoder("utf-8", { fatal: true }).decode(Buffer.from(compact, "base64"));
1915
+ } catch {
1916
+ return CIPHERTEXT_MARKER;
1917
+ }
1918
+ } else {
1919
+ raw = payload;
1920
+ }
1921
+ if (raw.startsWith("{")) {
1922
+ try {
1923
+ const obj = JSON.parse(raw);
1924
+ if (isSealedEnvelope(obj)) return CIPHERTEXT_MARKER;
1925
+ const text = obj?.text;
1926
+ if (typeof text === "string") return text;
1927
+ return raw;
1928
+ } catch {
1929
+ }
1930
+ }
1931
+ if (CONTROL_CHARS.test(raw)) return CIPHERTEXT_MARKER;
1932
+ return raw;
1933
+ }
1934
+
1893
1935
  // src/tools/mirc-messages.ts
1894
1936
  var PROTOCOL_VERSION4 = "mosadd.chat.v1";
1895
1937
  var ChannelId3 = z6.string().min(1).max(120).describe("Channel id (UUID). From mIRC_create / mIRC_list.");
@@ -1918,18 +1960,10 @@ function buildPlaintextEnvelope(text, replyToId) {
1918
1960
  };
1919
1961
  return JSON.stringify(envelope);
1920
1962
  }
1921
- function unpackPayload2(payload) {
1922
- try {
1923
- const obj = JSON.parse(Buffer.from(payload, "base64").toString("utf8"));
1924
- if (typeof obj?.text === "string") return obj;
1925
- } catch {
1926
- }
1927
- return { text: "<ciphertext>" };
1928
- }
1929
1963
  async function payloadToText(channelId, payload) {
1930
1964
  const decrypted = await decryptChannelPayload(channelId, payload);
1931
1965
  if (decrypted !== null) return unwrapEnvelopeText(decrypted);
1932
- return unpackPayload2(payload).text;
1966
+ return decodeStoredPayloadText(payload);
1933
1967
  }
1934
1968
  async function resolveLinkedSpaceId(channelId) {
1935
1969
  const data = await invokeFunction("channel-manage", { action: "get", channel_id: channelId });
@@ -2011,7 +2045,7 @@ var mircMessagesTools = [
2011
2045
  title: "Read channel messages",
2012
2046
  annotations: { readOnlyHint: true },
2013
2047
  requires: "network",
2014
- description: "List recent text messages in a persistent channel (mIRC), newest first, cursor-paginated. Pass channel_id; the backing space is resolved automatically. ENCRYPTION: messages your line can decrypt (group-key channels \u2014 auto-provisioned key material) come back as readable text; anything else falls back to the legacy envelope/plaintext decode.",
2048
+ description: "List recent text messages in a persistent channel (mIRC), newest first, cursor-paginated. Pass channel_id; the backing space is resolved automatically. ENCRYPTION: messages your line can decrypt (group-key channels \u2014 auto-provisioned key material) come back as readable text; everything else is decoded as written: the app's plain text and the toolkit's JSON envelope both come back as readable text (open channels such as #adm and #command are never encrypted). Only a sealed group-key envelope your line holds no key for reads <ciphertext>.",
2015
2049
  inputSchema: mIRC_list_messages_input,
2016
2050
  handler: mIRC_list_messages
2017
2051
  }
@@ -3926,7 +3960,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3926
3960
  // package.json
3927
3961
  var package_default = {
3928
3962
  name: "@mosadd/mcp",
3929
- version: "3.0.0-alpha.54",
3963
+ version: "3.0.0-alpha.55",
3930
3964
  mcpName: "io.github.hei33enberg/mosadd-mcp",
3931
3965
  description: "Model Context Protocol server for mosadd. Exposes 4 modules (mDM, mIRC, mURL, mAYL) and capabilities (mTALK, mRAG) plus comms agent-actions \u2014 85 tools \u2014 to any agent runtime (Claude Code, Cursor, Windsurf, Cline, ChatGPT Apps, Lovable, Bolt, Goose, Manus, custom).",
3932
3966
  homepage: "https://github.com/Hei33enberg/mosADD-OS/tree/main/packages/mcp",
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  createMosaddServer,
5
5
  defaultProviders,
6
6
  runWithSupabaseEnv
7
- } from "./chunk-3PUOM4R5.js";
7
+ } from "./chunk-IWUGKLDX.js";
8
8
  import "./chunk-Z7WR52GE.js";
9
9
  export {
10
10
  TOOL_COUNT,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mosadd/mcp",
3
- "version": "3.0.0-alpha.54",
3
+ "version": "3.0.0-alpha.55",
4
4
  "mcpName": "io.github.hei33enberg/mosadd-mcp",
5
5
  "description": "Model Context Protocol server for mosadd. Exposes 4 modules (mDM, mIRC, mURL, mAYL) and capabilities (mTALK, mRAG) plus comms agent-actions — 85 tools — to any agent runtime (Claude Code, Cursor, Windsurf, Cline, ChatGPT Apps, Lovable, Bolt, Goose, Manus, custom).",
6
6
  "homepage": "https://github.com/Hei33enberg/mosADD-OS/tree/main/packages/mcp",