@mosadd/mcp 3.0.0-alpha.10 → 3.0.0-alpha.12

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  MCP server for [mosadd](https://mosadd.dev) — exposes the OS modules (m\*) as Model Context Protocol tools so any agent runtime can talk to mosadd: Claude Code, Cursor, Windsurf, Cline, ChatGPT Apps, Lovable, Bolt, Goose, Manus, custom.
4
4
 
5
- > **3.0.0-alpha.4** — **64 live tools across 7 live modules** (mDM incl. voice, mIRC, mROOM, mAIL, mTALK, mRAG, mURL) + 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` with the 167-event radar in front.
5
+ > **3.0.0-alpha.4** — **65 live tools across 7 live modules** (mDM incl. voice, mIRC, mROOM, mAIL, mTALK, mRAG, mURL) + 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` with the 166-event radar in front.
6
6
 
7
7
  ## Install
8
8
 
@@ -53,7 +53,7 @@ In Phase 2, run `mosadd login` to OAuth into hub.mosadd.com — no JWT-juggling
53
53
 
54
54
  ## Tools shipped in alpha
55
55
 
56
- **64 live tools across 7 live modules** (mDM, mIRC, mROOM, mAIL, mTALK, mRAG, mURL) + the `comms_capabilities` discovery tool. Highlights per module:
56
+ **65 live tools across 7 live modules** (mDM, mIRC, mROOM, mAIL, mTALK, mRAG, mURL) + the `comms_capabilities` discovery tool. Highlights per module:
57
57
 
58
58
  | Module | Tools | What it does |
59
59
  |---|---|---|
@@ -63,7 +63,7 @@ In Phase 2, run `mosadd login` to OAuth into hub.mosadd.com — no JWT-juggling
63
63
  | **mTALK** (5) | `mTALK_open`, `mTALK_join`, `mTALK_press`, `mTALK_release`, `mTALK_state` | Half-duplex push-to-talk: one speaker, FIFO queue, anti-hog auto-release |
64
64
  | **mAIL** (11) | `mAIL_send`, `mAIL_view`, `mAIL_list`, `mAIL_delete`, `mAIL_stats`, `mAIL_events`, `mAIL_metrics`, `mAIL_revoke`, `mAIL_audit_export`, `mAIL_consent`, `mAIL_notify` | Mail; every user gets `<id>@mosadd.com`. `mAIL_revoke` recalls secure-reader access; `mAIL_audit_export` emits an HMAC-SHA256-signed engagement audit; `mAIL_consent` manages recipient tracking opt-outs (GDPR); `mAIL_notify` pulls the inbound-mail notification feed |
65
65
  | **mRAG** (4) | `mRAG_ingest`, `mRAG_search`, `mRAG_list_sources`, `mRAG_delete` | RAG recall over the user's own data (hybrid vector + BM25) |
66
- | **mURL** (3) | `mURL_read_channel`, `mURL_post`, `mURL_presence` | Real-time chat attached to any web domain — agent-native ("IRC for URLs"). The per-domain room is never empty because agents read context + leave findings via MCP |
66
+ | **mURL** (4) | `mURL_read_channel`, `mURL_post`, `mURL_presence`, `mURL_list_channels` | Real-time chat attached to any web domain — agent-native ("IRC for URLs"). The per-domain room is never empty because agents read context + leave findings via MCP |
67
67
 
68
68
  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.
69
69
 
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-6EPYADVR.js";
4
+ } from "../chunk-GVHAKT62.js";
5
5
  import "../chunk-Z7WR52GE.js";
6
6
 
7
7
  // src/bin/mcp.ts
@@ -45,7 +45,10 @@ async function main() {
45
45
  apiKey: process.env.MOSADD_API_KEY,
46
46
  hubUrl: process.env.MOSADD_HUB_URL,
47
47
  mode: process.env.MOSADD_MODE,
48
- logLevel: process.env.MOSADD_LOG_LEVEL
48
+ logLevel: process.env.MOSADD_LOG_LEVEL,
49
+ // stdio is single-tenant: the session lives in env (set by bootstrapFromApiKey
50
+ // above), so auto-publish this identity's prekeys on boot → mDM is reachable.
51
+ autoPublishKeys: true
49
52
  });
50
53
  const transport = new StdioServerTransport();
