@mosadd/mcp 3.0.0-alpha.32 → 3.0.0-alpha.34

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 (49) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/README.md +11 -11
  3. package/dist/bin/mcp.js +1 -1
  4. package/dist/{chunk-KX34DDJB.js → chunk-IWLN5EO5.js} +614 -134
  5. package/dist/index.d.ts +16 -6
  6. package/dist/index.js +1 -1
  7. package/package.json +6 -6
  8. package/src/__tests__/golden-path.test.ts +137 -137
  9. package/src/__tests__/integration.test.ts +179 -179
  10. package/src/__tests__/knowledge-ingest.test.ts +114 -0
  11. package/src/__tests__/mdm-e2ee.test.ts +212 -212
  12. package/src/__tests__/mtalk.test.ts +122 -122
  13. package/src/__tests__/presence.test.ts +141 -0
  14. package/src/__tests__/server.test.ts +71 -71
  15. package/src/__tests__/tool-count-consistency.test.ts +121 -1
  16. package/src/bin/login.ts +138 -138
  17. package/src/bin/mcp.ts +145 -145
  18. package/src/config.ts +66 -66
  19. package/src/crypto/mdm-session.ts +502 -502
  20. package/src/index.ts +19 -19
  21. package/src/observability/sentry.ts +79 -79
  22. package/src/providers/blob-upload.ts +116 -116
  23. package/src/providers/memory-voice.ts +79 -79
  24. package/src/providers/supabase-dm.ts +122 -122
  25. package/src/providers/supabase-voice.ts +91 -91
  26. package/src/providers/supabase.ts +148 -148
  27. package/src/tools/actions.ts +162 -162
  28. package/src/tools/attachments.ts +268 -268
  29. package/src/tools/capabilities.ts +68 -68
  30. package/src/tools/embed.ts +108 -108
  31. package/src/tools/index.ts +173 -104
  32. package/src/tools/knowledge-graph.ts +178 -0
  33. package/src/tools/knowledge.ts +319 -191
  34. package/src/tools/mail-agentbox.ts +147 -0
  35. package/src/tools/mail-aliases.ts +25 -25
  36. package/src/tools/mail-provenance.ts +135 -135
  37. package/src/tools/mail.ts +381 -381
  38. package/src/tools/mdm.ts +476 -479
  39. package/src/tools/mirc-edge.ts +190 -190
  40. package/src/tools/mirc-members.ts +2 -2
  41. package/src/tools/mirc-messages.ts +155 -155
  42. package/src/tools/mirc.ts +2 -2
  43. package/src/tools/mroom-messages.ts +142 -142
  44. package/src/tools/mroom.ts +221 -221
  45. package/src/tools/mtalk.ts +121 -121
  46. package/src/tools/murl.ts +4 -2
  47. package/src/tools/presence.ts +208 -0
  48. package/src/types.ts +94 -94
  49. package/src/voice/floor.ts +132 -132
package/dist/index.d.ts CHANGED
@@ -211,15 +211,25 @@ declare function createMosaddServer(options?: MosaddServerOptions): McpServer;
211
211
  * defensive classification over the threat taxonomy — the surveillance-era
212
212
  * *marketing* was killed, the classification engine is real and wanted.
213
213
  *
214
- * 69 callable tools registered — the exact live count is exported as TOOL_COUNT
214
+ * 82 callable tools registered — the exact live count is exported as TOOL_COUNT
215
215
  * (= allTools.length) below; ALWAYS reference that, never re-hard-code a number that drifts.
