@mosadd/mcp 3.0.0-alpha.36 → 3.0.0-alpha.37
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-2UC5HJ7S.js → chunk-ZTS3WMGG.js} +34 -11
- package/dist/index.js +1 -1
- package/package.json +3 -3
- package/src/__tests__/golden-path.test.ts +4 -2
- package/src/providers/supabase.ts +12 -5
- package/src/tools/mdm.ts +4 -2
- package/src/tools/mirc-messages.ts +31 -5
package/dist/bin/mcp.js
CHANGED
|
@@ -43,9 +43,18 @@ function getSupabase(env = readSupabaseEnv()) {
|
|
|
43
43
|
autoRefreshToken: false,
|
|
44
44
|
detectSessionInUrl: false
|
|
45
45
|
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
// ⛔ x-mosadd-origin: KAŻDE wywołanie z toolkitu/bramy MCP niesie ten znacznik (2026-08-25,
|
|
47
|
+
// rozkaz Króla „kradną tożsamości"). Sesje agentów wpinały klucz WŁAŚCICIELA i postowały na
|
|
48
|
+
// kanałach z jego dymka (SOVEREIGN) — serwer nie miał JAK odróżnić bramy od aplikacji, bo
|
|
49
|
+
// hub-key-exchange zwraca zwykły JWT usera. Ten nagłówek to rozróżnia: message-send odrzuca
|
|
50
|
+
// post na kanał z tożsamości CZŁOWIEKA, gdy przyszedł przez bramę — z komunikatem każącym
|
|
51
|
+
// wpiąć klucz SWOJEJ linii. Aplikacja mosadd.com nigdy nie wysyła tego nagłówka.
|
|
52
|
+
global: {
|
|
53
|
+
headers: {
|
|
54
|
+
...env.userJwt ? { Authorization: `Bearer ${env.userJwt}` } : {},
|
|
55
|
+
"x-mosadd-origin": "hub-gateway"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
49
58
|
});
|
|
50
59
|
}
|
|
51
60
|
async function invokeFunction(fn, body) {
|
|
@@ -437,7 +446,7 @@ async function mDM_send(input, ctx) {
|
|
|
437
446
|
const dm = ctx.providers.dm;
|
|
438
447
|
const selfId = await dm.selfId();
|
|
439
448
|
const threadId = dmThreadId(selfId, input.to, input.thread_label);
|
|
440
|
-
const inner = packPlaintextPayload(input.text
|
|
449
|
+
const inner = packPlaintextPayload(input.text);
|
|
441
450
|
const sealed = await encryptForPeer(ctx.providers.keys, dm, input.to, inner);
|
|
442
451
|
ctx.log("debug", "mDM_send E2EE via DmProvider", { thread_id: threadId, bytes: sealed.byteLength });
|
|
443
452
|
const result = await dm.send({
|
|
@@ -460,7 +469,7 @@ async function mDM_send_unencrypted(input, ctx) {
|
|
|
460
469
|
const dm = ctx.providers.dm;
|
|
461
470
|
const selfId = await dm.selfId();
|
|
462
471
|
const threadId = dmThreadId(selfId, input.to, input.thread_label);
|
|
463
|
-
const payload = packPlaintextPayload(input.text
|
|
472
|
+
const payload = packPlaintextPayload(input.text);
|
|
464
473
|
ctx.log("warn", "mDM_send_unencrypted (deprecated, plaintext) via DmProvider", {
|
|
465
474
|
thread_id: threadId,
|
|
466
475
|
bytes: payload.byteLength
|
|
@@ -1142,7 +1151,10 @@ var mIRC_post_message_input = z6.object({
|
|
|
1142
1151
|
channel_id: ChannelId3,
|
|
1143
1152
|
text: z6.string().min(1).max(64e3).describe("Message body (UTF-8). Max 64 KB."),
|
|
1144
1153
|
reply_to_id: z6.string().optional().describe("Optional id of the message being replied to."),
|
|
1145
|
-
space_id: z6.string().optional().describe("Optional backing space id. Resolved automatically from the channel if omitted.")
|
|
1154
|
+
space_id: z6.string().optional().describe("Optional backing space id. Resolved automatically from the channel if omitted."),
|
|
1155
|
+
agent: z6.string().max(200).optional().describe(
|
|
1156
|
+
"Post AS ONE OF YOUR OWN AGENTS instead of as the key's owner \u2014 its mosADD address (marocain@mosadd.com), its identity id, or its display name. An API key is bound to a USER, so without this every message from an agent runtime is attributed to the owner: a whole fleet reporting in one channel shows up as one person. Same field name and same ownership rule as mDM_send_as_agent. The server verifies you OWN that agent and that it is an active member of the channel; naming an agent you do not own is refused, never silently downgraded to you. Omit it and attribution is unchanged."
|
|
1157
|
+
)
|
|
1146
1158
|
});
|
|
1147
1159
|
var mIRC_list_messages_input = z6.object({
|
|
1148
1160
|
channel_id: ChannelId3,
|
|
@@ -1182,17 +1194,28 @@ async function mIRC_post_message(input, ctx) {
|
|
|
1182
1194
|
readSupabaseEnv();
|
|
1183
1195
|
const space_id = input.space_id ?? await resolveLinkedSpaceId(input.channel_id);
|
|
1184
1196
|
const thread_id = `chat:${input.channel_id}`;
|
|
1185
|
-
ctx.log("debug", "mIRC_post_message", { thread_id, space_id });
|
|
1197
|
+
ctx.log("debug", "mIRC_post_message", { thread_id, space_id, agent: input.agent });
|
|
1186
1198
|
const data = await invokeFunction("message-send", {
|
|
1187
1199
|
space_id,
|
|
1188
1200
|
thread_id,
|
|
1189
1201
|
encrypted_payload: packPlaintextPayload2(input.text, input.reply_to_id),
|
|
1190
1202
|
message_type: "txt",
|
|
1191
1203
|
protocol_version: PROTOCOL_VERSION3,
|
|
1192
|
-
reply_to_id: input.reply_to_id ?? null
|
|
1204
|
+
reply_to_id: input.reply_to_id ?? null,
|
|
1205
|
+
// Attribution is decided SERVER-SIDE (message-send → _shared/ownedAgent.ts): you may sign only
|
|
1206
|
+
// as an agent you own. Sent only when asked for, so the wire shape is unchanged for every
|
|
1207
|
+
// existing caller — and an unresolvable agent comes back 403 rather than posting as the owner.
|
|
1208
|
+
...input.agent ? { agent: input.agent } : {}
|
|
1193
1209
|
});
|
|
1194
1210
|
if (!data?.message?.id) throw new Error("message-send returned no message id");
|
|
1195
|
-
return {
|
|
1211
|
+
return {
|
|
1212
|
+
message_id: data.message.id,
|
|
1213
|
+
delivered_at: data.message.created_at ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
1214
|
+
thread_id,
|
|
1215
|
+
// Echo back WHO the message was signed as, so a caller can verify the attribution landed
|
|
1216
|
+
// instead of assuming it did.
|
|
1217
|
+
...data.sent_as ? { sent_as: data.sent_as } : {}
|
|
1218
|
+
};
|
|
1196
1219
|
}
|
|
1197
1220
|
async function mIRC_list_messages(input, ctx) {
|
|
1198
1221
|
readSupabaseEnv();
|
|
@@ -1219,7 +1242,7 @@ var mircMessagesTools = [
|
|
|
1219
1242
|
{
|
|
1220
1243
|
name: "mIRC_post_message",
|
|
1221
1244
|
requires: "network",
|
|
1222
|
-
description: "Post a text message into a persistent channel (mIRC). Pass channel_id from mIRC_create / mIRC_list; the backing space is resolved automatically. This is how an agent actually talks in a channel \u2014 the other mIRC_* tools only manage it. ACCESS: banned/blocked users are refused on ALL access modes (including open); open channels accept anyone not banned; password channels require joining with the password; private channels require request-access + approval. ENCRYPTION: this tool posts SERVER-READABLE plaintext base64 on EVERY access mode \u2014 private and password channels included; it is never end-to-end encrypted. Open channels: app clients CAN read toolkit-posted messages. Password/private channels: the mosadd.com app group-key-encrypts channel text on supported clients, but the toolkit does not hold that group key \u2014 the message still lands server-readable and app clients cannot decrypt it as channel text (group-key parity is not yet wired).",
|
|
1245
|
+
description: "Post a text message into a persistent channel (mIRC). Pass channel_id from mIRC_create / mIRC_list; the backing space is resolved automatically. This is how an agent actually talks in a channel \u2014 the other mIRC_* tools only manage it. ACCESS: banned/blocked users are refused on ALL access modes (including open); open channels accept anyone not banned; password channels require joining with the password; private channels require request-access + approval. ATTRIBUTION: by default the message is signed with the identity behind the API key \u2014 and a key belongs to a USER, so an agent runtime using its owner's key posts as the OWNER. Pass `agent` to sign as one of your own agents instead; the server verifies you own it and that it is in the channel. ENCRYPTION: this tool posts SERVER-READABLE plaintext base64 on EVERY access mode \u2014 private and password channels included; it is never end-to-end encrypted. Open channels: app clients CAN read toolkit-posted messages. Password/private channels: the mosadd.com app group-key-encrypts channel text on supported clients, but the toolkit does not hold that group key \u2014 the message still lands server-readable and app clients cannot decrypt it as channel text (group-key parity is not yet wired).",
|
|
1223
1246
|
inputSchema: mIRC_post_message_input,
|
|
1224
1247
|
handler: mIRC_post_message
|
|
1225
1248
|
},
|
|
@@ -2910,7 +2933,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
2910
2933
|
// package.json
|
|
2911
2934
|
var package_default = {
|
|
2912
2935
|
name: "@mosadd/mcp",
|
|
2913
|
-
version: "3.0.0-alpha.
|
|
2936
|
+
version: "3.0.0-alpha.36",
|
|
2914
2937
|
mcpName: "io.github.hei33enberg/mosadd-mcp",
|
|
2915
2938
|
description: "Model Context Protocol server for mosadd. Exposes 4 modules (mDM, mIRC, mURL, mAYL) and capabilities (mTALK, mRAG) plus comms agent-actions \u2014 84 tools \u2014 to any agent runtime (Claude Code, Cursor, Windsurf, Cline, ChatGPT Apps, Lovable, Bolt, Goose, Manus, custom).",
|
|
2916
2939
|
homepage: "https://github.com/Hei33enberg/mosADD-OS/tree/main/packages/mcp",
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mosadd/mcp",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.37",
|
|
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 — 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",
|
|
@@ -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",
|
|
42
41
|
"@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/
|
|
44
|
+
"@mosadd/protocol": "3.0.0-alpha.28"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"tsup": "^8.3.5",
|
|
@@ -111,8 +111,10 @@ describe("golden path — host injects transport under mDM", () => {
|
|
|
111
111
|
expect(result.message_id).toBe("radio-1");
|
|
112
112
|
|
|
113
113
|
// The payload is opaque to the provider but carries our text under the hood.
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
// 2026-08-25: plaintext lane is RAW utf8 text (native app format), not a JSON
|
|
115
|
+
// envelope — packPlaintextPayload change, unpack tolerates both shapes.
|
|
116
|
+
const decoded = Buffer.from(radio.sent[0]!.payload).toString("utf8");
|
|
117
|
+
expect(decoded).toBe("rendezvous at grid 4471, 0600");
|
|
116
118
|
});
|
|
117
119
|
|
|
118
120
|
it("step 5: mDM_list round-trips the message back through the same provider", async () => {
|
|
@@ -85,11 +85,18 @@ export function getSupabase(env: SupabaseEnv = readSupabaseEnv()): SupabaseClien
|
|
|
85
85
|
autoRefreshToken: false,
|
|
86
86
|
detectSessionInUrl: false,
|
|
87
87
|
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
// ⛔ x-mosadd-origin: KAŻDE wywołanie z toolkitu/bramy MCP niesie ten znacznik (2026-08-25,
|
|
89
|
+
// rozkaz Króla „kradną tożsamości"). Sesje agentów wpinały klucz WŁAŚCICIELA i postowały na
|
|
90
|
+
// kanałach z jego dymka (SOVEREIGN) — serwer nie miał JAK odróżnić bramy od aplikacji, bo
|
|
91
|
+
// hub-key-exchange zwraca zwykły JWT usera. Ten nagłówek to rozróżnia: message-send odrzuca
|
|
92
|
+
// post na kanał z tożsamości CZŁOWIEKA, gdy przyszedł przez bramę — z komunikatem każącym
|
|
93
|
+
// wpiąć klucz SWOJEJ linii. Aplikacja mosadd.com nigdy nie wysyła tego nagłówka.
|
|
94
|
+
global: {
|
|
95
|
+
headers: {
|
|
96
|
+
...(env.userJwt ? { Authorization: `Bearer ${env.userJwt}` } : {}),
|
|
97
|
+
"x-mosadd-origin": "hub-gateway",
|
|
98
|
+
},
|
|
99
|
+
},
|
|
93
100
|
});
|
|
94
101
|
}
|
|
95
102
|
|
package/src/tools/mdm.ts
CHANGED
|
@@ -150,7 +150,9 @@ async function mDM_send(
|
|
|
150
150
|
const selfId = await dm.selfId();
|
|
151
151
|
const threadId = dmThreadId(selfId, input.to, input.thread_label);
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
// reply-linkage jedzie w dm.send({replyToId}) — surowy tekst nie ma koperty, w którą
|
|
154
|
+
// można by go wpakować (zmiana formatu 2026-08-25, patrz packPlaintextPayload).
|
|
155
|
+
const inner = packPlaintextPayload(input.text);
|
|
154
156
|
const sealed = await encryptForPeer(ctx.providers.keys, dm, input.to, inner);
|
|
155
157
|
|
|
156
158
|
ctx.log("debug", "mDM_send E2EE via DmProvider", { thread_id: threadId, bytes: sealed.byteLength });
|
|
@@ -187,7 +189,7 @@ async function mDM_send_unencrypted(
|
|
|
187
189
|
const dm = ctx.providers.dm;
|
|
188
190
|
const selfId = await dm.selfId();
|
|
189
191
|
const threadId = dmThreadId(selfId, input.to, input.thread_label);
|
|
190
|
-
const payload = packPlaintextPayload(input.text
|
|
192
|
+
const payload = packPlaintextPayload(input.text);
|
|
191
193
|
|
|
192
194
|
ctx.log("warn", "mDM_send_unencrypted (deprecated, plaintext) via DmProvider", {
|
|
193
195
|
thread_id: threadId,
|
|
@@ -24,6 +24,19 @@ const mIRC_post_message_input = z.object({
|
|
|
24
24
|
.string()
|
|
25
25
|
.optional()
|
|
26
26
|
.describe("Optional backing space id. Resolved automatically from the channel if omitted."),
|
|
27
|
+
agent: z
|
|
28
|
+
.string()
|
|
29
|
+
.max(200)
|
|
30
|
+
.optional()
|
|
31
|
+
.describe(
|
|
32
|
+
"Post AS ONE OF YOUR OWN AGENTS instead of as the key's owner — its mosADD address " +
|
|
33
|
+
"(marocain@mosadd.com), its identity id, or its display name. An API key is bound to a USER, " +
|
|
34
|
+
"so without this every message from an agent runtime is attributed to the owner: a whole fleet " +
|
|
35
|
+
"reporting in one channel shows up as one person. Same field name and same ownership rule as " +
|
|
36
|
+
"mDM_send_as_agent. The server verifies you OWN that agent and that it is an active member of " +
|
|
37
|
+
"the channel; naming an agent you do not own is refused, never silently downgraded to you. " +
|
|
38
|
+
"Omit it and attribution is unchanged.",
|
|
39
|
+
),
|
|
27
40
|
});
|
|
28
41
|
|
|
29
42
|
const mIRC_list_messages_input = z.object({
|
|
@@ -76,26 +89,39 @@ async function resolveLinkedSpaceId(channelId: string): Promise<string> {
|
|
|
76
89
|
return spaceId;
|
|
77
90
|
}
|
|
78
91
|
|
|
92
|
+
type SentAs = { identity_id: string; address: string | null; display_name: string | null };
|
|
93
|
+
|
|
79
94
|
async function mIRC_post_message(
|
|
80
95
|
input: z.infer<typeof mIRC_post_message_input>,
|
|
81
96
|
ctx: MosaddToolContext,
|
|
82
|
-
): Promise<{ message_id: string; delivered_at: string; thread_id: string }> {
|
|
97
|
+
): Promise<{ message_id: string; delivered_at: string; thread_id: string; sent_as?: SentAs }> {
|
|
83
98
|
readSupabaseEnv();
|
|
84
99
|
const space_id = input.space_id ?? (await resolveLinkedSpaceId(input.channel_id));
|
|
85
100
|
const thread_id = `chat:${input.channel_id}`;
|
|
86
|
-
ctx.log("debug", "mIRC_post_message", { thread_id, space_id });
|
|
101
|
+
ctx.log("debug", "mIRC_post_message", { thread_id, space_id, agent: input.agent });
|
|
87
102
|
|
|
88
|
-
const data = await invokeFunction<{ message?: { id: string; created_at: string } }>("message-send", {
|
|
103
|
+
const data = await invokeFunction<{ message?: { id: string; created_at: string }; sent_as?: SentAs }>("message-send", {
|
|
89
104
|
space_id,
|
|
90
105
|
thread_id,
|
|
91
106
|
encrypted_payload: packPlaintextPayload(input.text, input.reply_to_id),
|
|
92
107
|
message_type: "txt",
|
|
93
108
|
protocol_version: PROTOCOL_VERSION,
|
|
94
109
|
reply_to_id: input.reply_to_id ?? null,
|
|
110
|
+
// Attribution is decided SERVER-SIDE (message-send → _shared/ownedAgent.ts): you may sign only
|
|
111
|
+
// as an agent you own. Sent only when asked for, so the wire shape is unchanged for every
|
|
112
|
+
// existing caller — and an unresolvable agent comes back 403 rather than posting as the owner.
|
|
113
|
+
...(input.agent ? { agent: input.agent } : {}),
|
|
95
114
|
});
|
|
96
115
|
|
|
97
116
|
if (!data?.message?.id) throw new Error("message-send returned no message id");
|
|
98
|
-
return {
|
|
117
|
+
return {
|
|
118
|
+
message_id: data.message.id,
|
|
119
|
+
delivered_at: data.message.created_at ?? new Date().toISOString(),
|
|
120
|
+
thread_id,
|
|
121
|
+
// Echo back WHO the message was signed as, so a caller can verify the attribution landed
|
|
122
|
+
// instead of assuming it did.
|
|
123
|
+
...(data.sent_as ? { sent_as: data.sent_as } : {}),
|
|
124
|
+
};
|
|
99
125
|
}
|
|
100
126
|
|
|
101
127
|
async function mIRC_list_messages(
|
|
@@ -140,7 +166,7 @@ export const mircMessagesTools: MosaddTool[] = [
|
|
|
140
166
|
name: "mIRC_post_message",
|
|
141
167
|
requires: "network",
|
|
142
168
|
description:
|
|
143
|
-
"Post a text message into a persistent channel (mIRC). Pass channel_id from mIRC_create / mIRC_list; the backing space is resolved automatically. This is how an agent actually talks in a channel — the other mIRC_* tools only manage it. ACCESS: banned/blocked users are refused on ALL access modes (including open); open channels accept anyone not banned; password channels require joining with the password; private channels require request-access + approval. ENCRYPTION: this tool posts SERVER-READABLE plaintext base64 on EVERY access mode — private and password channels included; it is never end-to-end encrypted. Open channels: app clients CAN read toolkit-posted messages. Password/private channels: the mosadd.com app group-key-encrypts channel text on supported clients, but the toolkit does not hold that group key — the message still lands server-readable and app clients cannot decrypt it as channel text (group-key parity is not yet wired).",
|
|
169
|
+
"Post a text message into a persistent channel (mIRC). Pass channel_id from mIRC_create / mIRC_list; the backing space is resolved automatically. This is how an agent actually talks in a channel — the other mIRC_* tools only manage it. ACCESS: banned/blocked users are refused on ALL access modes (including open); open channels accept anyone not banned; password channels require joining with the password; private channels require request-access + approval. ATTRIBUTION: by default the message is signed with the identity behind the API key — and a key belongs to a USER, so an agent runtime using its owner's key posts as the OWNER. Pass `agent` to sign as one of your own agents instead; the server verifies you own it and that it is in the channel. ENCRYPTION: this tool posts SERVER-READABLE plaintext base64 on EVERY access mode — private and password channels included; it is never end-to-end encrypted. Open channels: app clients CAN read toolkit-posted messages. Password/private channels: the mosadd.com app group-key-encrypts channel text on supported clients, but the toolkit does not hold that group key — the message still lands server-readable and app clients cannot decrypt it as channel text (group-key parity is not yet wired).",
|
|
144
170
|
inputSchema: mIRC_post_message_input,
|
|
145
171
|
handler: mIRC_post_message as MosaddTool["handler"],
|
|
146
172
|
},
|