51
54
  await server.connect(transport);
@@ -1789,6 +1789,25 @@ async function mURL_post(input, ctx) {
1789
1789
  if (!data?.id) throw new Error("mosadd-edge: send returned no id");
1790
1790
  return { domain, message_id: data.id, posted_at: data.ts ?? Date.now() };
1791
1791
  }
1792
+ var mURL_list_channels_input = z12.object({
1793
+ action: z12.enum(["trending", "list", "mine"]).optional().describe("'trending' (default) = most active domain channels in the last N hours; 'list' = paginated catalogue filtered by status; 'mine' = channels you own (DNS-verified)."),
1794
+ limit: z12.number().int().min(1).max(100).optional().describe("Max channels to return. Default 20."),
1795
+ hours: z12.number().int().min(1).max(168).optional().describe("Trending window in hours. Default 24, max 168 (7d)."),
1796
+ status: z12.enum(["open", "claimed", "blocked"]).optional().describe("For action='list': filter (default 'open')."),
1797
+ cursor: z12.string().optional().describe("For action='list': pagination \u2014 pass previous response's next_cursor (created_at ISO).")
1798
+ });
1799
+ async function mURL_list_channels(input, ctx) {
1800
+ readSupabaseEnv();
1801
+ const action = input.action ?? "trending";
1802
+ ctx.log("debug", "mURL_list_channels invoking murl-channels", { action });
1803
+ return await invokeFunction("murl-channels", {
1804
+ action,
1805
+ limit: input.limit ?? null,
1806
+ hours: input.hours ?? null,
1807
+ status: input.status ?? null,
1808
+ cursor: input.cursor ?? null
1809
+ });
1810
+ }
1792
1811
  var mURL_presence_input = z12.object({ domain: DomainArg });
1793
1812
  async function mURL_presence(input, ctx) {
1794
1813
  const { domain, slug: slug2 } = domainToSlug(input.domain);
@@ -1822,6 +1841,13 @@ var murlTools = [
1822
1841
  description: "Who is on a domain's mURL channel right now: live participant count + roster nicknames + channel status (open/claimed/blocked). Public (no key needed). Use it to gauge whether a domain has an active audience before posting.",
1823
1842
  inputSchema: mURL_presence_input,
1824
1843
  handler: mURL_presence
1844
+ },
1845
+ {
1846
+ name: "mURL_list_channels",
1847
+ requires: "network",
1848
+ description: "Discovery for mURL domain channels: 'trending' (most active in the last N hours, default 24) / 'list' (paginated catalogue, status-filtered) / 'mine' (channels you DNS-verified). Returns domain, slug, status, branding, verified_at + (for trending) messages_in_window. For who's-on-now, follow up with mURL_presence on the slug.",
1849
+ inputSchema: mURL_list_channels_input,
1850
+ handler: mURL_list_channels
1825
1851
  }
1826
1852
  ];
1827
1853
 
@@ -2038,6 +2064,9 @@ function createMosaddServer(options = {}) {
2038
2064
  }
2039
2065
  }
2040
2066
  };
