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

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.
package/CHANGELOG.md CHANGED
@@ -8,18 +8,36 @@ gateway (Phase 2) ships.
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [3.0.0-alpha.56] — 2026-11-10
12
+
11
13
  ### Added
12
- - **`mIRC_invite`** (2026-09-03, LINEAR-5870) — the member-add primitive the toolkit never
13
- exposed. Wraps `channel-members-manage` `invite`: an agent/robot **you own** joins at once
14
- (`{ auto_joined: true }` — `channel_members` + linked `space_members` + `channel_keys` when a
15
- `wrapped_group_key` is passed; no code to redeem), a human or somebody else's agent gets an
16
- **invite code** to redeem in the app. Why P0: `mIRC_join` adds the KEY's identity (the human),
17
- while channel posts are signed by the AGENT — so every channel created from the toolkit was
18
- mute (`agent_not_in_channel`) until its agent was added from the app's member drawer.
19
- - **`mIRC_create` `invite_agents?: string[]`** — fan-out to `mIRC_invite` right after creation;
20
- per-agent failures are reported in `invites[]`, the channel is never rolled back.
21
-
22
- Tool count **84 → 85** (mIRC **24 → 25**); `TOOL_COUNT` (`= allTools.length`) stays the truth.
14
+ - **`mDM_send_as_agent` `thread_label?`** (LINEAR-6577) — same optional label alphabet as
15
+ `mDM_send` (`[a-zA-Z0-9._-]`, 1–120). Omit = MAIN unlabeled thread (ops lock for SOVEREIGN/King
16
+ until rename/UI merge). A new label opens a new `dm:A:B:label` thread.
17
+
18
+ ## [3.0.0-alpha.55] — 2026-09-29
19
+
20
+ ### Fixed
21
+ - **Channel/room reader: the King's posts read as text, not `<ciphertext>`** (ZERO SZYFROWANIA,
22
+ rozkaz Krola 28.09). `mIRC_list_messages` and `mROOM_list_messages` understood only a JSON
23
+ `mosadd.chat.v1` envelope and stamped everything else `<ciphertext>` — including every post
24
+ the app writes (plain UTF-8 in base64, `ircApi.ts encodePayload`) on the OPEN, keyless #adm and
25
+ #command (measured 28–29.09: f159c8d7, 776b3e9a). New shared decoder `tools/channel-payload.ts`
26
+ (same rule as `mdm.ts unpackPayload` and the mKEEPER bridge `decodePayload.mjs`): envelope →
27
+ its `text`; plain UTF-8 → the text; other JSON (voice `{audio, mime, dur}`) → raw, so
28
+ `formatVoiceIfAny` shapes it (mROOM now too). `<ciphertext>` stays ONLY for a sealed envelope
29
+ the line cannot open — group-key `{iv, ciphertext, hmac}` without the key, `mosadd.e2ee.*` —
30
+ and for bytes that are not UTF-8 text.
31
+ - **`mDM_send`: conversations with fleet lines and with the King always in the clear.** Besides
32
+ an agent line on either side (alpha.54), a note to SELF (`to === selfId`) now goes plain too
33
+ (MCP sessions on the King's key sealed his own thread; `message-send` refuses envelopes there
34
+ with `fleet_plaintext_only`). The result carries `reason: "fleet_plaintext"` (plain) or
35
+ `"human_to_human"` (E2EE). Person↔person stays X3DH + Double Ratchet, unchanged.
36
+ - **Tool descriptions:** `mDM_send_unencrypted` is no longer "DEPRECATED / prefer mDM_send / will
37
+ be removed" — that text steered every LLM line to the sealing tool. Both DM send tools now say:
38
+ conversations with fleet lines and with the King are ALWAYS in the clear.
39
+ - Lock `src/__tests__/flota-jawnie.test.ts` (13 tests): red on alpha.54 (7/13, the King's text →
40
+ `<ciphertext>`), red under five sabotages of the new rules, green after.
23
41
 
24
42
  ## [3.0.0-alpha.54] — 2026-09-27