216
- * Breakdown (2026-07-17): mDM 14 · mIRC 22 · mAYL 11 · mURL 7 · mTALK 5 · mRAG 4 ·
217
- * comms 3 (action_create/frame_get/embed_create) · Irondome/threat 2 + comms_capabilities
218
- * discovery 1 = 69. (mDM/mIRC each include their 2 attachment tools from attachments.ts.)
216
+ * Breakdown (2026-08-14, measured from a live tools/list on the built server):
217
+ * modules mDM 14 · mIRC 24 · mURL 7 · mAYL 16 = 61; capabilities mTALK 6 · mRAG 8 ·
218
+ * comms 5 (action_create/action_frame_get/embed_create/capabilities/session_attach) · Irondome/threat 2
219
+ * = 21. 61 + 21 = 82. (mRAG 8 = 4 search/ingest + 4 mRAG_graph_* traversal tools added 2026-08-11.
220
+ * comms_session_attach added 2026-08-14: a live agent session claims the account's reply lane so
221
+ * the cloud stand-in defers to it — the front door that used to be a script on one PC.)
222
+ * (History of this line drifting: the 2026-07-17 breakdown ended "= 69"
223
+ * — wrong twice over, its own terms summed to 71; the 07-30 rewrite said 73 and still had
224
+ * mAYL at 12 after mAYL_send_as_agent had been re-registered, so it stayed wrong through the
225
+ * four mAYL_agentbox_* tools landing on 08-06. Arithmetic in comments drifts; TOOL_COUNT
226
+ * doesn't — and since 08-11 the anti-drift gate checks the PER-MODULE numbers too, not just
227
+ * the total, so this comment cannot rot alone any more.)
228
+ * (mDM/mIRC each include their 2 attachment tools from attachments.ts.)
219
229
  * Modules (4): mDM, mIRC, mURL, mAYL. Capabilities: mTALK (voice/PTT), mRAG, comms_, Irondome (threat_*).
220
230
  * mp0st_* stay as DEPRECATED back-compat aliases for mAYL_* (removed in a later alpha).
221
- * UNREGISTERED 2026-07-14 (broken scaffolds whose EFs 404/400 every call — re-register when
222
- * live): mAYL_send_as_agent (mail-provenance), mTALK_ingest_ptt (ptt-ingest).
231
+ * mAYL_send_as_agent + mTALK_ingest_ptt were RE-REGISTERED 2026-07-29: both had been disabled
232
+ * on 07-14 notes that had since become false, and both were re-verified on authenticated calls.
223
233
  * comms_embed_create RE-REGISTERED 2026-07-17 (embed.mosadd.com/v1.js live — P3 of mURL→mIRC).
224
234
  * mROOM was KILLED (LINEAR-3414, channel re-cut → ephemeral private mIRC): its tools
225
235
  * live in tools/mroom.ts + mroom-messages.ts but are NOT registered here.
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  createMosaddServer,
5
5
  defaultProviders,
6
6
  runWithSupabaseEnv
7
- } from "./chunk-KX34DDJB.js";
7
+ } from "./chunk-IWLN5EO5.js";
8
8
  import "./chunk-Z7WR52GE.js";
