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

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/dist/index.d.ts CHANGED
@@ -211,12 +211,14 @@ 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
- * 82 callable tools registered — the exact live count is exported as TOOL_COUNT
214
+ * 84 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-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 ·
216
+ * Breakdown (2026-08-17, measured from a live tools/list on the built server):
217
+ * modules mDM 16 · mIRC 24 · mURL 7 · mAYL 16 = 63; capabilities mTALK 6 · mRAG 8 ·
218
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.
219
+ * = 21. 63 + 21 = 84. (mDM 16 = 14 + mDM_send_as_agent/mDM_list_my_agents added 2026-08-17: an MCP key
220
+ * is bound to a USER, so an agent runtime wired up with its owner's key spoke AS THE OWNER — these
221
+ * let it speak as an agent it OWNS instead, checked server-side. mRAG 8 = 4 search/ingest + 4 mRAG_graph_* traversal tools added 2026-08-11.
220
222
  * comms_session_attach added 2026-08-14: a live agent session claims the account's reply lane so
221
223
  * the cloud stand-in defers to it — the front door that used to be a script on one PC.)
222
224
  * (History of this line drifting: the 2026-07-17 breakdown ended "= 69"
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  createMosaddServer,
5
5
  defaultProviders,
6
6
  runWithSupabaseEnv
7
- } from "./chunk-IWLN5EO5.js";
7
+ } from "./chunk-2UC5HJ7S.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.34",
3
+ "version": "3.0.0-alpha.36",
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 — 82 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 — 84 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.28",
41
42
  "@mosadd/crypto": "3.0.0-alpha.27",
42
- "@mosadd/providers": "3.0.0-alpha.27",
43
43
  "@mosadd/threat-engine": "3.0.0-alpha.28",
44
- "@mosadd/protocol": "3.0.0-alpha.28"
44
+ "@mosadd/providers": "3.0.0-alpha.27"
45
45
  },