25
43
 
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 m.0S / mosADD contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @mosadd/mcp
2
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.
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 messages), 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
- 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.
5
+ One key, one server, 85 tools — MCP-native, no SDK to wire up. **What is encrypted, plainly:** mDM between two *people* in the mosADD app is end-to-end encrypted (Signal X3DH + Double Ratchet, keys on the device). Since 3.0.0-alpha.54, when an agent line is on either side of an mDM — and every agent hub key and every m.0S key speaks as an agent line — `mDM_send` sends plain text over TLS and the service can read it. Channels, mURL rooms, mail and voice are server-readable too. The full posture: [docs/security/e2ee-posture.md](https://github.com/Hei33enberg/mosADD-OS/blob/main/docs/security/e2ee-posture.md).
6
6
 
7
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
8
 
@@ -15,7 +15,7 @@ Three ways to authenticate, friendliest first — all three end with the same 85
15
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
16
 
17
17
  ```bash
18
- npx -y @mosadd/mcp@alpha login
18
+ npx -y @mosadd/mcp@3.0.0-alpha.56 login
19
19
  # prompts for your Supabase URL + anon key (both public) and your mosADD email + password
20
20
  ```
21
21
 
@@ -23,19 +23,19 @@ Then register the server with **no env block**:
23
23
 
24
24
  ```bash
25
25
  # Claude Code
26
- claude mcp add mosadd -- npx -y @mosadd/mcp@alpha
26
+ claude mcp add mosadd -- npx -y @mosadd/mcp@3.0.0-alpha.56
27
27
  ```
28
28
 
29
29
  ```json
30
30
  // Claude Desktop / Cursor / Cline / Windsurf — mcpServers config, no env needed
31
31
  {
32
32
  "mcpServers": {
33
- "mosadd": { "command": "npx", "args": ["-y", "@mosadd/mcp@alpha"] }
33
+ "mosadd": { "command": "npx", "args": ["-y", "@mosadd/mcp@3.0.0-alpha.56"] }
34
34
  }
35
35
  }
36
36
  ```
37
37
 
38
- `npx @mosadd/mcp@alpha whoami` shows who you're signed in as; `… logout` clears it.
38
+ `npx @mosadd/mcp@3.0.0-alpha.56 whoami` shows who you're signed in as; `… logout` clears it.
39
39
 
40
40
  ### 2. `MOSADD_API_KEY` — headless / CI (one long-lived key)
41
41
 
@@ -46,7 +46,7 @@ A `mosadd_sk_live_…` hub key does not expire; the server exchanges it for a fr
46
46
  "mcpServers": {
47
47
  "mosadd": {
48
48
  "command": "npx",
49
- "args": ["-y", "@mosadd/mcp@alpha"],
49
+ "args": ["-y", "@mosadd/mcp@3.0.0-alpha.56"],
50
50
  "env": { "MOSADD_API_KEY": "mosadd_sk_live_…" }
51
51
  }
52
52
  }
@@ -71,7 +71,7 @@ In Phase 2 the hosted gateway at `mcp.mosadd.com` removes even this — add a UR
71
71
 
72
72
  | Module | Tools | What it does |
73
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 |
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. Between two people `mDM_send` encrypts end-to-end (X3DH / Double Ratchet, `mosadd.e2ee.v2`); with an agent line on either side (alpha.54 and later) it sends plain text the service can read |
75
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
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
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) |
@@ -134,7 +134,7 @@ For PTT / CALL (real-time media), the architecture separates **control plane** (
134
134
  | `MOSADD_LIVEKIT_API_SECRET` | LiveKit API secret | no |
135
135
  | `MOSADD_API_KEY` | Hub API key (Phase 2 hosted mode) | no |
136
136
  | `MOSADD_HUB_URL` | Override hub url | no |
137
- | `MOSADD_MODE` | `local` / `cloud` / `self-host` | no (auto-detected) |
137
+ | `MOSADD_MODE` | `local` / `cloud` (the code accepts one more legacy value; there is no self-hosted service) | no (auto-detected) |
138
138
  | `MOSADD_LOG_LEVEL` | `debug` / `info` / `warn` / `error` | no (default `info`) |
139
139
 
140
140
  Missing optional keys fail closed — that channel is simply absent from `comms_capabilities`.
@@ -143,8 +143,9 @@ Missing optional keys fail closed — that channel is simply absent from `comms_
143
143
 
144
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
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)
146
+ - **Source** — [github.com/Hei33enberg/mosADD-OS](https://github.com/Hei33enberg/mosADD-OS) (MIT)
147
+ - **m.0S endpoint** — `https://mcp.mosadd.dev/mcp` with a key from [app.mosadd.dev](https://app.mosadd.dev); see the [repo README](https://github.com/Hei33enberg/mosADD-OS#start-in-5-minutes)
147
148
 
148
149
  ## License
149
150
 
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).
151
+ MIT from 2026-09-29 (earlier releases: 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-T3KDVUAT.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 agent-line plaintext (owner decisions 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
  },
@@ -1161,21 +1165,25 @@ var mdmTools = [
1161
1165
  import { z as z2 } from "zod";
1162
1166
  var mDM_send_as_agent_input = z2.object({
1163
1167
  agent: z2.string().min(1).max(200).describe(
1164
- "Which of YOUR agents to speak as \u2014 its mosADD address (dispatcher@mosadd.com), its identity id, or its display name. Must be an agent you own."
1168
+ "Which of YOUR agents to speak as \u2014 its mosADD address (<agent>@mosadd.com), its identity id, or its display name. Must be an agent you own."
1165
1169
  ),
1166
1170
  text: z2.string().min(1).max(8e3).describe("The message body, as the agent would write it."),
1167
1171
  to: z2.string().max(200).optional().describe(
1168
1172
  "Recipient identity id or mosADD address. Defaults to YOU (the key's owner) \u2014 the common case is an agent reporting to its owner. Must be a person, not another agent."
1169
1173
  ),
1174
+ thread_label: z2.string().min(1).max(120).regex(/^[a-zA-Z0-9._-]+$/).optional().describe(
1175
+ "Optional thread label (same as mDM_send). Omit for the MAIN unlabeled thread \u2014 required for SOVEREIGN/King traffic until rename/UI merge (LINEAR-6577). A new label opens a new thread."
1176
+ ),
1170
1177
  silent: z2.boolean().optional().describe("Deliver without waking a phone: the message still arrives and shows unread, only the OS push is skipped.")
1171
1178
  });
1172
1179
  var mDM_list_my_agents_input = z2.object({});
1173
1180
  async function mDM_send_as_agent(input, ctx) {
1174
- ctx.log("debug", "mDM_send_as_agent", { agent: input.agent });
1181
+ ctx.log("debug", "mDM_send_as_agent", { agent: input.agent, thread_label: input.thread_label });
1175
1182
  return await invokeFunction("mdm-send-as-agent", {
1176
1183
  agent: input.agent,
1177
1184
  text: input.text,
1178
1185
  ...input.to ? { to: input.to } : {},
1186
+ ...input.thread_label ? { thread_label: input.thread_label } : {},
1179
1187
  ...input.silent ? { silent: true } : {}
1180
1188
  });
1181
1189
  }
@@ -1189,7 +1197,7 @@ var mdmAsAgentTools = [
1189
1197
  title: "Send DM as your agent",
1190
1198
  annotations: { readOnlyHint: false },
1191
1199
  requires: "network",
1192
- description: "Send a direct message AS ONE OF YOUR OWN AGENTS instead of as yourself. Use this when you are an agent runtime (Dispatch, Hermes, a CTO agent) connected with your owner's key: without it every message you send appears to come FROM the owner, so the owner has no thread with you. Names the agent by mosADD address, identity id or display name; `to` defaults to the key's owner. The server verifies you OWN that agent \u2014 speaking as someone else's agent, or as another person, is refused. Recipient must be a person: agent-to-agent DM stays blocked.",
1200
+ description: "Send a direct message AS ONE OF YOUR OWN AGENTS instead of as yourself. Use this when you are an agent runtime (Dispatch, Hermes, a CTO agent) connected with your owner's key: without it every message you send appears to come FROM the owner, so the owner has no thread with you. Names the agent by mosADD address, identity id or display name; `to` defaults to the key's owner. Optional `thread_label` selects a named thread (omit = MAIN unlabeled \u2014 required for King/SOVEREIGN until rename lands). The server verifies you OWN that agent \u2014 speaking as someone else's agent, or as another person, is refused. Recipient must be a person: agent-to-agent DM stays blocked.",
1193
1201
  inputSchema: mDM_send_as_agent_input,
1194
1202
  handler: mDM_send_as_agent
1195
1203
  },
@@ -1890,6 +1898,44 @@ async function decryptChannelPayload(channelId, payloadB64) {
1890
1898
  return decryptWithGroupKey(groupKey, payloadB64);
1891
1899
  }
1892
1900
 
1901
+ // src/tools/channel-payload.ts
1902
+ var CIPHERTEXT_MARKER = "<ciphertext>";
1903
+ var STRICT_BASE64 = /^[A-Za-z0-9+/]*={0,2}$/;
1904
+ var CONTROL_CHARS = /[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/;
1905
+ function isSealedEnvelope(obj) {
1906
+ if (!obj || typeof obj !== "object") return false;
1907
+ const o = obj;
1908
+ if (typeof o.iv === "string" && typeof o.ciphertext === "string") return true;
1909
+ if (typeof o.v === "string" && o.v.startsWith("mosadd.e2ee")) return true;
1910
+ return false;
1911
+ }
1912
+ function decodeStoredPayloadText(payload) {
1913
+ if (typeof payload !== "string" || payload.length === 0) return "";
1914
+ let raw;
1915
+ const compact = payload.replace(/\s+/g, "");
1916
+ if (compact.length % 4 === 0 && STRICT_BASE64.test(compact)) {
1917
+ try {
1918
+ raw = new TextDecoder("utf-8", { fatal: true }).decode(Buffer.from(compact, "base64"));
1919
+ } catch {
1920
+ return CIPHERTEXT_MARKER;
1921
+ }
1922
+ } else {
1923
+ raw = payload;
1924
+ }
1925
+ if (raw.startsWith("{")) {
1926
+ try {
1927
+ const obj = JSON.parse(raw);
1928
+ if (isSealedEnvelope(obj)) return CIPHERTEXT_MARKER;
1929
+ const text = obj?.text;
1930
+ if (typeof text === "string") return text;
1931
+ return raw;
1932
+ } catch {
1933
+ }
1934
+ }
1935
+ if (CONTROL_CHARS.test(raw)) return CIPHERTEXT_MARKER;
1936
+ return raw;
1937
+ }
1938
+
1893
1939
  // src/tools/mirc-messages.ts
1894
1940
  var PROTOCOL_VERSION4 = "mosadd.chat.v1";
1895
1941
  var ChannelId3 = z6.string().min(1).max(120).describe("Channel id (UUID). From mIRC_create / mIRC_list.");
@@ -1899,7 +1945,7 @@ var mIRC_post_message_input = z6.object({
1899
1945
  reply_to_id: z6.string().optional().describe("Optional id of the message being replied to."),
1900
1946
  space_id: z6.string().optional().describe("Optional backing space id. Resolved automatically from the channel if omitted."),
1901
1947
  agent: z6.string().max(200).optional().describe(
1902
- "Post AS ONE OF YOUR OWN AGENTS instead of as the key's owner \u2014 its mosADD address (marocain@mosadd.com), its identity id, or its display name. An API key is bound to a USER, so without this every message from an agent runtime is attributed to the owner: a whole fleet reporting in one channel shows up as one person. Same field name and same ownership rule as mDM_send_as_agent. The server verifies you OWN that agent and that it is an active member of the channel; naming an agent you do not own is refused, never silently downgraded to you. Omit it and attribution is unchanged."
1948
+ "Post AS ONE OF YOUR OWN AGENTS instead of as the key's owner \u2014 its mosADD address (<agent>@mosadd.com), its identity id, or its display name. An API key is bound to a USER, so without this every message from an agent runtime is attributed to the owner: a whole fleet reporting in one channel shows up as one person. Same field name and same ownership rule as mDM_send_as_agent. The server verifies you OWN that agent and that it is an active member of the channel; naming an agent you do not own is refused, never silently downgraded to you. Omit it and attribution is unchanged."
1903
1949
  )
1904
1950
  });
1905
1951
  var mIRC_list_messages_input = z6.object({
@@ -1918,18 +1964,10 @@ function buildPlaintextEnvelope(text, replyToId) {
1918
1964
  };
1919
1965
  return JSON.stringify(envelope);
1920
1966
  }
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
1967
  async function payloadToText(channelId, payload) {
1930
1968
  const decrypted = await decryptChannelPayload(channelId, payload);
1931
1969
  if (decrypted !== null) return unwrapEnvelopeText(decrypted);
1932
- return unpackPayload2(payload).text;
1970
+ return decodeStoredPayloadText(payload);
1933
1971
  }
1934
1972
  async function resolveLinkedSpaceId(channelId) {
1935
1973
  const data = await invokeFunction("channel-manage", { action: "get", channel_id: channelId });
@@ -2011,7 +2049,7 @@ var mircMessagesTools = [
2011
2049
  title: "Read channel messages",
2012
2050
  annotations: { readOnlyHint: true },
2013
2051
  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.",
2052
+ 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
2053
  inputSchema: mIRC_list_messages_input,
2016
2054
  handler: mIRC_list_messages
2017
2055
  }
@@ -3333,7 +3371,7 @@ var comms_session_attach_input = z17.object({
3333
3371
  "Short name for THIS session, shown to the owner as who is holding the line (e.g. 'CTO \u2014 Claude Code', 'dispatcher \u2014 Cowork'). Defaults to the machine name."
3334
3372
  ),
3335
3373
  as_agent: z17.string().max(200).optional().describe(
3336
- "Speak as ONE OF THE OWNER'S AGENT LINES while holding the owner's key \u2014 its mosADD address (dispatcher@mosadd.com), identity id, or display name. Declares ONCE per session whose line this session speaks for: the gateway then signs your CHANNEL posts as that agent automatically (no per-post `agent` field needed), and that agent's cloud stand-in defers to you. The server verifies you OWN the agent; a stranger's agent is refused. Omit to claim the key's own line, exactly as before."
3374
+ "Speak as ONE OF THE OWNER'S AGENT LINES while holding the owner's key \u2014 its mosADD address (<agent>@mosadd.com), identity id, or display name. Declares ONCE per session whose line this session speaks for: the gateway then signs your CHANNEL posts as that agent automatically (no per-post `agent` field needed), and that agent's cloud stand-in defers to you. The server verifies you OWN the agent; a stranger's agent is refused. Omit to claim the key's own line, exactly as before."
3337
3375
  ),
3338
3376
  release: z17.boolean().optional().describe(
3339
3377
  "Hand the line back immediately instead of claiming it: stops this session's keep-alive, clears the liveness row (and any as_agent declaration this session made), so the 24/7 cloud stand-in resumes answering at once rather than after the hold expires. Call this when the session is finishing."
@@ -3428,7 +3466,7 @@ var presenceTools = [
3428
3466
  title: "Attach session to a line",
3429
3467
  annotations: { destructiveHint: false, idempotentHint: true },
3430
3468
  requires: "network",
3431
- description: "Claim a mosADD reply lane for the CURRENT agent session, so the 24/7 cloud stand-in stops answering in its place and the owner talks to you instead. Call it once at the start of a session; the hold renews itself while the session runs and lapses on its own if the session dies. Holding the OWNER's key while working as one of their agent lines? Pass as_agent:'<address of YOUR line>' (e.g. dispatcher@mosadd.com) \u2014 the gateway then signs your channel posts as that agent automatically for the whole session and silences that agent's stand-in; ownership is verified server-side. Pass release:true when finishing to hand everything back immediately. Owner-scoped: a session can only claim the account whose key it holds, or a line of an agent that account owns.",
3469
+ description: "Claim a mosADD reply lane for the CURRENT agent session, so the 24/7 cloud stand-in stops answering in its place and the owner talks to you instead. Call it once at the start of a session; the hold renews itself while the session runs and lapses on its own if the session dies. Holding the OWNER's key while working as one of their agent lines? Pass as_agent:'<address of YOUR line>' (e.g. <agent>@mosadd.com) \u2014 the gateway then signs your channel posts as that agent automatically for the whole session and silences that agent's stand-in; ownership is verified server-side. Pass release:true when finishing to hand everything back immediately. Owner-scoped: a session can only claim the account whose key it holds, or a line of an agent that account owns.",
3432
3470
  inputSchema: comms_session_attach_input,
3433
3471
  handler: comms_session_attach
3434
3472
  }
@@ -3926,7 +3964,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3926
3964
  // package.json
3927
3965
  var package_default = {
3928
3966
  name: "@mosadd/mcp",
3929
- version: "3.0.0-alpha.54",
3967
+ version: "3.0.0-alpha.56",
3930
3968
  mcpName: "io.github.hei33enberg/mosadd-mcp",
3931
3969
  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
3970
  homepage: "https://github.com/Hei33enberg/mosADD-OS/tree/main/packages/mcp",
@@ -3935,7 +3973,7 @@ var package_default = {
3935
3973
  url: "https://github.com/Hei33enberg/mosADD-OS.git",
3936
3974
  directory: "packages/mcp"
3937
3975
  },
3938
- license: "Apache-2.0",
3976
+ license: "MIT",
3939
3977
  type: "module",
3940
3978
  main: "./dist/index.js",
3941
3979
  module: "./dist/index.js",
@@ -4098,7 +4136,7 @@ function createMosaddServer(options = {}) {
4098
4136
  // Human-facing identity of the server itself (initialize result). The icon URLs
4099
4137
  // point at the LIVE gateway origin on purpose: clients that honour serverInfo.icons
4100
4138
  // get the brand mark without scraping the favicon, and the files ship with
4101
- // apps/mcp-http/public (canon 08-26 — generated by m0ssad-3 scripts/
4139
+ // the gateway's public/ folder (canon 08-26 — generated by m0ssad-3 scripts/
4102
4140
  // generate-brand-icons.py, never hand-edited).
4103
4141
  title: "mosADD \u2014 omnichannel messenger for agents",
4104
4142
  websiteUrl: "https://mosadd.com",
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-T3KDVUAT.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.56",
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",
@@ -9,7 +9,7 @@
9
9
  "url": "https://github.com/Hei33enberg/mosADD-OS.git",
10
10
  "directory": "packages/mcp"
11
11
  },
12
- "license": "Apache-2.0",
12
+ "license": "MIT",
13
13
  "type": "module",
14
14
  "main": "./dist/index.js",
15
15
  "module": "./dist/index.js",
@@ -34,13 +34,6 @@
34
34
  "publishConfig": {
35
35
  "access": "public"
36
36
  },
37
- "scripts": {
38
- "build": "tsup src/index.ts src/bin/mcp.ts src/bin/login.ts --format esm --dts --clean --shims",
39
- "dev": "tsx src/bin/mcp.ts",
40
- "test": "vitest run",
41
- "typecheck": "tsc -p tsconfig.json --noEmit",
42
- "clean": "rm -rf dist .turbo"
43
- },
44
37
  "dependencies": {
45
38
  "@modelcontextprotocol/sdk": "^1.0.4",
46
39
  "@supabase/supabase-js": "^2.48.0",
@@ -69,5 +62,12 @@
69
62
  ],
70
63
  "engines": {
71
64
  "node": ">=18"
65
+ },
66
+ "scripts": {
67
+ "build": "tsup src/index.ts src/bin/mcp.ts src/bin/login.ts --format esm --dts --clean --shims",
68
+ "dev": "tsx src/bin/mcp.ts",
69
+ "test": "vitest run",
70
+ "typecheck": "tsc -p tsconfig.json --noEmit",
71
+ "clean": "rm -rf dist .turbo"
72
72
  }
73
- }
73
+ }