2067
+ if (options.autoPublishKeys) {
2068
+ void publishOwnPrekeys(providers.keys, providers.dm).then((r) => ctx.log("debug", "auto-published mDM prekeys", { one_time_prekeys: r.oneTimePrekeyCount })).catch((err) => ctx.log("debug", "auto-publish mDM prekeys skipped", { error: String(err) }));
2069
+ }
2041
2070
  const server = new McpServer(
2042
2071
  {
2043
2072
  name: "mosadd",
package/dist/index.d.ts CHANGED
@@ -131,6 +131,15 @@ interface MosaddServerOptions {
131
131
  * network adapter. A carrier-aware host supplies e.g. a radio DmProvider here.
132
132
  */
133
133
  providers?: Partial<ProviderRegistry>;
134
+ /**
135
+ * When true, publish this identity's mDM prekey bundle once on startup
136
+ * (best-effort, non-fatal) so peers can open an E2EE session without the user
137
+ * manually running mDM_publish_keys first. Fixes the cold-start where mDM_send
138
+ * fails for every recipient because nobody has published keys. Used by the
139
+ * stdio binary; the hosted per-request transport leaves this off (it publishes
140
+ * per authenticated session instead).
141
+ */
142
+ autoPublishKeys?: boolean;
134
143
  }
135
144
  interface MosaddToolContext {
136
145
  options: Required<Pick<MosaddServerOptions, "mode" | "hubUrl">> & MosaddServerOptions;
@@ -186,7 +195,7 @@ declare function createMosaddServer(options?: MosaddServerOptions): McpServer;
186
195
  /**
187
196
  * Tool registry. Each m* module contributes a set of tools.
188
197
  *
189
- * Live modules (7): mDM, mIRC, mROOM, mTALK, mAIL, mRAG, mURL — 64 tools + comms_capabilities.
198
+ * Live modules (7): mDM, mIRC, mROOM, mTALK, mAIL, mRAG, mURL — 65 tools + comms_capabilities.
190
199
  * mCALL is carrier-pending (no telephony carrier live yet): its tools live in
191
200
  * tools/mcall.ts but are NOT registered here, so an agent only ever discovers
192
201
  * tools that actually work. Re-register the one line below when a carrier ships.
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  createMosaddServer,
4
4
  defaultProviders,
5
5
  runWithSupabaseEnv
6
- } from "./chunk-6EPYADVR.js";
6
+ } from "./chunk-GVHAKT62.js";
7
7
  import "./chunk-Z7WR52GE.js";
8
8
  export {
9
9
  allTools,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mosadd/mcp",
3
- "version": "3.0.0-alpha.10",
4
- "description": "Model Context Protocol server for mosadd. Exposes the 7 live m* modules (mDM, mIRC, mROOM, mTALK, mAIL, mRAG, mURL) — 64 tools — to any agent runtime (Claude Code, Cursor, Windsurf, Cline, ChatGPT Apps, Lovable, Bolt, Goose, Manus, custom).",
3
+ "version": "3.0.0-alpha.12",
4
+ "description": "Model Context Protocol server for mosadd. Exposes the 7 live m* modules (mDM, mIRC, mROOM, mTALK, mAIL, mRAG, mURL) — 65 tools — to any agent runtime (Claude Code, Cursor, Windsurf, Cline, ChatGPT Apps, Lovable, Bolt, Goose, Manus, custom).",
5
5
  "homepage": "https://github.com/Hei33enberg/mosadd-os/tree/main/packages/mcp",
6
6
  "repository": {
7
7
  "type": "git",
@@ -21,6 +21,7 @@ import type {
21
21
  import { mdmTools } from "../tools/mdm.js";
22
22
  import { InMemoryMdmKeyStore } from "../crypto/mdm-session.js";
23
23
  import { InMemoryVoiceProvider } from "../providers/memory-voice.js";
24
+ import { createMosaddServer } from "../server.js";
24
25
  import type { MosaddToolContext } from "../types.js";
25
26
 
26
27
  /** Shared store: message log + key directory, both keyed in one place. */
@@ -176,3 +177,36 @@ describe("mDM E2EE golden path — X3DH handshake + ratchet, both directions", (
176
177
  );
177
178
  });
178
179
  });
180
+
181
+ describe("auto-publish prekeys on startup (LINEAR-3104 cold-start fix)", () => {
182
+ it("publishes the local prekey bundle when autoPublishKeys is set", async () => {
183
+ const backend = new SharedBackend();
184
+ createMosaddServer({
185
+ mode: "local",
186
+ autoPublishKeys: true,
187
+ providers: {
188
+ dm: new ClientProvider(backend, "self-agent"),
189
+ keys: new InMemoryMdmKeyStore(),
190
+ voice: new InMemoryVoiceProvider("self-agent"),
191
+ },
192
+ });
193
+ // fire-and-forget; getOwnMaterial() does async key generation, so flush.
194
+ await new Promise((r) => setTimeout(r, 50));
195
+ expect(backend.bundles.has("self-agent")).toBe(true);
196
+ expect(backend.bundles.get("self-agent")!.byteLength).toBeGreaterThan(0);
197
+ });
198
+
199
+ it("does NOT publish when autoPublishKeys is unset (hosted/default)", async () => {
200
+ const backend = new SharedBackend();
201
+ createMosaddServer({
202
+ mode: "local",
203
+ providers: {
204
+ dm: new ClientProvider(backend, "quiet-agent"),
205
+ keys: new InMemoryMdmKeyStore(),
206
+ voice: new InMemoryVoiceProvider("quiet-agent"),
207
+ },
208
+ });
209
+ await new Promise((r) => setTimeout(r, 50));
210
+ expect(backend.bundles.has("quiet-agent")).toBe(false);
211
+ });
212
+ });
package/src/bin/mcp.ts CHANGED
@@ -68,6 +68,9 @@ async function main(): Promise<void> {
68
68
  hubUrl: process.env.MOSADD_HUB_URL,
69
69
  mode: (process.env.MOSADD_MODE as "cloud" | "local" | "self-host" | undefined),
70
70
  logLevel: (process.env.MOSADD_LOG_LEVEL as "debug" | "info" | "warn" | "error" | undefined),
71
+ // stdio is single-tenant: the session lives in env (set by bootstrapFromApiKey
72
+ // above), so auto-publish this identity's prekeys on boot → mDM is reachable.
73
+ autoPublishKeys: true,
71
74
  });