46
46
  "devDependencies": {
47
47
  "tsup": "^8.3.5",
package/src/server.ts CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
6
6
  import { allTools } from "./tools/index.js";
7
+ import { PKG_VERSION } from "./version.js";
7
8
  import { SupabaseDmProvider } from "./providers/supabase-dm.js";
8
9
  import { SupabaseVoiceProvider } from "./providers/supabase-voice.js";
9
10
  import { InMemoryMdmKeyStore, publishOwnPrekeys } from "./crypto/mdm-session.js";
@@ -60,7 +61,7 @@ export function createMosaddServer(options: MosaddServerOptions = {}) {
60
61
  const server = new McpServer(
61
62
  {
62
63
  name: "mosadd",
63
- version: "3.0.0-alpha.32",
64
+ version: PKG_VERSION,
64
65
  },
65
66
  {
66
67
  capabilities: {
@@ -12,12 +12,14 @@
12
12
  * defensive classification over the threat taxonomy — the surveillance-era
13
13
  * *marketing* was killed, the classification engine is real and wanted.
14
14
  *
15
- * 82 callable tools registered — the exact live count is exported as TOOL_COUNT
15
+ * 84 callable tools registered — the exact live count is exported as TOOL_COUNT
16
16
  * (= allTools.length) below; ALWAYS reference that, never re-hard-code a number that drifts.
17
- * Breakdown (2026-08-14, measured from a live tools/list on the built server):
18
- * modules mDM 14 · mIRC 24 · mURL 7 · mAYL 16 = 61; capabilities mTALK 6 · mRAG 8 ·
17
+ * Breakdown (2026-08-17, measured from a live tools/list on the built server):
18
+ * modules mDM 16 · mIRC 24 · mURL 7 · mAYL 16 = 63; capabilities mTALK 6 · mRAG 8 ·
19
19
  * comms 5 (action_create/action_frame_get/embed_create/capabilities/session_attach) · Irondome/threat 2
20
- * = 21. 61 + 21 = 82. (mRAG 8 = 4 search/ingest + 4 mRAG_graph_* traversal tools added 2026-08-11.
20
+ * = 21. 63 + 21 = 84. (mDM 16 = 14 + mDM_send_as_agent/mDM_list_my_agents added 2026-08-17: an MCP key
21
+ * is bound to a USER, so an agent runtime wired up with its owner's key spoke AS THE OWNER — these
22
+ * let it speak as an agent it OWNS instead, checked server-side. mRAG 8 = 4 search/ingest + 4 mRAG_graph_* traversal tools added 2026-08-11.
21
23
  * comms_session_attach added 2026-08-14: a live agent session claims the account's reply lane so
22
24
  * the cloud stand-in defers to it — the front door that used to be a script on one PC.)
23
25
  * (History of this line drifting: the 2026-07-17 breakdown ended "= 69"
@@ -48,6 +50,7 @@
48
50
 
49
51
  import type { MosaddTool } from "../types.js";
50
52
  import { mdmTools } from "./mdm.js";
53
+ import { mdmAsAgentTools } from "./mdm-as-agent.js"; // mDM_send_as_agent + mDM_list_my_agents — 2026-08-17 (LINEAR-5620): a key is bound to a USER, so an agent runtime connected with its owner's key spoke AS THE OWNER and had no thread with him. These let that session speak as an agent it OWNS (verified server-side in mdm-send-as-agent).
51
54
  import { mdmVoiceTools } from "./mdm-voice.js";
52
55
  import { mircTools } from "./mirc.js";
53
56
  import { mircMembersTools } from "./mirc-members.js";
@@ -75,6 +78,7 @@ import { makeCapabilitiesTool } from "./capabilities.js";
75
78
  /** The m* channel tools (everything except the meta discovery tool). */
76
79
  const channelTools: MosaddTool[] = [
77
80
  ...mdmTools,
81
+ ...mdmAsAgentTools,
78
82
  ...mdmVoiceTools,
79
83
  ...mircTools,
80
84
  ...mircMembersTools,
@@ -0,0 +1,122 @@
1
+ /**
2
+ * mDM agent-attributed send — a person's session speaks AS one of THEIR agents.
3
+ *
4
+ * ── THE PROBLEM THIS SOLVES ──────────────────────────────────────────────────
5
+ * An MCP key is bound to a USER, and the hosted gateway exchanges it for THAT
6
+ * user's session. So when someone adds the connector while signed in as
7
+ * themselves, their agent runtime comes up holding the OWNER'S identity. The
8
+ * founder hit exactly this on 2026-08-17: his "Dispatch" agent authenticated as
9
+ * him, went looking for him among his own contacts, did not find him, and
10
+ * reported the agent↔agent guard as the cause. The real cost was that his mDM
11
+ * had no living 1:1 thread with his dispatcher.
12
+ *
13
+ * With this tool the same session can post AS `dispatcher@mosadd.com`, so the
14
+ * DYSPOZYTOR thread fills with messages FROM the dispatcher.
15
+ *
16
+ * ── AUTHORIZATION ────────────────────────────────────────────────────────────
17
+ * Enforced SERVER-SIDE by the `mdm-send-as-agent` Edge Function, never here:
18
+ * the named identity must be `kind='agent'`, owned by the CALLER
19
+ * (`owner_user_id`), and not retired. A client-side check would be decoration —
20
+ * the tool arguments are attacker-controlled by definition.
21
+ *
22
+ * Shape follows the accepted `mAYL_send_as_agent` precedent (owner's credential
23
+ * in, agent-attributed message out). Its AUTH model was deliberately not copied:
24
+ * measured 2026-08-17, `hub-claim-mint` accepts any `agent_id` string and never
25
+ * compares it to an owner, so the agent name in a mAYL provenance stamp is
26
+ * caller-asserted text. That gap is filed as LINEAR-5625; this tool does not
27
+ * reproduce it.
28
+ *
29
+ * Auth transport also differs on purpose: mAYL_send_as_agent reads
30
+ * `process.env.MOSADD_API_KEY`, which does not exist on the hosted multi-tenant
31
+ * gateway (the key is per-request there, not process-wide). This tool goes
32
+ * through `invokeFunction`, i.e. the caller's own session — so it works
33
+ * identically over stdio and over mcp.mosadd.com.
34
+ *
35
+ * Agent DMs travel as plaintext base64 on the established agent lane (the same
36
+ * path agent-dm-responder uses); this tool does not change that property.
37
+ * LINEAR-5620.
38
+ */
39
+
40
+ import { z } from "zod";
41
+ import type { MosaddTool, MosaddToolContext } from "../types.js";
42
+ import { invokeFunction } from "../providers/supabase.js";
43
+
44
+ const mDM_send_as_agent_input = z.object({
45
+ agent: z
46
+ .string()
47
+ .min(1)
48
+ .max(200)
49
+ .describe(
50
+ "Which of YOUR agents to speak as — its mosADD address (dispatcher@mosadd.com), " +
51
+ "its identity id, or its display name. Must be an agent you own.",
52
+ ),
53
+ text: z.string().min(1).max(8000).describe("The message body, as the agent would write it."),
54
+ to: z
55
+ .string()
56
+ .max(200)
57
+ .optional()
58
+ .describe(
59
+ "Recipient identity id or mosADD address. Defaults to YOU (the key's owner) — " +
60
+ "the common case is an agent reporting to its owner. Must be a person, not another agent.",
61
+ ),
62
+ silent: z
63
+ .boolean()
64
+ .optional()
65
+ .describe("Deliver without waking a phone: the message still arrives and shows unread, only the OS push is skipped."),
66
+ });
67
+
68
+ const mDM_list_my_agents_input = z.object({});
69
+
70
+ type SendResult = {
71
+ ok: boolean;
72
+ sent_as: { identity_id: string; address: string | null; display_name: string | null };
73
+ to: { identity_id: string; display_name: string | null };
74
+ thread_id: string;
75
+ };
76
+
77
+ async function mDM_send_as_agent(
78
+ input: z.infer<typeof mDM_send_as_agent_input>,
79
+ ctx: MosaddToolContext,
80
+ ): Promise<SendResult> {
81
+ ctx.log("debug", "mDM_send_as_agent", { agent: input.agent });
82
+ return await invokeFunction<SendResult>("mdm-send-as-agent", {
83
+ agent: input.agent,
84
+ text: input.text,
85
+ ...(input.to ? { to: input.to } : {}),
86
+ ...(input.silent ? { silent: true } : {}),
87
+ });
88
+ }
89
+
90
+ async function mDM_list_my_agents(
91
+ _input: z.infer<typeof mDM_list_my_agents_input>,
92
+ ctx: MosaddToolContext,
93
+ ): Promise<{ agents: Array<{ identity_id: string; address: string | null; display_name: string | null }> }> {
94
+ ctx.log("debug", "mDM_list_my_agents");
95
+ return await invokeFunction("mdm-send-as-agent", { action: "list_agents" });
96
+ }
97
+
98
+ export const mdmAsAgentTools: MosaddTool[] = [
99
+ {
100
+ name: "mDM_send_as_agent",
101
+ requires: "network",
102
+ description:
103
+ "Send a direct message AS ONE OF YOUR OWN AGENTS instead of as yourself. Use this when you are an " +
104
+ "agent runtime (Dispatch, Hermes, a CTO agent) connected with your owner's key: without it every " +
105
+ "message you send appears to come FROM the owner, so the owner has no thread with you. Names the " +
106
+ "agent by mosADD address, identity id or display name; `to` defaults to the key's owner. The server " +
107
+ "verifies you OWN that agent — speaking as someone else's agent, or as another person, is refused. " +
108
+ "Recipient must be a person: agent-to-agent DM stays blocked.",
109
+ inputSchema: mDM_send_as_agent_input,
110
+ handler: mDM_send_as_agent as MosaddTool["handler"],
111
+ },
112
+ {
113
+ name: "mDM_list_my_agents",
114
+ requires: "network",
115
+ description:
116
+ "List the agents you are allowed to speak as with mDM_send_as_agent — every live agent owned by " +
117
+ "the account behind this key, with its identity id, mosADD address and display name. Call this " +
118
+ "first when you are unsure which agent identity you hold.",
119
+ inputSchema: mDM_list_my_agents_input,
120
+ handler: mDM_list_my_agents as MosaddTool["handler"],
121
+ },
122
+ ];
package/src/version.ts ADDED
@@ -0,0 +1,8 @@
1
+ // Single source of truth for the package version at RUNTIME.
2
+ // ⛔ Never hand-type the version anywhere else (server.ts carried a hardcoded
3
+ // "3.0.0-alpha.32" while package.json said alpha.34 — serverInfo lied to every
4
+ // connected client). tsup bundles this JSON import, so the constant always
5
+ // equals the version that was actually published.
6
+ import pkg from "../package.json" with { type: "json" };
7
+
8
+ export const PKG_VERSION: string = (pkg as { version: string }).version;