9
9
  export {
10
10
  TOOL_COUNT,
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@mosadd/mcp",
3
- "version": "3.0.0-alpha.32",
3
+ "version": "3.0.0-alpha.34",
4
4
  "mcpName": "io.github.hei33enberg/mosadd-mcp",
5
- "description": "Model Context Protocol server for mosadd. Exposes 4 modules (mDM, mIRC, mURL, mAYL) and capabilities (mTALK, mRAG) plus comms agent-actions — 69 tools — to any agent runtime (Claude Code, Cursor, Windsurf, Cline, ChatGPT Apps, Lovable, Bolt, Goose, Manus, custom).",
5
+ "description": "Model Context Protocol server for mosadd. Exposes 4 modules (mDM, mIRC, mURL, mAYL) and capabilities (mTALK, mRAG) plus comms agent-actions — 82 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
  "repository": {
8
8
  "type": "git",
@@ -38,10 +38,10 @@
38
38
  "@modelcontextprotocol/sdk": "^1.0.4",
39
39
  "@supabase/supabase-js": "^2.48.0",
40
40
  "zod": "^4.3.6",
41
- "@mosadd/protocol": "3.0.0-alpha.26",
42
- "@mosadd/providers": "3.0.0-alpha.26",
43
- "@mosadd/threat-engine": "3.0.0-alpha.26",
44
- "@mosadd/crypto": "3.0.0-alpha.26"
41
+ "@mosadd/crypto": "3.0.0-alpha.27",
42
+ "@mosadd/providers": "3.0.0-alpha.27",
43
+ "@mosadd/threat-engine": "3.0.0-alpha.28",
44
+ "@mosadd/protocol": "3.0.0-alpha.28"
45
45
  },
46
46
  "devDependencies": {
47
47
  "tsup": "^8.3.5",
@@ -1,137 +1,137 @@
1
- /**
2
- * Golden-path E2E: the day-1 "done" bar for the provider-abstraction seam.
3
- *
4
- * Proves a carrier-aware HOST (e.g. cymru-os) can inject its own transport
5
- * under mDM without mosadd-os knowing anything about that transport:
6
- * 1. host learns capabilities (comms_capabilities) and sees mDM_send = "any"
7
- * (usable off-grid over radio),
8
- * 2. host injects a fake RadioProvider,
9
- * 3. agent calls mDM_send,
10
- * 4. the opaque payload bytes actually arrive at the injected provider,
11
- * 5. they round-trip back out via mDM_list.
12
- *
13
- * This is the "is it sp, not just written" check the whole 2144 task hinges on.
14
- */
15
-
16
- import { describe, expect, it } from "vitest";
17
- import type {
18
- DmProvider,
19
- DmSendArgs,
20
- DmListArgs,
21
- DmSendResult,
22
- DmListResult,
23
- } from "@mosadd/providers";
24
- import { mdmTools } from "../tools/mdm.js";
25
- import { makeCapabilitiesTool } from "../tools/capabilities.js";
26
- import { allTools } from "../tools/index.js";
27
- import { createMosaddServer } from "../server.js";
28
- import { InMemoryMdmKeyStore } from "../crypto/mdm-session.js";
29
- import { InMemoryVoiceProvider } from "../providers/memory-voice.js";
30
- import type { MosaddToolContext, ProviderRegistry } from "../types.js";
31
-
32
- /** Stand-in for a host-supplied radio transport: captures the bytes it's asked
33
- * to send, and replays them on list — i.e. "the message reached the link". */
34
- class FakeRadioDmProvider implements DmProvider {
35
- public readonly sent: DmSendArgs[] = [];
36
- private bundle: Uint8Array | null = null;
37
- async selfId(): Promise<string> {
38
- return "radio:self-callsign";
39
- }
40
- async send(args: DmSendArgs): Promise<DmSendResult> {
41
- this.sent.push(args);
42
- return { id: `radio-${this.sent.length}`, deliveredAt: new Date(0).toISOString() };
43
- }
44
- async list(args: DmListArgs): Promise<DmListResult> {
45
- return {
46
- messages: this.sent
47
- .filter((s) => s.threadId === args.threadId)
48
- .map((s, i) => ({
49
- id: `radio-${i + 1}`,
50
- senderId: "radio:self-callsign",
51
- payload: s.payload,
52
- timestamp: new Date(0).toISOString(),
53
- threadId: s.threadId,
54
- })),
55
- nextCursor: null,
56
- };
57
- }
58
- async publishPrekeyBundle(bundle: Uint8Array): Promise<void> {
59
- this.bundle = bundle;
60
- }
61
- async fetchPrekeyBundle(): Promise<Uint8Array | null> {
62
- return this.bundle;
63
- }
64
- }
65
-
66
- function makeCtx(providers: { dm: DmProvider; keys?: ProviderRegistry["keys"] }): MosaddToolContext {
67
- return {
68
- options: { mode: "local", hubUrl: "https://mcp.mosadd.com" },
69
- providers: {
70
- dm: providers.dm,
71
- keys: providers.keys ?? new InMemoryMdmKeyStore(),
72
- voice: new InMemoryVoiceProvider("radio:self-callsign"),
73
- },
74
- log: () => {},
75
- };
76
- }
77
-
78
- const getTool = (name: string) => {
79
- const t = mdmTools.find((x) => x.name === name);
80
- if (!t) throw new Error(`tool ${name} not found`);
81
- return t;
82
- };
83
-
84
- describe("golden path — host injects transport under mDM", () => {
85
- it("step 1: comms_capabilities reports mDM_send usable over any carrier", async () => {
86
- const capTool = makeCapabilitiesTool(allTools);
87
- const manifest = (await capTool.handler({}, makeCtx({ dm: new FakeRadioDmProvider() }))) as {
88
- by_requirement: Record<string, string[]>;
89
- };
90
- expect(manifest.by_requirement.any).toContain("mDM_send");
91
- });
92
-
93
- it("steps 2-4: the deprecated plaintext path delivers opaque bytes to the injected provider", async () => {
94
- // This proves the TRANSPORT seam (2144): mDM_send_unencrypted packs a
95
- // plaintext envelope and the bytes reach the injected provider verbatim.
96
- // (mDM_send is now E2EE — its own round-trip is covered in mdm-e2ee.test.ts.)
97
- const radio = new FakeRadioDmProvider();
98
- const ctx = makeCtx({ dm: radio });
99
-
100
- const send = getTool("mDM_send_unencrypted");
101
- const result = (await send.handler(
102
- { to: "bob-callsign", text: "rendezvous at grid 4471, 0600" },
103
- ctx,
104
- )) as { message_id: string; thread_id: string };
105
-
106
- // The bytes actually reached the transport.
107
- expect(radio.sent).toHaveLength(1);
108
- expect(radio.sent[0]!.to).toBe("bob-callsign");
109
- expect(radio.sent[0]!.payload).toBeInstanceOf(Uint8Array);
110
- expect(radio.sent[0]!.payload.byteLength).toBeGreaterThan(0);
111
- expect(result.message_id).toBe("radio-1");
112
-
113
- // The payload is opaque to the provider but carries our text under the hood.
114
- const decoded = JSON.parse(Buffer.from(radio.sent[0]!.payload).toString("utf8"));
115
- expect(decoded.text).toBe("rendezvous at grid 4471, 0600");
116
- });
117
-
118
- it("step 5: mDM_list round-trips the message back through the same provider", async () => {
119
- const radio = new FakeRadioDmProvider();
120
- const ctx = makeCtx({ dm: radio });
121
-
122
- await getTool("mDM_send_unencrypted").handler({ to: "bob-callsign", text: "ack" }, ctx);
123
- const listed = (await getTool("mDM_list").handler({ contact_id: "bob-callsign" }, ctx)) as {
124
- messages: Array<{ text: string }>;
125
- };
126
-
127
- expect(listed.messages).toHaveLength(1);
128
- expect(listed.messages[0]!.text).toBe("ack");
129
- });
130
-
131
- it("default server wires a DmProvider without a host override (no throw)", () => {
132
- // Network default path: constructing the server must not require a host to
133
- // inject anything (it falls back to the Supabase adapter).
134
- expect(() => createMosaddServer()).not.toThrow();
135
- expect(() => createMosaddServer({ providers: { dm: new FakeRadioDmProvider() } })).not.toThrow();
136
- });
137
- });
1
+ /**
2
+ * Golden-path E2E: the day-1 "done" bar for the provider-abstraction seam.
3
+ *
4
+ * Proves a carrier-aware HOST (e.g. cymru-os) can inject its own transport
5
+ * under mDM without mosadd-os knowing anything about that transport:
6
+ * 1. host learns capabilities (comms_capabilities) and sees mDM_send = "any"
7
+ * (usable off-grid over radio),
8
+ * 2. host injects a fake RadioProvider,
9
+ * 3. agent calls mDM_send,
10
+ * 4. the opaque payload bytes actually arrive at the injected provider,
11
+ * 5. they round-trip back out via mDM_list.
12
+ *
13
+ * This is the "is it sp, not just written" check the whole 2144 task hinges on.
14
+ */
15
+
16
+ import { describe, expect, it } from "vitest";
17
+ import type {
18
+ DmProvider,
19
+ DmSendArgs,
20
+ DmListArgs,
21
+ DmSendResult,
22
+ DmListResult,
23
+ } from "@mosadd/providers";
24
+ import { mdmTools } from "../tools/mdm.js";
25
+ import { makeCapabilitiesTool } from "../tools/capabilities.js";
26
+ import { allTools } from "../tools/index.js";
27
+ import { createMosaddServer } from "../server.js";
28
+ import { InMemoryMdmKeyStore } from "../crypto/mdm-session.js";
29
+ import { InMemoryVoiceProvider } from "../providers/memory-voice.js";
30
+ import type { MosaddToolContext, ProviderRegistry } from "../types.js";
31
+
32
+ /** Stand-in for a host-supplied radio transport: captures the bytes it's asked
33
+ * to send, and replays them on list — i.e. "the message reached the link". */
34
+ class FakeRadioDmProvider implements DmProvider {
35
+ public readonly sent: DmSendArgs[] = [];
36
+ private bundle: Uint8Array | null = null;
37
+ async selfId(): Promise<string> {
38
+ return "radio:self-callsign";
39
+ }
40
+ async send(args: DmSendArgs): Promise<DmSendResult> {
41
+ this.sent.push(args);
42
+ return { id: `radio-${this.sent.length}`, deliveredAt: new Date(0).toISOString() };
43
+ }
44
+ async list(args: DmListArgs): Promise<DmListResult> {
45
+ return {
46
+ messages: this.sent
47
+ .filter((s) => s.threadId === args.threadId)
48
+ .map((s, i) => ({
49
+ id: `radio-${i + 1}`,
50
+ senderId: "radio:self-callsign",
51
+ payload: s.payload,
52
+ timestamp: new Date(0).toISOString(),
53
+ threadId: s.threadId,
54
+ })),
55
+ nextCursor: null,
56
+ };
57
+ }
58
+ async publishPrekeyBundle(bundle: Uint8Array): Promise<void> {
59
+ this.bundle = bundle;
60
+ }
61
+ async fetchPrekeyBundle(): Promise<Uint8Array | null> {
62
+ return this.bundle;
63
+ }
64
+ }
65
+
66
+ function makeCtx(providers: { dm: DmProvider; keys?: ProviderRegistry["keys"] }): MosaddToolContext {
67
+ return {
68
+ options: { mode: "local", hubUrl: "https://mcp.mosadd.com" },
69
+ providers: {
70
+ dm: providers.dm,
71
+ keys: providers.keys ?? new InMemoryMdmKeyStore(),
72
+ voice: new InMemoryVoiceProvider("radio:self-callsign"),
73
+ },
74
+ log: () => {},
75
+ };
76
+ }
77
+
78
+ const getTool = (name: string) => {
79
+ const t = mdmTools.find((x) => x.name === name);
80
+ if (!t) throw new Error(`tool ${name} not found`);
81
+ return t;
82
+ };
83
+
84
+ describe("golden path — host injects transport under mDM", () => {
85
+ it("step 1: comms_capabilities reports mDM_send usable over any carrier", async () => {
86
+ const capTool = makeCapabilitiesTool(allTools);
87
+ const manifest = (await capTool.handler({}, makeCtx({ dm: new FakeRadioDmProvider() }))) as {
88
+ by_requirement: Record<string, string[]>;
89
+ };
90
+ expect(manifest.by_requirement.any).toContain("mDM_send");
91
+ });
92
+
93
+ it("steps 2-4: the deprecated plaintext path delivers opaque bytes to the injected provider", async () => {
94
+ // This proves the TRANSPORT seam (2144): mDM_send_unencrypted packs a
95
+ // plaintext envelope and the bytes reach the injected provider verbatim.
96
+ // (mDM_send is now E2EE — its own round-trip is covered in mdm-e2ee.test.ts.)
97
+ const radio = new FakeRadioDmProvider();
98
+ const ctx = makeCtx({ dm: radio });
99
+
100
+ const send = getTool("mDM_send_unencrypted");
101
+ const result = (await send.handler(
102
+ { to: "bob-callsign", text: "rendezvous at grid 4471, 0600" },
103
+ ctx,
104
+ )) as { message_id: string; thread_id: string };
105
+
106
+ // The bytes actually reached the transport.
107
+ expect(radio.sent).toHaveLength(1);
108
+ expect(radio.sent[0]!.to).toBe("bob-callsign");
109
+ expect(radio.sent[0]!.payload).toBeInstanceOf(Uint8Array);
110
+ expect(radio.sent[0]!.payload.byteLength).toBeGreaterThan(0);
111
+ expect(result.message_id).toBe("radio-1");
112
+
113
+ // The payload is opaque to the provider but carries our text under the hood.
114
+ const decoded = JSON.parse(Buffer.from(radio.sent[0]!.payload).toString("utf8"));
115
+ expect(decoded.text).toBe("rendezvous at grid 4471, 0600");
116
+ });
117
+
118
+ it("step 5: mDM_list round-trips the message back through the same provider", async () => {
119
+ const radio = new FakeRadioDmProvider();
120
+ const ctx = makeCtx({ dm: radio });
121
+
122
+ await getTool("mDM_send_unencrypted").handler({ to: "bob-callsign", text: "ack" }, ctx);
123
+ const listed = (await getTool("mDM_list").handler({ contact_id: "bob-callsign" }, ctx)) as {
124
+ messages: Array<{ text: string }>;
125
+ };
126
+
127
+ expect(listed.messages).toHaveLength(1);
128
+ expect(listed.messages[0]!.text).toBe("ack");
129
+ });
130
+
131
+ it("default server wires a DmProvider without a host override (no throw)", () => {
132
+ // Network default path: constructing the server must not require a host to
133
+ // inject anything (it falls back to the Supabase adapter).
134
+ expect(() => createMosaddServer()).not.toThrow();
135
+ expect(() => createMosaddServer({ providers: { dm: new FakeRadioDmProvider() } })).not.toThrow();
136
+ });
137
+ });