72
75
 
73
76
  const transport = new StdioServerTransport();
package/src/server.ts CHANGED
@@ -6,7 +6,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
6
6
  import { allTools } from "./tools/index.js";
7
7
  import { SupabaseDmProvider } from "./providers/supabase-dm.js";
8
8
  import { SupabaseVoiceProvider } from "./providers/supabase-voice.js";
9
- import { InMemoryMdmKeyStore } from "./crypto/mdm-session.js";
9
+ import { InMemoryMdmKeyStore, publishOwnPrekeys } from "./crypto/mdm-session.js";
10
10
  import type { MosaddServerOptions, MosaddToolContext, ProviderRegistry } from "./types.js";
11
11
 
12
12
  /**
@@ -45,6 +45,18 @@ export function createMosaddServer(options: MosaddServerOptions = {}) {
45
45
  },
46
46
  };
47
47
 
48
+ // Cold-start fix: make this identity reachable for inbound E2EE DMs the moment
49
+ // the server is up, so mDM_send works without every recipient first running
50
+ // mDM_publish_keys. Best-effort and non-fatal — it needs an authenticated
51
+ // session, so it silently skips when there is none (BYOK without a JWT, offline,
52
+ // etc.) and never blocks startup. Uses the SAME keystore the tools use, so the
53
+ // published identity matches what mDM_send/encryptForPeer will use this process.
54
+ if (options.autoPublishKeys) {
55
+ void publishOwnPrekeys(providers.keys, providers.dm)
56
+ .then((r) => ctx.log("debug", "auto-published mDM prekeys", { one_time_prekeys: r.oneTimePrekeyCount }))
57
+ .catch((err) => ctx.log("debug", "auto-publish mDM prekeys skipped", { error: String(err) }));
58
+ }
59
+
48
60
  const server = new McpServer(
49
61
  {
50
62
  name: "mosadd",
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Tool registry. Each m* module contributes a set of tools.
3
3
  *
4
- * Live modules (7): mDM, mIRC, mROOM, mTALK, mAIL, mRAG, mURL — 64 tools + comms_capabilities.
4
+ * Live modules (7): mDM, mIRC, mROOM, mTALK, mAIL, mRAG, mURL — 65 tools + comms_capabilities.
5
5
  * mCALL is carrier-pending (no telephony carrier live yet): its tools live in
6
6
  * tools/mcall.ts but are NOT registered here, so an agent only ever discovers
7
7
  * tools that actually work. Re-register the one line below when a carrier ships.
package/src/tools/mdm.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  * their own Supabase URL + anon key + a session JWT via env vars (BYOK).
11
11
  *
12
12
  * Phase 2 will route through the hosted gateway (mcp.mosadd.com) with the
13
- * 167-event radar middleware in front, and replace the plaintext
13
+ * 166-event radar middleware in front, and replace the plaintext
14
14
  * encrypted_payload with real X3DH + Double Ratchet via @mosadd/crypto.
15
15
  */
16
16
 
package/src/tools/murl.ts CHANGED
@@ -16,6 +16,7 @@
16
16
  */
17
17
  import { z } from "zod";
18
18
  import type { MosaddTool, MosaddToolContext } from "../types.js";
19
+ import { invokeFunction, readSupabaseEnv } from "../providers/supabase.js";
19
20
 
