@mosadd/mcp 3.0.0 → 3.0.2

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 (40) hide show
  1. package/CHANGELOG.md +420 -410
  2. package/LICENSE +21 -0
  3. package/dist/bin/mcp.js +1 -1
  4. package/dist/{chunk-VMMJJYXF.js → chunk-I3FSPQ4G.js} +78 -30
  5. package/dist/index.d.ts +6 -6
  6. package/dist/index.js +1 -1
  7. package/package.json +1 -1
  8. package/src/__tests__/blob-upload.test.ts +1 -1
  9. package/src/__tests__/{flota-jawnie.test.ts → fleet-plaintext.test.ts} +59 -60
  10. package/src/__tests__/integration.test.ts +1 -1
  11. package/src/__tests__/mdm-e2ee.test.ts +3 -3
  12. package/src/__tests__/mdm-mcp-readable.test.ts +95 -95
  13. package/src/__tests__/mirc-files.test.ts +80 -0
  14. package/src/__tests__/mirc-invite.test.ts +1 -1
  15. package/src/__tests__/mirc-voice.test.ts +82 -0
  16. package/src/__tests__/mrag-search-diagnostics.test.ts +78 -0
  17. package/src/__tests__/presence.test.ts +2 -2
  18. package/src/__tests__/server.test.ts +3 -3
  19. package/src/__tests__/tool-count-consistency.test.ts +4 -4
  20. package/src/crypto/channel-e2ee.ts +1 -1
  21. package/src/crypto/mdm-session.ts +14 -14
  22. package/src/providers/supabase-dm.ts +6 -1
  23. package/src/providers/supabase.ts +8 -8
  24. package/src/server.ts +4 -4
  25. package/src/tools/channel-payload.ts +3 -3
  26. package/src/tools/index.ts +13 -13
  27. package/src/tools/knowledge.ts +384 -351
  28. package/src/tools/mail-aliases.ts +1 -1
  29. package/src/tools/mail-provenance.ts +1 -1
  30. package/src/tools/mdm-as-agent.ts +3 -4
  31. package/src/tools/mdm.ts +19 -14
  32. package/src/tools/mirc-edge.ts +4 -4
  33. package/src/tools/mirc-members.ts +1 -1
  34. package/src/tools/mirc-messages.ts +41 -12
  35. package/src/tools/mirc.ts +1 -1
  36. package/src/tools/mroom-messages.ts +1 -1
  37. package/src/tools/presence.ts +10 -10
  38. package/src/tools/ptt-ingest.ts +1 -1
  39. package/src/tools/threat.ts +1 -1
  40. package/src/tools/voice-format.ts +53 -7
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/dist/bin/mcp.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  PKG_VERSION,
4
4
  allTools,
5
5
  createMosaddServer
