@mosadd/mcp 3.0.0-alpha.47 → 3.0.0-alpha.49
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/bin/mcp.js +1 -1
- package/dist/{chunk-XTQMZ6K7.js → chunk-MGF7BV3M.js} +41 -23
- package/dist/index.js +1 -1
- package/package.json +73 -73
- package/src/__tests__/knowledge-ingest.test.ts +114 -114
- package/src/__tests__/presence.test.ts +190 -190
- package/src/__tests__/serverJsonVersion.test.ts +45 -45
- package/src/providers/supabase.ts +231 -231
- package/src/server.ts +162 -162
- package/src/tools/__tests__/ragDeleteFoldsSourceId.test.ts +67 -67
- package/src/tools/knowledge-graph.ts +186 -186
- package/src/tools/mail-agentbox.ts +155 -155
- package/src/tools/mcall.ts +216 -216
- package/src/tools/mdm-as-agent.ts +126 -126
- package/src/tools/mdm-voice.ts +220 -220
- package/src/tools/mdm.ts +495 -494
- package/src/tools/mirc-messages.ts +186 -185
- package/src/tools/murl.ts +314 -314
- package/src/tools/presence.ts +442 -414
- package/src/tools/ptt-ingest.ts +99 -99
- package/src/tools/threat.ts +123 -123
- package/src/tools/voice-format.ts +28 -0
- package/src/version.ts +8 -8
- package/LICENSE +0 -201
- package/dist/bin/login.d.ts +0 -13
- package/dist/bin/mcp.d.ts +0 -1
- package/dist/index.d.ts +0 -310
|
@@ -1,126 +1,126 @@
|
|
|
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
|
-
title: "Send DM as your agent",
|
|
102
|
-
annotations: { readOnlyHint: false },
|
|
103
|
-
requires: "network",
|
|
104
|
-
description:
|
|
105
|
-
"Send a direct message AS ONE OF YOUR OWN AGENTS instead of as yourself. Use this when you are an " +
|
|
106
|
-
"agent runtime (Dispatch, Hermes, a CTO agent) connected with your owner's key: without it every " +
|
|
107
|
-
"message you send appears to come FROM the owner, so the owner has no thread with you. Names the " +
|
|
108
|
-
"agent by mosADD address, identity id or display name; `to` defaults to the key's owner. The server " +
|
|
109
|
-
"verifies you OWN that agent — speaking as someone else's agent, or as another person, is refused. " +
|
|
110
|
-
"Recipient must be a person: agent-to-agent DM stays blocked.",
|
|
111
|
-
inputSchema: mDM_send_as_agent_input,
|
|
112
|
-
handler: mDM_send_as_agent as MosaddTool["handler"],
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
name: "mDM_list_my_agents",
|
|
116
|
-
title: "List your agents",
|
|
117
|
-
annotations: { readOnlyHint: true },
|
|
118
|
-
requires: "network",
|
|
119
|
-
description:
|
|
120
|
-
"List the agents you are allowed to speak as with mDM_send_as_agent — every live agent owned by " +
|
|
121
|
-
"the account behind this key, with its identity id, mosADD address and display name. Call this " +
|
|
122
|
-
"first when you are unsure which agent identity you hold.",
|
|
123
|
-
inputSchema: mDM_list_my_agents_input,
|
|
124
|
-
handler: mDM_list_my_agents as MosaddTool["handler"],
|
|
125
|
-
},
|
|
126
|
-
];
|
|
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
|
+
title: "Send DM as your agent",
|
|
102
|
+
annotations: { readOnlyHint: false },
|
|
103
|
+
requires: "network",
|
|
104
|
+
description:
|
|
105
|
+
"Send a direct message AS ONE OF YOUR OWN AGENTS instead of as yourself. Use this when you are an " +
|
|
106
|
+
"agent runtime (Dispatch, Hermes, a CTO agent) connected with your owner's key: without it every " +
|
|
107
|
+
"message you send appears to come FROM the owner, so the owner has no thread with you. Names the " +
|
|
108
|
+
"agent by mosADD address, identity id or display name; `to` defaults to the key's owner. The server " +
|
|
109
|
+
"verifies you OWN that agent — speaking as someone else's agent, or as another person, is refused. " +
|
|
110
|
+
"Recipient must be a person: agent-to-agent DM stays blocked.",
|
|
111
|
+
inputSchema: mDM_send_as_agent_input,
|
|
112
|
+
handler: mDM_send_as_agent as MosaddTool["handler"],
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "mDM_list_my_agents",
|
|
116
|
+
title: "List your agents",
|
|
117
|
+
annotations: { readOnlyHint: true },
|
|
118
|
+
requires: "network",
|
|
119
|
+
description:
|
|
120
|
+
"List the agents you are allowed to speak as with mDM_send_as_agent — every live agent owned by " +
|
|
121
|
+
"the account behind this key, with its identity id, mosADD address and display name. Call this " +
|
|
122
|
+
"first when you are unsure which agent identity you hold.",
|
|
123
|
+
inputSchema: mDM_list_my_agents_input,
|
|
124
|
+
handler: mDM_list_my_agents as MosaddTool["handler"],
|
|
125
|
+
},
|
|
126
|
+
];
|