20
21
  const DEFAULT_EDGE_URL = "https://mosadd-edge.mr-brics-33.workers.dev";
21
22
  function edgeUrl(): string {
@@ -96,6 +97,51 @@ async function mURL_post(
96
97
  return { domain, message_id: data.id, posted_at: data.ts ?? Date.now() };
97
98
  }
98
99
 
100
+ // ── list_channels (discovery) ────────────────────────────────────────────────
101
+ const mURL_list_channels_input = z.object({
102
+ action: z
103
+ .enum(["trending", "list", "mine"])
104
+ .optional()
105
+ .describe("'trending' (default) = most active domain channels in the last N hours; 'list' = paginated catalogue filtered by status; 'mine' = channels you own (DNS-verified)."),
106
+ limit: z.number().int().min(1).max(100).optional().describe("Max channels to return. Default 20."),
107
+ hours: z.number().int().min(1).max(168).optional().describe("Trending window in hours. Default 24, max 168 (7d)."),
108
+ status: z.enum(["open", "claimed", "blocked"]).optional().describe("For action='list': filter (default 'open')."),
109
+ cursor: z.string().optional().describe("For action='list': pagination — pass previous response's next_cursor (created_at ISO)."),
110
+ });
111
+
112
+ interface MurlChannel {
113
+ domain: string;
114
+ slug: string;
115
+ status: string;
116
+ branding?: unknown;
117
+ verified_at?: string | null;
118
+ created_at?: string;
119
+ updated_at?: string;
120
+ messages_in_window?: number;
121
+ }
122
+
123
+ async function mURL_list_channels(
124
+ input: z.infer<typeof mURL_list_channels_input>,
125
+ ctx: MosaddToolContext,
126
+ ): Promise<{
127
+ channels: MurlChannel[];
128
+ count: number;
129
+ next_cursor?: string | null;
130
+ hours?: number;
131
+ since?: string;
132
+ }> {
133
+ readSupabaseEnv();
134
+ const action = input.action ?? "trending";
135
+ ctx.log("debug", "mURL_list_channels invoking murl-channels", { action });
136
+ return await invokeFunction("murl-channels", {
137
+ action,
138
+ limit: input.limit ?? null,
139
+ hours: input.hours ?? null,
140
+ status: input.status ?? null,
141
+ cursor: input.cursor ?? null,
142
+ });
143
+ }
144
+
99
145
  // ── presence ────────────────────────────────────────────────────────────────────
100
146
  const mURL_presence_input = z.object({ domain: DomainArg });
101
147
  async function mURL_presence(
@@ -138,4 +184,12 @@ export const murlTools: MosaddTool[] = [
138
184
  inputSchema: mURL_presence_input,
139
185
  handler: mURL_presence as MosaddTool["handler"],
140
186
  },
187
+ {
188
+ name: "mURL_list_channels",
189
+ requires: "network",
190
+ description:
191
+ "Discovery for mURL domain channels: 'trending' (most active in the last N hours, default 24) / 'list' (paginated catalogue, status-filtered) / 'mine' (channels you DNS-verified). Returns domain, slug, status, branding, verified_at + (for trending) messages_in_window. For who's-on-now, follow up with mURL_presence on the slug.",
192
+ inputSchema: mURL_list_channels_input,
193
+ handler: mURL_list_channels as MosaddTool["handler"],
194
+ },
141
195
  ];
package/src/types.ts CHANGED
@@ -43,6 +43,15 @@ export interface MosaddServerOptions {
43
43
  * network adapter. A carrier-aware host supplies e.g. a radio DmProvider here.
44
44
  */
45
45
  providers?: Partial<ProviderRegistry>;
46
+ /**
47
+ * When true, publish this identity's mDM prekey bundle once on startup
48
+ * (best-effort, non-fatal) so peers can open an E2EE session without the user
49
+ * manually running mDM_publish_keys first. Fixes the cold-start where mDM_send
50
+ * fails for every recipient because nobody has published keys. Used by the
51
+ * stdio binary; the hosted per-request transport leaves this off (it publishes
52
+ * per authenticated session instead).
53
+ */
54
+ autoPublishKeys?: boolean;
46
55
  }
47
56
 
48
57
  export interface MosaddToolContext {