6
- } from "../chunk-VMMJJYXF.js";
6
+ } from "../chunk-I3FSPQ4G.js";
7
7
  import {
8
8
  isSessionExpired,
9
9
  loadSession,
@@ -58,18 +58,18 @@ function getSupabase(env = readSupabaseEnv()) {
58
58
  autoRefreshToken: false,
59
59
  detectSessionInUrl: false
60
60
  },
61
- // ⛔ x-mosadd-origin: KAŻDE wywołanie z toolkitu/bramy MCP niesie ten znacznik (2026-08-25,
62
- // rozkaz Króla „kradną tożsamości"). Sesje agentów wpinały klucz WŁAŚCICIELA i postowały na
63
- // kanałach z jego dymka (SOVEREIGN) — serwer nie miał JAK odróżnić bramy od aplikacji, bo
64
- // hub-key-exchange zwraca zwykły JWT usera. Ten nagłówek to rozróżnia: message-send odrzuca
65
- // post na kanał z tożsamości CZŁOWIEKA, gdy przyszedł przez bramę — z komunikatem każącym
66
- // wpiąć klucz SWOJEJ linii. Aplikacja mosadd.com nigdy nie wysyła tego nagłówka.
61
+ // ⛔ x-mosadd-origin: EVERY call from the toolkit / MCP gateway carries this marker (2026-08-25,
62
+ // after agent sessions were found speaking as their owner). Agent sessions plugged in the OWNER's
63
+ // key and posted on channels from the owner's own bubble — the server had NO WAY to tell the gateway
64
+ // from the app, because hub-key-exchange returns an ordinary user JWT. This header tells them apart:
65
+ // message-send refuses a channel post from a PERSON's identity when it came through the gateway, with
66
+ // a message telling the caller to plug in its OWN line's key. The mosadd.com app never sends this header.
67
67
  global: {
68
68
  headers: {
69
69
  ...env.userJwt ? { Authorization: `Bearer ${env.userJwt}` } : {},
70
70
  "x-mosadd-origin": "hub-gateway",
71
- // Nagłówek tylko, gdy sesja MA tożsamość — puste "" (brama bez sessionKey) nie wysyła nic,
72
- // więc serwerowy strażnik 409 nie widzi fałszywych roszczeń.
71
+ // The header only when the session HAS an identity — an empty "" (gateway without sessionKey) sends
72
+ // nothing, so the server-side 409 guard sees no false claims.
73
73
  ...sessionId() ? { "x-mosadd-session": sessionId() } : {}
74
74
  // ⛔ KTÓRA TO SESJA (2026-08-27, „każdy generał co chwilę gubi mózg"). Wszyscy generałowie
75
75
  // wpinają się kluczem hub TEGO SAMEGO właściciela, więc dla serwera ich wywołania były
@@ -148,6 +148,30 @@ function voiceFields(m) {
148
148
  if (m.messageType !== "voice" && m.messageType !== "ptt") return {};
149
149
  return { voice: { transcript: m.transcript ?? null, audio_url: m.audioUrl ?? null, duration_ms: m.durationMs ?? null } };
150
150
  }
151
+ var VOICE_MARKER = /^\[voice note — \d+s\]$/;
152
+ function voiceText(text, voice) {
153
+ if (!voice) return text;
154
+ const marker = VOICE_MARKER.test(text) ? text : typeof voice.duration_ms === "number" && voice.duration_ms > 0 ? `[voice note \u2014 ${Math.max(1, Math.round(voice.duration_ms / 1e3))}s]` : "[voice note]";
155
+ const t = typeof voice.transcript === "string" ? voice.transcript.trim() : "";
156
+ return t ? `${marker} ${t}` : marker;
157
+ }
158
+ function attachmentsFrom(raw) {
159
+ if (!Array.isArray(raw)) return void 0;
160
+ const out = [];
161
+ for (const f of raw.slice(0, 20)) {
162
+ if (!f || typeof f !== "object") continue;
163
+ const r = f;
164
+ const url = typeof r.url === "string" && /^https:\/\//.test(r.url) ? r.url : null;
165
+ out.push({
166
+ name: typeof r.name === "string" && r.name ? r.name : "file",
167
+ mime: typeof r.mime === "string" && r.mime ? r.mime : "application/octet-stream",
168
+ size: typeof r.size === "number" && Number.isFinite(r.size) ? r.size : null,
169
+ url,
170
+ ...r.encrypted === true ? { encrypted: true } : {}
171
+ });
172
+ }
173
+ return out.length ? out : void 0;
174
+ }
151
175
 
152
176
  // src/crypto/mdm-session.ts
153
177
  import {
@@ -626,7 +650,7 @@ async function decryptFromPeer(keystore, peerId, envelopeBytes) {
626
650
  const step = await ratchetReceive(session.ratchet);
627
651
  if (step.messageIndex !== env.i) {
628
652
  throw new Error(
629
- `Out-of-order mDM message (expected ratchet index ${step.messageIndex}, got ${env.i}). Skipped-key handling is a tracked follow-up (LINEAR-2357).`
653
+ `Out-of-order mDM message (expected ratchet index ${step.messageIndex}, got ${env.i}). Skipped-key handling is a tracked follow-up.`
630
654
  );
631
655
  }
632
656
  const plaintext = await decryptBytes(step.messageKey, env.ct);
@@ -654,7 +678,7 @@ var SupabaseDmProvider = class {
654
678
  * `identities.kind` of a PEER, or null when it cannot be read (RLS can_see_identity scopes rows
655
679
  * to contacts / thread co-members; a miss is not an error). mDM_send uses it exactly like the
656
680
  * app's ChatPanel `peerIsAgent` (theirIdent.kind === 'agent' || iAmAgent): a DM to an agent
657
- * line is sent in the clear, because the line must read it (rozkaz Króla 20.09).
681
+ * line is sent in the clear, because the line must read it (owner decision 20.09).
658
682
  */
659
683
  async peerKind(peerId) {
660
684
  try {
@@ -737,7 +761,8 @@ var SupabaseDmProvider = class {
737
761
  recipientSelfPayload: m.recipient_self_payload ?? null,
738
762
  transcript: m.transcript ?? null,
739
763
  audioUrl: m.audio_url ?? null,
740
- durationMs: m.duration_ms ?? null
764
+ durationMs: m.duration_ms ?? null,
765
+ files: attachmentsFrom(m.files)
741
766
  })),
742
767
  // history mode (`before`) returns `next_before`; incremental (`since`) returns `cursor`+`has_more`.
743
768
  nextCursor: data?.next_before ?? (data?.has_more ? data?.cursor ?? null : null)
@@ -971,7 +996,7 @@ async function mDM_list(input, ctx) {
971
996
  }
972
997
  return p;
973
998
  };
974
- const messages = await Promise.all(
999
+ const surowe = await Promise.all(
975
1000
  result.messages.map(async (raw) => {
976
1001
  const m = raw;
977
1002
  const base = {
@@ -979,7 +1004,9 @@ async function mDM_list(input, ctx) {
979
1004
  sender_identity_id: m.senderId,
980
1005
  timestamp: m.timestamp,
981
1006
  thread_id: m.threadId,
982
- ...voiceFields(m)
1007
+ ...voiceFields(m),
1008
+ // 30.11: pliki (zrzut, dokument) z podpisanym adresem ~1 h — prawa czytającego (strona rozmowy)
1009
+ ...m.files?.length ? { attachments: m.files } : {}
983
1010
  };
984
1011
  if (!isE2eeEnvelope(m.payload)) {
985
1012
  return { ...base, text: formatVoiceIfAny(unpackPayload(m.payload).text), encrypted: false };
@@ -1014,6 +1041,7 @@ async function mDM_list(input, ctx) {
1014
1041
  }
1015
1042
  })
1016
1043
  );
1044
+ const messages = surowe.map((m) => m.voice ? { ...m, text: voiceText(m.text, m.voice) } : m);
1017
1045
  return {
1018
1046
  messages,
1019
1047
  next_cursor: result.nextCursor,
@@ -1118,7 +1146,7 @@ var mdmTools = [
1118
1146
  title: "Send DM",
1119
1147
  annotations: { readOnlyHint: false },
1120
1148
  requires: "any",
1121
- 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.',
1149
+ description: 'Send a direct message via mosadd mDM. Conversations with agent lines and with the account owner: 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.',
1122
1150
  inputSchema: mDM_send_input,
1123
1151
  handler: mDM_send
1124
1152
  },
@@ -1127,7 +1155,7 @@ var mdmTools = [
1127
1155
  title: "Send plain-text DM",
1128
1156
  annotations: { readOnlyHint: false },
1129
1157
  requires: "any",
1130
- 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.",
1158
+ description: "Send a direct message as plain text, never encrypted. Conversations with agent lines and with the account owner: ALWAYS in the clear \u2014 this is the path for every agent line writing to the account owner, 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.",
1131
1159
  inputSchema: mDM_send_input,
1132
1160
  handler: mDM_send_unencrypted
1133
1161
  },
@@ -1136,7 +1164,7 @@ var mdmTools = [
1136
1164
  title: "Read direct messages",
1137
1165
  annotations: { readOnlyHint: true },
1138
1166
  requires: "any",
1139
- description: "List recent direct messages with a specific contact. Pass contact_id as the identity_id from mDM_list_contacts. Decrypts end-to-end-encrypted messages from the contact automatically; legacy plaintext messages are shown as-is. Optionally filter to a single thread_label.",
1167
+ description: 'List recent direct messages with a specific contact. Pass contact_id as the identity_id from mDM_list_contacts. Decrypts end-to-end-encrypted messages from the contact automatically; legacy plaintext messages are shown as-is. Optionally filter to a single thread_label. FILES: a screenshot or document in the conversation comes back in `attachments: [{name, mime, size, url}]` \u2014 `url` is a signed link valid for about an hour, fetch it to see the file; an encrypted file has `encrypted: true` and no url. VOICE: a voice message has `voice: {transcript, audio_url, duration_ms}` and `text` reads "[voice note \u2014 25s] <transcript>".',
1140
1168
  inputSchema: mDM_list_input,
1141
1169
  handler: mDM_list
1142
1170
  },
@@ -1180,7 +1208,7 @@ var mDM_send_as_agent_input = z2.object({
1180
1208
  "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."
1181
1209
  ),
1182
1210
  thread_label: z2.string().min(1).max(120).regex(/^[a-zA-Z0-9._-]+$/).optional().describe(
1183
- "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."
1211
+ "Optional thread label (same as mDM_send). Omit for the MAIN unlabeled thread \u2014 required for account-owner traffic. A new label opens a new thread."
1184
1212
  ),
1185
1213
  silent: z2.boolean().optional().describe("Deliver without waking a phone: the message still arrives and shows unread, only the OS push is skipped.")
1186
1214
  });
@@ -1205,7 +1233,7 @@ var mdmAsAgentTools = [
1205
1233
  title: "Send DM as your agent",
1206
1234
  annotations: { readOnlyHint: false },
1207
1235
  requires: "network",
1208
- 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.",
1236
+ 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 the account owner 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.",
1209
1237
  inputSchema: mDM_send_as_agent_input,
1210
1238
  handler: mDM_send_as_agent
1211
1239
  },
@@ -2030,11 +2058,21 @@ async function mIRC_list_messages(input, ctx) {
2030
2058
  });
2031
2059
  const messages = [];
2032
2060
  for (const m of data?.messages ?? []) {
2061
+ const glos = voiceFields({
2062
+ messageType: m.message_type ?? void 0,
2063
+ transcript: m.transcript ?? null,
2064
+ audioUrl: m.audio_url ?? null,
2065
+ durationMs: m.duration_ms ?? null
2066
+ });
2067
+ const pliki = attachmentsFrom(m.files);
2033
2068
  messages.push({
2034
2069
  id: m.id,
2035
2070
  sender_identity_id: m.sender_identity_id,
2036
- text: formatVoiceIfAny(await payloadToText(input.channel_id, m.encrypted_payload)),
2037
- timestamp: m.created_at
2071
+ text: voiceText(formatVoiceIfAny(await payloadToText(input.channel_id, m.encrypted_payload)), glos.voice),
2072
+ timestamp: m.created_at,
2073
+ ...glos,
2074
+ // 30.11: zrzut / plik przy wiadomości — podpisany adres ~1 h z message-list, prawa czytającego (członek kanału)
2075
+ ...pliki ? { attachments: pliki } : {}
2038
2076
  });
2039
2077
  }
2040
2078
  return {
@@ -2057,7 +2095,7 @@ var mircMessagesTools = [
2057
2095
  title: "Read channel messages",
2058
2096
  annotations: { readOnlyHint: true },
2059
2097
  requires: "network",
2060
- 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>.",
2098
+ 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 coordination channels are never encrypted). Only a sealed group-key envelope your line holds no key for reads <ciphertext>. FILES: a screenshot or document sent with a message comes back in `attachments: [{name, mime, size, url}]` \u2014 `url` is a signed link valid for about an hour, fetch it to see the file; an encrypted file has `encrypted: true` and no url. VOICE: a voice message has `voice: {transcript, audio_url, duration_ms}` and `text` reads \"[voice note \u2014 25s] <transcript>\".",
2061
2099
  inputSchema: mIRC_list_messages_input,
2062
2100
  handler: mIRC_list_messages
2063
2101
  }
@@ -2156,7 +2194,7 @@ var mircEdgeTools = [
2156
2194
  title: "Mint channel token",
2157
2195
  annotations: { readOnlyHint: false },
2158
2196
  requires: "network",
2159
- description: "Exchange the hub key (MOSADD_API_KEY) for a short-lived (5min), channel-scoped JWT. Returns { token, expires_in, channel_id, scope }. The token is safe to hand to a browser to open a WS via `Sec-WebSocket-Protocol: mosadd.v1, bearer.<token>`. The hub key NEVER leaves the server. Use this from any server-side route (Next.js /api/chat-token, Express, etc.) before showing chat in a browser. Required by LINEAR-2675/E6 to avoid leaking the hub key into CDN access logs.",
2197
+ description: "Exchange the hub key (MOSADD_API_KEY) for a short-lived (5min), channel-scoped JWT. Returns { token, expires_in, channel_id, scope }. The token is safe to hand to a browser to open a WS via `Sec-WebSocket-Protocol: mosadd.v1, bearer.<token>`. The hub key NEVER leaves the server. Use this from any server-side route (Next.js /api/chat-token, Express, etc.) before showing chat in a browser. Required to avoid leaking the hub key into CDN access logs.",
2160
2198
  inputSchema: mIRC_mint_channel_token_input,
2161
2199
  handler: mIRC_mint_channel_token
2162
2200
  },
@@ -2971,6 +3009,15 @@ var mRAG_search_input = z14.object({
2971
3009
  "Set true to also get a generated answer (answer field) grounded in the returned sources. Default false: ranked sources only, answer is empty."
2972
3010
  )
2973
3011
  });
3012
+ var DIAGNOSTIC_KEYS = ["partial", "partial_reason", "search_mode", "degraded", "timing", "stages"];
3013
+ function ragDiagnostics(data) {
3014
+ const out = {};
3015
+ for (const key of DIAGNOSTIC_KEYS) {
3016
+ const value = data[key];
3017
+ if (value !== void 0 && value !== null) out[key] = value;
3018
+ }
3019
+ return out;
3020
+ }
2974
3021
  async function mRAG_search(input, ctx) {
2975
3022
  readSupabaseEnv();
2976
3023
  ctx.log("debug", "mRAG_search via rag-query", { top_k: input.top_k ?? 8 });
@@ -2984,7 +3031,8 @@ async function mRAG_search(input, ctx) {
2984
3031
  return {
2985
3032
  answer: data.answer ?? "",
2986
3033
  sources: data.sources ?? [],
2987
- chunks_found: data.chunks_found ?? (data.sources?.length ?? 0)
3034
+ chunks_found: data.chunks_found ?? (data.sources?.length ?? 0),
3035
+ ...ragDiagnostics(data)
2988
3036
  };
2989
3037
  }
2990
3038
  var PartyArg = z14.object({
@@ -3091,7 +3139,7 @@ var knowledgeTools = [
3091
3139
  title: "Search memory",
3092
3140
  annotations: { readOnlyHint: true },
3093
3141
  requires: "network",
3094
- description: "Search and answer questions over the USER'S OWN mosadd data (messages, emails, calls, notes) with a private per-user RAG index \u2014 hybrid vector + keyword retrieval, reranked, grounded in cited sources (no fabrication). Use it to recall 'what did X say about Y', summarize a thread, or pull facts the user has received. By DEFAULT (via MCP) it returns the ranked source snippets only and `answer` is an empty string (answer_mode retrieve_only): fast, no model call. Pass answer:true to also get a generated answer grounded in those sources (slower, uses the model budget). If the index search runs out of time the call still succeeds and carries partial:true with partial_reason, instead of failing. This is agent memory (mRAG = RAG over your own data) over the user's communications, available outside the mosadd app. NOTE: RAG requires content to be indexed server-side in plaintext, so anything searchable here is NOT covered b",
3142
+ description: "Search and answer questions over the USER'S OWN mosadd data (messages, emails, calls, notes) with a private per-user RAG index \u2014 hybrid vector + keyword retrieval, reranked, grounded in cited sources (no fabrication). Use it to recall 'what did X say about Y', summarize a thread, or pull facts the user has received. By DEFAULT (via MCP) it returns the ranked source snippets only (answer_mode retrieve_only): fast, no model call; `answer` is empty or a short status note starting with '[mRAG' that names the stages and their times. Pass answer:true to also get a generated answer grounded in those sources (slower, uses the model budget). If the vector stage runs out of time the call still succeeds: the sources come from a keyword fallback and the result carries partial:true, partial_reason and search_mode:'keyword' (never a silent empty list); `timing` and `stages` give the milliseconds of every stage. This is agent memory (mRAG = RAG over your own data) over the user's communications, available outside the mosadd app. NOTE: RAG requires content to be indexed server-side in plaintext, so anything searchable here is NOT covered b",
3095
3143
  inputSchema: mRAG_search_input,
3096
3144
  handler: mRAG_search
3097
3145
  },
@@ -3879,8 +3927,8 @@ var channelTools = [
3879
3927
  ...mircMembersTools,
3880
3928
  ...mircMessagesTools,
3881
3929
  ...mircEdgeTools,
3882
- // ...mroomTools, // mROOM: killed (LINEAR-3414) — channel re-cut into ephemeral private mIRC
3883
- // ...mroomMessagesTools, // mROOM: killed (LINEAR-3414)
3930
+ // ...mroomTools, // mROOM: killed — channel re-cut into ephemeral private mIRC
3931
+ // ...mroomMessagesTools, // mROOM: killed
3884
3932
  ...mailTools,
3885
3933
  // mAYL_*: canonical email module (was the mp0st codename; renamed re-arch 2026-06-27)
3886
3934
  // ...mailAliasTools, // mp0st_* aliases RETIRED 2026-07-15 — mAYL is the one name; the mp0st codename is now backend-internal only
@@ -3902,7 +3950,7 @@ var channelTools = [
3902
3950
  // mAYL_agentbox_provision/list/release/extend — the agent mints/lists/releases/extends its OWN
3903
3951
  // real, two-way, disposable inbox (agent-<hex>@mosadd.com). create_inbox parity with AgentMail,
3904
3952
  // on our own stack + provenance. Backs the live mayl-agentbox EF; receive path landed 2026-08-06
3905
- // in mp0st-inbound-webhook (LINEAR-5201). Same requireUser auth as every other mAYL tool.
3953
+ // in mp0st-inbound-webhook. Same requireUser auth as every other mAYL tool.
3906
3954
  ...mailAgentboxTools,
3907
3955
  ...mtalkTools,
3908
3956
  ...attachmentTools,
@@ -3952,7 +4000,7 @@ var channelTools = [
3952
4000
  ...embedTools,
3953
4001
  // comms_embed_create: RE-REGISTERED 2026-07-17 — embed.mosadd.com/v1.js live; mints an embed key + paste-in snippet (mURL→mIRC rework P3)
3954
4002
  ...threatTools,
3955
- // threat_catalog + threat_classify: RE-REGISTERED 2026-07-15 (founder directive + LINEAR-3498) — pure/offline, makes the Pegasus-class classification claim a live, callable capability
4003
+ // threat_catalog + threat_classify: RE-REGISTERED 2026-07-15 (founder directive) — pure/offline, makes the Pegasus-class classification claim a live, callable capability
3956
4004
  ...murlTools
3957
4005
  // mURL: revived as a full module (founder 2026-06-27) — read/post/presence/list_channels over live domain channels
3958
4006
  // ...mcallTools, // mCALL: carrier-pending (no telephony carrier live) — re-register when a carrier is configured
@@ -3973,7 +4021,7 @@ var TOOL_COUNT = allTools.length;
3973
4021
  // package.json
3974
4022
  var package_default = {
3975
4023
  name: "@mosadd/mcp",
3976
- version: "3.0.0",
4024
+ version: "3.0.2",
3977
4025
  mcpName: "io.github.hei33enberg/mosadd-mcp",
3978
4026
  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).",
3979
4027
  homepage: "https://github.com/Hei33enberg/mosADD-OS/tree/main/packages/mcp",
@@ -4152,7 +4200,7 @@ function createMosaddServer(options = {}) {
4152
4200
  // Human-facing identity of the server itself (initialize result). The icon URLs
4153
4201
  // point at the LIVE gateway origin on purpose: clients that honour serverInfo.icons
4154
4202
  // get the brand mark without scraping the favicon, and the files ship with
4155
- // the gateway's public/ folder (canon 08-26 — generated by m0ssad-3 scripts/
4203
+ // the gateway's public/ folder (brand rule of 2026-08-26 — generated by m0ssad-3 scripts/
4156
4204
  // generate-brand-icons.py, never hand-edited).
4157
4205
  title: "mosADD \u2014 omnichannel messenger for agents",
4158
4206
  websiteUrl: "https://mosadd.com",
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { DmProvider, VoiceProvider } from '@mosadd/providers';
4
4
  import { RatchetState, DhRatchetState, SessionRole } from '@mosadd/crypto';
5
5
 
6
6
  /**
7
- * mDM end-to-end encryption — session layer (LINEAR-2357).
7
+ * mDM end-to-end encryption — session layer.
8
8
  *
9
9
  * Sits ABOVE the DmProvider. The provider moves opaque bytes; THIS module
10
10
  * decides what those bytes are: an X3DH handshake + Double Ratchet ciphertext
@@ -18,7 +18,7 @@ import { RatchetState, DhRatchetState, SessionRole } from '@mosadd/crypto';
18
18
  * run X3DH (responder) and derive the SAME root key.
19
19
  * - Subsequent messages reuse the stored ratchet session (no header).
20
20
  *
21
- * SCOPE / known follow-ups (tracked on LINEAR-2357, NOT silently hidden):
21
+ * SCOPE / known follow-ups (tracked, NOT silently hidden):
22
22
  * - Ratchet is strict in-order (no skipped-message keys) — fine for a single
23
23
  * ordered thread; out-of-order/lossy transports need skipped-key handling.
24
24
  * - Signed-prekey signature is carried but NOT yet verified (auth follow-up).
@@ -236,14 +236,14 @@ declare function createMosaddServer(options?: MosaddServerOptions): McpServer;
236
236
  /**
237
237
  * Tool registry. Each m* module contributes a set of tools.
238
238
  *
239
- * User-facing modules (4): mDM, mIRC, mURL, mAYL — the re-arch (LINEAR-3938)
239
+ * User-facing modules (4): mDM, mIRC, mURL, mAYL — the re-arch
240
240
  * mAYL replaces the old mp0st name (mp0st_* still registered as back-compat
241
241
  * aliases via mail-aliases.ts; will be removed in a later alpha).
242
242
  *
243
243
  * Capabilities (not modules — cross-cutting agent tooling): mRAG, comms_.
244
244
  * mTALK = voice tier inside mIRC, still its own tools for now; folding into
245
245
  * mIRC_voice_* in a follow-up release. threat_* (threat_catalog + threat_classify)
246
- * are REGISTERED (2026-07-15, founder directive + LINEAR-3498): pure/offline
246
+ * are REGISTERED (2026-07-15, founder directive): pure/offline
247
247
  * defensive classification over the threat taxonomy — the surveillance-era
248
248
  * *marketing* was killed, the classification engine is real and wanted.
249
249
  *
@@ -253,7 +253,7 @@ declare function createMosaddServer(options?: MosaddServerOptions): McpServer;
253
253
  * when the alpha carrying mIRC_invite is published and the gateway redeployed):
254
254
  * modules mDM 16 · mIRC 25 · mURL 7 · mAYL 16 = 64; capabilities mTALK 6 · mRAG 8 ·
255
255
  * comms 5 (action_create/action_frame_get/embed_create/capabilities/session_attach) · Irondome/threat 2
256
- * = 21. 64 + 21 = 85. (mIRC 25 = 24 + mIRC_invite added 2026-09-03 (LINEAR-5870): mIRC_join adds the KEY's
256
+ * = 21. 64 + 21 = 85. (mIRC 25 = 24 + mIRC_invite added 2026-09-03: mIRC_join adds the KEY's
257
257
  * identity while channel posts are signed by the AGENT, so every channel created from the toolkit was mute
258
258
  * until its agent was added from the app — mIRC_invite wraps channel-members-manage `invite`: own agent →
259
259
  * auto_joined, anyone else → invite code. mDM 16 = 14 + mDM_send_as_agent/mDM_list_my_agents added 2026-08-17: an MCP key
@@ -273,7 +273,7 @@ declare function createMosaddServer(options?: MosaddServerOptions): McpServer;
273
273
  * mAYL_send_as_agent + mTALK_ingest_ptt were RE-REGISTERED 2026-07-29: both had been disabled
274
274
  * on 07-14 notes that had since become false, and both were re-verified on authenticated calls.
275
275
  * comms_embed_create RE-REGISTERED 2026-07-17 (embed.mosadd.com/v1.js live — P3 of mURL→mIRC).
276
- * mROOM was KILLED (LINEAR-3414, channel re-cut → ephemeral private mIRC): its tools
276
+ * mROOM was KILLED (channel re-cut → ephemeral private mIRC): its tools
277
277
  * live in tools/mroom.ts + mroom-messages.ts but are NOT registered here.
278
278
  * Plus action links: comms_action_create (agent → user one-link browser action,
279
279
  * incl. screen_share) + comms_action_frame_get (see the recipient's shared screen).
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  createMosaddServer,
5
5
  defaultProviders,
6
6
  runWithSupabaseEnv
7
- } from "./chunk-VMMJJYXF.js";
7
+ } from "./chunk-I3FSPQ4G.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",
3
+ "version": "3.0.2",
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",
@@ -7,7 +7,7 @@
7
7
  * Buckety `file-blobs` i `voice-blobs` NIE ISTNIEJĄ w projekcie — lista bucketów
8
8
  * (16.09) to: secure_vault, brand_assets, chat-files, gemstone-models, voice-messages,
9
9
  * chat-attachments, odyssey-media, raydio-media, voice-samples, mayl-attachments,
10
- * rag-uploads, ptt-recordings, avatars, downloads, orb-media, founder-archive, krol-wrzutki.
10
+ * rag-uploads, ptt-recordings, avatars, downloads, orb-media, founder-archive and one private bucket.
11
11
  *
12
12
  * Dwa zamki, każdy pilnuje jednej połowy kontraktu z polityką RLS:
13
13
  * 1. bucket, który istnieje I przyjmie ten JWT (chat-files / voice-messages);