@mosadd/mcp 3.0.0-alpha.56 → 3.0.0-alpha.58
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/CHANGELOG.md +18 -0
- package/README.md +26 -12
- package/dist/bin/mcp.js +90 -5
- package/dist/{chunk-T3KDVUAT.js → chunk-W4FAEM6N.js} +21 -8
- package/dist/index.js +1 -1
- package/package.json +9 -9
- package/src/__tests__/cli.test.ts +47 -0
- package/src/__tests__/integration.test.ts +10 -2
- package/src/__tests__/label-room-owner.test.ts +22 -0
- package/src/__tests__/tool-count-consistency.test.ts +12 -8
- package/src/__tests__/voice-fields.test.ts +24 -0
- package/src/bin/mcp.ts +22 -5
- package/src/cli.ts +100 -0
- package/src/providers/supabase-dm.ts +10 -0
- package/src/providers/supabase-voice.ts +13 -1
- package/src/tools/mdm.ts +3 -1
- package/src/tools/mtalk.ts +1 -1
- package/src/tools/voice-format.ts +15 -0
- package/LICENSE +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,24 @@ gateway (Phase 2) ships.
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [3.0.0-alpha.58] — 2026-11-16
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- **CLI:** `npx @mosadd/mcp --version`, `--help` and `tools` print (version, commands + env vars, all tools grouped by module) and exit instead of starting the stdio server.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
- The "ready" log line now reports the `package.json` version (it said `3.0.0-alpha.0`).
|
|
18
|
+
|
|
19
|
+
## [3.0.0-alpha.57] — 2026-11-15
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
- **`mTALK_open {label}` opens a room you own.** The room id is now `mosadd-room-<your identity id>-<label>`;
|
|
23
|
+
you and your accepted contacts can join it, a stranger cannot (before: one shared `mosadd-room-<label>` for every
|
|
24
|
+
account, refused to everyone, including its creator).
|
|
25
|
+
- **`mDM_list` returns voice notes with their transcript and recording.** Voice/PTT messages carry
|
|
26
|
+
`voice: { transcript, audio_url, duration_ms }` (signed URL, read with the caller's own permissions) instead of a
|
|
27
|
+
bare caption.
|
|
28
|
+
|
|
11
29
|
## [3.0.0-alpha.56] — 2026-11-10
|
|
12
30
|
|
|
13
31
|
### Added
|
package/README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# @mosadd/mcp
|
|
2
2
|
|
|
3
|
-
**They're apps. We're the layer.** The MCP server for [mosADD](https://mosadd.com) — the omnichannel comms layer for humans, agents, and robots. It exposes the OS modules (m\*) — **mDM (1:1
|
|
3
|
+
**They're apps. We're the layer.** The MCP server for [mosADD](https://mosadd.com) — the omnichannel comms layer for humans, agents, and robots. It exposes the OS modules (m\*) — **mDM (1:1), mIRC (channels, including open-web mURL rooms), and mAYL (email 3.0)** — as Model Context Protocol tools, so any agent runtime becomes a first-class contact your team can message and direct: Claude Code, Cursor, Windsurf, Cline, ChatGPT Apps, Lovable, Bolt, Goose, Manus, or your own.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Hosted path:** `https://mcp.mosadd.com/mcp` — add it by URL and sign in with your mosADD account (OAuth), nothing to paste. Without a browser, use a key from [mosadd.com/keys](https://mosadd.com/keys) (`MOSADD_API_KEY` / `mosadd_sk_live_…`) over stdio with this package, or as a Bearer header against the same address.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
One key, one server, 85 tools — MCP-native, no SDK to wire up. **What is encrypted, plainly:** mDM between two *people* in the mosADD app is end-to-end encrypted (Signal X3DH + Double Ratchet, keys on the device). Since 3.0.0-alpha.54, when an agent line is on either side of an mDM — and every agent hub key and every key for the MCP endpoint speaks as an agent line — `mDM_send` sends plain text over TLS and the service can read it. Channels, mURL rooms, mail and voice are server-readable too. The full posture: [docs/security/e2ee-posture.md](https://github.com/Hei33enberg/mosADD-OS/blob/main/docs/security/e2ee-posture.md).
|
|
8
|
+
|
|
9
|
+
> **85 tools** across **3 MVP modules** (mDM, mIRC, mAYL) — mURL open-web rooms are folded under mIRC — + cross-cutting capabilities (mTALK voice, mRAG search, comms agent-actions) + agent→user action links + the `comms_capabilities` discovery tool.
|
|
8
10
|
|
|
9
11
|
## Connect your agent
|
|
10
12
|
|
|
@@ -53,27 +55,27 @@ A `mosadd_sk_live_…` hub key does not expire; the server exchanges it for a fr
|
|
|
53
55
|
}
|
|
54
56
|
```
|
|
55
57
|
|
|
56
|
-
Mint a key at **[mosadd.com/keys](https://mosadd.com/keys)** —
|
|
58
|
+
Mint a mosadd.com key at **[mosadd.com/keys](https://mosadd.com/keys)** — shown once as `mosadd_sk_live_…`. The same key also works as a Bearer header against `https://mcp.mosadd.com/mcp`; with a browser, sign in there instead (OAuth).
|
|
57
59
|
|
|
58
60
|
### 3. BYOK + `MOSADD_USER_JWT` — advanced / debugging
|
|
59
61
|
|
|
60
|
-
Bring your own Supabase URL + anon key + a raw session token. **The JWT expires (~1h)** — prefer option 1 or 2 for anything ongoing.
|
|
62
|
+
Bring your own Supabase URL + anon key + a raw session token. **The JWT expires (~1h)** — prefer option 1 or 2, or the hosted endpoint `https://mcp.mosadd.com/mcp`, for anything ongoing.
|
|
61
63
|
|
|
62
64
|
- `MOSADD_SUPABASE_URL` — your Supabase project URL (e.g. `https://abc.supabase.co`)
|
|
63
65
|
- `MOSADD_SUPABASE_ANON_KEY` — the public anon key from project settings
|
|
64
66
|
- `MOSADD_USER_JWT` — sign in to mosadd.com → DevTools → Application → Local Storage → `sb-<ref>-auth-token` → copy the `access_token` field
|
|
65
67
|
|
|
66
|
-
|
|
68
|
+
The hosted gateway at `https://mcp.mosadd.com/mcp` is the zero-install remote path: OAuth sign-in, or Bearer with a mosadd.com key.
|
|
67
69
|
|
|
68
70
|
## Tools shipped in alpha
|
|
69
71
|
|
|
70
|
-
**85 tools** —
|
|
72
|
+
**85 tools** — 3 MVP modules (mDM, mIRC[+mURL], mAYL) + capabilities (mTALK voice, mRAG search + knowledge-graph traversal, comms agent-actions) + the `comms_capabilities` discovery tool. Highlights:
|
|
71
73
|
|
|
72
74
|
| Module | Tools | What it does |
|
|
73
75
|
|---|---|---|
|
|
74
76
|
| **mDM** (16) | `mDM_list_contacts`, `mDM_send`, `mDM_send_unencrypted` (DEPRECATED — migration-window fallback, only when the peer hasn't published keys), `mDM_edit`, `mDM_delete`, `mDM_list`, `mDM_publish_keys`, `mDM_respond_request`, `mDM_call_start/answer/end`, `mDM_voice_note`, `mDM_send_voice`, `mDM_send_file` | 1:1 text, voice notes, calls + file/voice attachments. Multi-thread per contact. Between two people `mDM_send` encrypts end-to-end (X3DH / Double Ratchet, `mosadd.e2ee.v2`); with an agent line on either side (alpha.54 and later) it sends plain text the service can read |
|
|
75
77
|
| **mIRC** (25) | `mIRC_create/list/get/update/delete/discover/report`, member RBAC (`mIRC_join/leave/invite/kick/ban/unban/set_role/set_ptt/approve_request/reject_request/request_access`), `mIRC_post_message`, `mIRC_list_messages`, edge (`mIRC_mint_channel_token`, `mIRC_send_edge`, `mIRC_history_edge`), `mIRC_send_voice/file` | Persistent Discord/Slack-style channels + the agent-coordination edge transport |
|
|
76
|
-
| **mURL** (7) | `mURL_read_channel`, `mURL_post`, `mURL_presence`, `mURL_list_channels`, `mURL_create`, `mURL_update`, `mURL_delete` |
|
|
78
|
+
| **mURL** (7) | `mURL_read_channel`, `mURL_post`, `mURL_presence`, `mURL_list_channels`, `mURL_create`, `mURL_update`, `mURL_delete` | Open-web rooms folded under mIRC (not a separate MVP module). Read/post/presence/discovery + owner lifecycle. Transport-encrypted, server-readable/public by design |
|
|
77
79
|
| **mAYL** (16) | `mAYL_send`, `mAYL_view`, `mAYL_list`, `mAYL_delete`, `mAYL_stats`, `mAYL_events`, `mAYL_metrics`, `mAYL_revoke`, `mAYL_audit_export`, `mAYL_consent`, `mAYL_notify`, `mAYL_send_as_agent`, `mAYL_agentbox_provision`, `mAYL_agentbox_list`, `mAYL_agentbox_extend`, `mAYL_agentbox_release` | Mail; every user gets `<id>@mosadd.com`. The four `mAYL_agentbox_*` tools let an AGENT mint, list, extend and release its OWN two-way disposable inbox (`agent-<hex>@mosadd.com`) — `create_inbox` parity with AgentMail, on our stack, with provenance. Transport + at-rest encrypted (server-readable), NOT E2EE. `mAYL_revoke` recalls secure-reader access; `mAYL_audit_export` emits an HMAC-SHA256-signed engagement audit; `mAYL_consent` manages recipient tracking opt-outs (GDPR); `mAYL_notify` pulls the inbound-mail feed. (Was the mp0st codename; the `mp0st_*` aliases are retired — mAYL is the one name) |
|
|
78
80
|
| **mTALK** (6) | `mTALK_open`, `mTALK_join`, `mTALK_press`, `mTALK_release`, `mTALK_state`, `mTALK_ingest_ptt` | Half-duplex push-to-talk: one speaker, FIFO queue, anti-hog auto-release + transcript ingest to mRAG |
|
|
79
81
|
| **mRAG** (8) | `mRAG_ingest`, `mRAG_search`, `mRAG_list_sources`, `mRAG_delete`, `mRAG_graph_refresh`, `mRAG_graph_overview`, `mRAG_graph_neighbors`, `mRAG_graph_timeline` | RAG recall over the user's own data (hybrid vector + BM25) + knowledge-graph traversal (who/what/when) |
|
|
@@ -119,7 +121,20 @@ Postgres `messages` table
|
|
|
119
121
|
mosadd.com app (receiver)
|
|
120
122
|
```
|
|
121
123
|
|
|
122
|
-
For PTT / CALL (real-time media), the architecture separates **control plane** (MCP) from **data plane** (WebRTC daemon).
|
|
124
|
+
For PTT / CALL (real-time media), the architecture separates **control plane** (MCP) from **data plane** (WebRTC daemon). That design doc is not written yet; what the hosted service guarantees today is in [docs/architecture/phase-2-hub.md](https://github.com/Hei33enberg/mosADD-OS/blob/main/docs/architecture/phase-2-hub.md).
|
|
125
|
+
|
|
126
|
+
## CLI
|
|
127
|
+
|
|
128
|
+
`npx @mosadd/mcp` with no arguments starts the MCP server over stdio (what your agent runtime runs). These commands print and exit instead:
|
|
129
|
+
|
|
130
|
+
| Command | What it does |
|
|
131
|
+
|---|---|
|
|
132
|
+
| `npx @mosadd/mcp --version` (`-v`) | prints the installed version (from `package.json`) |
|
|
133
|
+
| `npx @mosadd/mcp --help` (`-h`) | prints the commands and the environment variables, including `MOSADD_API_KEY` |
|
|
134
|
+
| `npx @mosadd/mcp tools` | lists every registered tool, grouped by module |
|
|
135
|
+
| `npx @mosadd/mcp login` / `logout` / `whoami` | save, delete, or show the signed-in session |
|
|
136
|
+
|
|
137
|
+
The server's `serverInfo.version` and its "ready" log line use the same `package.json` version.
|
|
123
138
|
|
|
124
139
|
## Configuration via env vars
|
|
125
140
|
|
|
@@ -141,10 +156,9 @@ Missing optional keys fail closed — that channel is simply absent from `comms_
|
|
|
141
156
|
|
|
142
157
|
## Links
|
|
143
158
|
|
|
144
|
-
- **
|
|
145
|
-
- **
|
|
159
|
+
- **Hosted endpoint** — `https://mcp.mosadd.com/mcp` (OAuth sign-in) · keys at [mosadd.com/keys](https://mosadd.com/keys) · see the [repo README](https://github.com/Hei33enberg/mosADD-OS#connect-your-ai-in-one-line)
|
|
160
|
+
- **mosADD** — [mosadd.com](https://mosadd.com) · [docs](https://mosadd.com/docs/quickstart)
|
|
146
161
|
- **Source** — [github.com/Hei33enberg/mosADD-OS](https://github.com/Hei33enberg/mosADD-OS) (MIT)
|
|
147
|
-
- **m.0S endpoint** — `https://mcp.mosadd.dev/mcp` with a key from [app.mosadd.dev](https://app.mosadd.dev); see the [repo README](https://github.com/Hei33enberg/mosADD-OS#start-in-5-minutes)
|
|
148
162
|
|
|
149
163
|
## License
|
|
150
164
|
|
package/dist/bin/mcp.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
+
PKG_VERSION,
|
|
4
|
+
allTools,
|
|
3
5
|
createMosaddServer
|
|
4
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-W4FAEM6N.js";
|
|
5
7
|
import {
|
|
6
8
|
isSessionExpired,
|
|
7
9
|
loadSession,
|
|
@@ -11,6 +13,77 @@ import {
|
|
|
11
13
|
// src/bin/mcp.ts
|
|
12
14
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
13
15
|
import { createClient } from "@supabase/supabase-js";
|
|
16
|
+
|
|
17
|
+
// src/cli.ts
|
|
18
|
+
function parseCli(args) {
|
|
19
|
+
const first = args[0];
|
|
20
|
+
if (args.includes("--version") || args.includes("-v") || first === "version") return { kind: "version" };
|
|
21
|
+
if (args.includes("--help") || args.includes("-h") || first === "help") return { kind: "help" };
|
|
22
|
+
if (first === "tools") return { kind: "tools" };
|
|
23
|
+
if (first === "login" || first === "logout" || first === "whoami") return { kind: "auth", sub: first, rest: args.slice(1) };
|
|
24
|
+
return { kind: "serve" };
|
|
25
|
+
}
|
|
26
|
+
function renderVersion(version) {
|
|
27
|
+
return `${version}
|
|
28
|
+
`;
|
|
29
|
+
}
|
|
30
|
+
function renderHelp(version) {
|
|
31
|
+
return [
|
|
32
|
+
`mosadd-mcp ${version} \u2014 mosADD MCP server (stdio)`,
|
|
33
|
+
``,
|
|
34
|
+
`Usage:`,
|
|
35
|
+
` npx @mosadd/mcp [command] [options]`,
|
|
36
|
+
``,
|
|
37
|
+
`Commands:`,
|
|
38
|
+
` (none) start the MCP server over stdio (what your agent runtime runs)`,
|
|
39
|
+
` login sign in and save a session on this machine`,
|
|
40
|
+
` logout delete the saved session`,
|
|
41
|
+
` whoami show which identity the saved session / MOSADD_API_KEY resolves to`,
|
|
42
|
+
` tools list every tool this server registers, grouped by module, and exit`,
|
|
43
|
+
``,
|
|
44
|
+
`Options:`,
|
|
45
|
+
` -v, --version print the version and exit`,
|
|
46
|
+
` -h, --help print this help and exit`,
|
|
47
|
+
``,
|
|
48
|
+
`Environment:`,
|
|
49
|
+
` MOSADD_API_KEY hub API key \u2014 exchanged for a short-lived session at boot (hosted mode)`,
|
|
50
|
+
` MOSADD_HUB_URL override the hub url`,
|
|
51
|
+
` MOSADD_MODE local | cloud`,
|
|
52
|
+
` MOSADD_LOG_LEVEL debug | info | warn | error (default info)`,
|
|
53
|
+
` See the README for the full list (Supabase BYOK, Resend, LiveKit).`,
|
|
54
|
+
``
|
|
55
|
+
].join("\n");
|
|
56
|
+
}
|
|
57
|
+
function moduleOf(toolName) {
|
|
58
|
+
const i = toolName.indexOf("_");
|
|
59
|
+
return i > 0 ? toolName.slice(0, i) : toolName;
|
|
60
|
+
}
|
|
61
|
+
function groupTools(tools) {
|
|
62
|
+
const by = /* @__PURE__ */ new Map();
|
|
63
|
+
for (const t of tools) {
|
|
64
|
+
const m = moduleOf(t.name);
|
|
65
|
+
by.set(m, [...by.get(m) ?? [], t]);
|
|
66
|
+
}
|
|
67
|
+
return [...by.entries()].map(([module, list]) => ({ module, tools: [...list].sort((a, b) => a.name.localeCompare(b.name)) })).sort((a, b) => b.tools.length - a.tools.length || a.module.localeCompare(b.module));
|
|
68
|
+
}
|
|
69
|
+
var oneLine = (s, max = 90) => {
|
|
70
|
+
const t = String(s ?? "").replace(/\s+/g, " ").trim();
|
|
71
|
+
const dot = t.search(/[.!?](\s|$)/);
|
|
72
|
+
const first = dot > 0 ? t.slice(0, dot + 1) : t;
|
|
73
|
+
return first.length > max ? `${first.slice(0, max - 1)}\u2026` : first;
|
|
74
|
+
};
|
|
75
|
+
function renderTools(tools) {
|
|
76
|
+
const groups = groupTools(tools);
|
|
77
|
+
const lines = [`${tools.length} tools in ${groups.length} groups`, ``];
|
|
78
|
+
for (const g of groups) {
|
|
79
|
+
lines.push(`${g.module} (${g.tools.length})`);
|
|
80
|
+
for (const t of g.tools) lines.push(` ${t.name}${t.description ? ` \u2014 ${oneLine(t.description)}` : ""}`);
|
|
81
|
+
lines.push(``);
|
|
82
|
+
}
|
|
83
|
+
return lines.join("\n");
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// src/bin/mcp.ts
|
|
14
87
|
var DEFAULT_EXCHANGE = "https://rooffhgbxafyjcwmwpsy.supabase.co/functions/v1/hub-key-exchange";
|
|
15
88
|
async function bootstrapFromApiKey() {
|
|
16
89
|
const apiKey = process.env.MOSADD_API_KEY;
|
|
@@ -69,10 +142,22 @@ async function bootstrapFromSavedSession() {
|
|
|
69
142
|
}
|
|
70
143
|
}
|
|
71
144
|
async function main() {
|
|
72
|
-
const
|
|
73
|
-
if (
|
|
145
|
+
const action = parseCli(process.argv.slice(2));
|
|
146
|
+
if (action.kind === "version") {
|
|
147
|
+
process.stdout.write(renderVersion(PKG_VERSION));
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (action.kind === "help") {
|
|
151
|
+
process.stdout.write(renderHelp(PKG_VERSION));
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (action.kind === "tools") {
|
|
155
|
+
process.stdout.write(renderTools(allTools));
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (action.kind === "auth") {
|
|
74
159
|
const { runAuthCommand } = await import("./login.js");
|
|
75
|
-
await runAuthCommand(sub,
|
|
160
|
+
await runAuthCommand(action.sub, action.rest);
|
|
76
161
|
return;
|
|
77
162
|
}
|
|
78
163
|
await bootstrapFromApiKey();
|
|
@@ -92,7 +177,7 @@ async function main() {
|
|
|
92
177
|
JSON.stringify({
|
|
93
178
|
level: "info",
|
|
94
179
|
msg: "mosadd MCP server ready",
|
|
95
|
-
version:
|
|
180
|
+
version: PKG_VERSION,
|
|
96
181
|
ts: (/* @__PURE__ */ new Date()).toISOString()
|
|
97
182
|
}) + "\n"
|
|
98
183
|
);
|
|
@@ -144,6 +144,10 @@ function formatVoiceIfAny(text) {
|
|
|
144
144
|
}
|
|
145
145
|
return text;
|
|
146
146
|
}
|
|
147
|
+
function voiceFields(m) {
|
|
148
|
+
if (m.messageType !== "voice" && m.messageType !== "ptt") return {};
|
|
149
|
+
return { voice: { transcript: m.transcript ?? null, audio_url: m.audioUrl ?? null, duration_ms: m.durationMs ?? null } };
|
|
150
|
+
}
|
|
147
151
|
|
|
148
152
|
// src/crypto/mdm-session.ts
|
|
149
153
|
import {
|
|
@@ -730,7 +734,10 @@ var SupabaseDmProvider = class {
|
|
|
730
734
|
threadId: m.thread_id,
|
|
731
735
|
messageType: m.message_type ?? void 0,
|
|
732
736
|
selfPayload: m.self_payload ?? null,
|
|
733
|
-
recipientSelfPayload: m.recipient_self_payload ?? null
|
|
737
|
+
recipientSelfPayload: m.recipient_self_payload ?? null,
|
|
738
|
+
transcript: m.transcript ?? null,
|
|
739
|
+
audioUrl: m.audio_url ?? null,
|
|
740
|
+
durationMs: m.duration_ms ?? null
|
|
734
741
|
})),
|
|
735
742
|
// history mode (`before`) returns `next_before`; incremental (`since`) returns `cursor`+`has_more`.
|
|
736
743
|
nextCursor: data?.next_before ?? (data?.has_more ? data?.cursor ?? null : null)
|
|
@@ -971,7 +978,8 @@ async function mDM_list(input, ctx) {
|
|
|
971
978
|
id: m.id,
|
|
972
979
|
sender_identity_id: m.senderId,
|
|
973
980
|
timestamp: m.timestamp,
|
|
974
|
-
thread_id: m.threadId
|
|
981
|
+
thread_id: m.threadId,
|
|
982
|
+
...voiceFields(m)
|
|
975
983
|
};
|
|
976
984
|
if (!isE2eeEnvelope(m.payload)) {
|
|
977
985
|
return { ...base, text: formatVoiceIfAny(unpackPayload(m.payload).text), encrypted: false };
|
|
@@ -2603,7 +2611,7 @@ var mtalkTools = [
|
|
|
2603
2611
|
title: "Open push-to-talk room",
|
|
2604
2612
|
annotations: { readOnlyHint: false },
|
|
2605
2613
|
requires: "any",
|
|
2606
|
-
description: "Open (or get) a push-to-talk room. Returns a stable room_id. Pass an optional label
|
|
2614
|
+
description: "Open (or get) a push-to-talk room. Returns a stable room_id. Pass an optional label for a named room (e.g. 'ops') that you own: you and your accepted contacts can join it; omit the label for a personal room. Works over network (LiveKit) or off-grid radio depending on the host.",
|
|
2607
2615
|
inputSchema: mTALK_open_input,
|
|
2608
2616
|
handler: mTALK_open
|
|
2609
2617
|
},
|
|
@@ -3958,13 +3966,10 @@ var allTools = [
|
|
|
3958
3966
|
];
|
|
3959
3967
|
var TOOL_COUNT = allTools.length;
|
|
3960
3968
|
|
|
3961
|
-
// src/server.ts
|
|
3962
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3963
|
-
|
|
3964
3969
|
// package.json
|
|
3965
3970
|
var package_default = {
|
|
3966
3971
|
name: "@mosadd/mcp",
|
|
3967
|
-
version: "3.0.0-alpha.
|
|
3972
|
+
version: "3.0.0-alpha.58",
|
|
3968
3973
|
mcpName: "io.github.hei33enberg/mosadd-mcp",
|
|
3969
3974
|
description: "Model Context Protocol server for mosadd. Exposes 4 modules (mDM, mIRC, mURL, mAYL) and capabilities (mTALK, mRAG) plus comms agent-actions \u2014 85 tools \u2014 to any agent runtime (Claude Code, Cursor, Windsurf, Cline, ChatGPT Apps, Lovable, Bolt, Goose, Manus, custom).",
|
|
3970
3975
|
homepage: "https://github.com/Hei33enberg/mosADD-OS/tree/main/packages/mcp",
|
|
@@ -4039,6 +4044,9 @@ var package_default = {
|
|
|
4039
4044
|
// src/version.ts
|
|
4040
4045
|
var PKG_VERSION = package_default.version;
|
|
4041
4046
|
|
|
4047
|
+
// src/server.ts
|
|
4048
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4049
|
+
|
|
4042
4050
|
// src/providers/supabase-voice.ts
|
|
4043
4051
|
var ROOM_PREFIX = "mosadd-room-";
|
|
4044
4052
|
var SupabaseVoiceProvider = class {
|
|
@@ -4062,7 +4070,7 @@ var SupabaseVoiceProvider = class {
|
|
|
4062
4070
|
}
|
|
4063
4071
|
async createRoom(label) {
|
|
4064
4072
|
const self = await this.selfId();
|
|
4065
|
-
const roomId =
|
|
4073
|
+
const roomId = labelRoomId(self, label);
|
|
4066
4074
|
return { roomId };
|
|
4067
4075
|
}
|
|
4068
4076
|
async joinTicket(roomId) {
|
|
@@ -4091,6 +4099,10 @@ var SupabaseVoiceProvider = class {
|
|
|
4091
4099
|
return data.snapshot;
|
|
4092
4100
|
}
|
|
4093
4101
|
};
|
|
4102
|
+
function labelRoomId(selfIdentityId, label) {
|
|
4103
|
+
if (!label) return `${ROOM_PREFIX}${selfIdentityId}`;
|
|
4104
|
+
return `${ROOM_PREFIX}${selfIdentityId}-${slug(label) || "room"}`;
|
|
4105
|
+
}
|
|
4094
4106
|
function slug(s) {
|
|
4095
4107
|
return s.toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 200);
|
|
4096
4108
|
}
|
|
@@ -4211,6 +4223,7 @@ export {
|
|
|
4211
4223
|
runWithSupabaseEnv,
|
|
4212
4224
|
allTools,
|
|
4213
4225
|
TOOL_COUNT,
|
|
4226
|
+
PKG_VERSION,
|
|
4214
4227
|
defaultProviders,
|
|
4215
4228
|
createMosaddServer
|
|
4216
4229
|
};
|
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.58",
|
|
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 — 85 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",
|
|
@@ -34,6 +34,13 @@
|
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsup src/index.ts src/bin/mcp.ts src/bin/login.ts --format esm --dts --clean --shims",
|
|
39
|
+
"dev": "tsx src/bin/mcp.ts",
|
|
40
|
+
"test": "vitest run",
|
|
41
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
42
|
+
"clean": "rm -rf dist .turbo"
|
|
43
|
+
},
|
|
37
44
|
"dependencies": {
|
|
38
45
|
"@modelcontextprotocol/sdk": "^1.0.4",
|
|
39
46
|
"@supabase/supabase-js": "^2.48.0",
|
|
@@ -62,12 +69,5 @@
|
|
|
62
69
|
],
|
|
63
70
|
"engines": {
|
|
64
71
|
"node": ">=18"
|
|
65
|
-
},
|
|
66
|
-
"scripts": {
|
|
67
|
-
"build": "tsup src/index.ts src/bin/mcp.ts src/bin/login.ts --format esm --dts --clean --shims",
|
|
68
|
-
"dev": "tsx src/bin/mcp.ts",
|
|
69
|
-
"test": "vitest run",
|
|
70
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
71
|
-
"clean": "rm -rf dist .turbo"
|
|
72
72
|
}
|
|
73
|
-
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { dirname, resolve } from "node:path";
|
|
5
|
+
import { allTools, TOOL_COUNT } from "../tools/index.js";
|
|
6
|
+
import { PKG_VERSION } from "../version.js";
|
|
7
|
+
import { groupTools, moduleOf, parseCli, renderHelp, renderTools, renderVersion } from "../cli.js";
|
|
8
|
+
|
|
9
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const pkg = JSON.parse(readFileSync(resolve(here, "../../package.json"), "utf8")) as { version: string };
|
|
11
|
+
|
|
12
|
+
describe("CLI: parseCli", () => {
|
|
13
|
+
it("--version / -v / version print and never serve", () => {
|
|
14
|
+
for (const a of [["--version"], ["-v"], ["version"], ["tools", "--version"]]) expect(parseCli(a).kind).toBe("version");
|
|
15
|
+
});
|
|
16
|
+
it("--help / -h / help print and never serve", () => {
|
|
17
|
+
for (const a of [["--help"], ["-h"], ["help"]]) expect(parseCli(a).kind).toBe("help");
|
|
18
|
+
});
|
|
19
|
+
it("tools lists, auth subcommands keep their args, no args serves", () => {
|
|
20
|
+
expect(parseCli(["tools"]).kind).toBe("tools");
|
|
21
|
+
expect(parseCli(["login", "--email", "a@b.c"])).toEqual({ kind: "auth", sub: "login", rest: ["--email", "a@b.c"] });
|
|
22
|
+
expect(parseCli(["whoami"]).kind).toBe("auth");
|
|
23
|
+
expect(parseCli([]).kind).toBe("serve");
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe("CLI: output", () => {
|
|
28
|
+
it("version comes from package.json, not a hand-typed string", () => {
|
|
29
|
+
expect(PKG_VERSION).toBe(pkg.version);
|
|
30
|
+
expect(renderVersion(PKG_VERSION)).toBe(`${pkg.version}\n`);
|
|
31
|
+
expect(renderVersion(PKG_VERSION)).not.toContain("alpha.0");
|
|
32
|
+
});
|
|
33
|
+
it("help lists the commands and MOSADD_API_KEY", () => {
|
|
34
|
+
const h = renderHelp(PKG_VERSION);
|
|
35
|
+
for (const w of ["login", "logout", "whoami", "tools", "--version", "--help", "MOSADD_API_KEY"]) expect(h).toContain(w);
|
|
36
|
+
expect(h).toContain(pkg.version);
|
|
37
|
+
});
|
|
38
|
+
it("tools prints every registered tool exactly once, grouped by module", () => {
|
|
39
|
+
const out = renderTools(allTools);
|
|
40
|
+
expect(out.startsWith(`${TOOL_COUNT} tools in `)).toBe(true);
|
|
41
|
+
for (const t of allTools) expect(out).toContain(` ${t.name}`);
|
|
42
|
+
const groups = groupTools(allTools);
|
|
43
|
+
expect(groups.reduce((n, g) => n + g.tools.length, 0)).toBe(TOOL_COUNT);
|
|
44
|
+
expect(groups.map((g) => g.module)).toContain("mDM");
|
|
45
|
+
for (const g of groups) for (const t of g.tools) expect(moduleOf(t.name)).toBe(g.module);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -12,10 +12,18 @@ import { spawn, type ChildProcessWithoutNullStreams } from "node:child_process";
|
|
|
12
12
|
import { mkdtempSync } from "node:fs";
|
|
13
13
|
import { homedir, tmpdir } from "node:os";
|
|
14
14
|
import { join } from "node:path";
|
|
15
|
-
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
15
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
16
16
|
|
|
17
17
|
const MCP_BIN = join(__dirname, "..", "..", "dist", "bin", "mcp.js");
|
|
18
18
|
|
|
19
|
+
// Every test boots a fresh node process (dist/bin/mcp.js) and waits for it on stdout. On a busy machine (this package's
|
|
20
|
+
// other test files in parallel, the other packages' suites under `pnpm -r test`, antivirus scanning node's module loads)
|
|
21
|
+
// that boot took more than 7 s on 2026-11-14: two of the three tests timed out at 5 s in each of two full runs, and
|
|
22
|
+
// passed in about 2 s each when this file ran alone, and in about 14 s each in a full run that gave them the time.
|
|
23
|
+
// The assertions are unchanged; only how long they may wait is. A server that never answers still fails.
|
|
24
|
+
const REQUEST_TIMEOUT_MS = 45_000;
|
|
25
|
+
vi.setConfig({ testTimeout: 120_000, hookTimeout: 30_000 });
|
|
26
|
+
|
|
19
27
|
/**
|
|
20
28
|
* The child server runs with an EMPTY home and no MOSADD_* variables.
|
|
21
29
|
*
|
|
@@ -91,7 +99,7 @@ class McpClient {
|
|
|
91
99
|
await new Promise<void>((resolve) => this.proc.on("close", () => resolve()));
|
|
92
100
|
}
|
|
93
101
|
|
|
94
|
-
async send(method: string, params?: unknown, timeoutMs =
|
|
102
|
+
async send(method: string, params?: unknown, timeoutMs = REQUEST_TIMEOUT_MS): Promise<JsonRpcMessage> {
|
|
95
103
|
const id = this.nextId++;
|
|
96
104
|
const req: JsonRpcMessage = { jsonrpc: "2.0", id, method, params };
|
|
97
105
|
return new Promise((resolve, reject) => {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// 15.11.2026 — pokój PTT z etykietą ma właściciela w nazwie (bramka: mosADD livekit-token/labelRoom.ts).
|
|
2
|
+
// Było `mosadd-room-<etykieta>`: jedna nazwa dla wszystkich kont, bez właściciela → 403 dla każdego,
|
|
3
|
+
// a wersja „pierwszy wchodzący zajmuje” pozwalała obcemu przejąć pokój.
|
|
4
|
+
import { describe, expect, it } from "vitest";
|
|
5
|
+
import { labelRoomId } from "../providers/supabase-voice.js";
|
|
6
|
+
|
|
7
|
+
const G = "68f326ac-3e8b-468e-9bac-328a930de541";
|
|
8
|
+
|
|
9
|
+
describe("labelRoomId", () => {
|
|
10
|
+
it("etykieta → mosadd-room-<id otwierającego>-<slug>", () => {
|
|
11
|
+
expect(labelRoomId(G, "Field Team")).toBe(`mosadd-room-${G}-field-team`);
|
|
12
|
+
});
|
|
13
|
+
it("bez etykiety → pokój osobisty (goły id, jak dotąd)", () => {
|
|
14
|
+
expect(labelRoomId(G)).toBe(`mosadd-room-${G}`);
|
|
15
|
+
});
|
|
16
|
+
it("dwa konta z tą samą etykietą dostają RÓŻNE pokoje (koniec wspólnej nazwy dla wszystkich)", () => {
|
|
17
|
+
expect(labelRoomId(G, "ops")).not.toBe(labelRoomId("1acbb607-9f66-4074-8295-17c4fb84832c", "ops"));
|
|
18
|
+
});
|
|
19
|
+
it("etykieta z samych znaków specjalnych nie robi z pokoju osobistego", () => {
|
|
20
|
+
expect(labelRoomId(G, "!!!")).toBe(`mosadd-room-${G}-room`);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -72,8 +72,12 @@ const HUB_COUNT = hubSnapshot.count;
|
|
|
72
72
|
const HELD_BACK = ["call_start", "call_status"]; // phone calls through the user's own Telnyx/Twilio account: "soon"
|
|
73
73
|
|
|
74
74
|
// Every public text that talks about the endpoint (not about the package).
|
|
75
|
+
// 2026-11-14 (README rewrite for the mosADD OS name): the hub paragraph left README.md for docs/tools.md, so the
|
|
76
|
+
// snapshot test below reads HUB_PARAGRAPH_FILE; README.md stays here, so it still may not state a hub count.
|
|
77
|
+
const HUB_PARAGRAPH_FILE = "docs/tools.md";
|
|
75
78
|
const HUB_TEXTS = [
|
|
76
79
|
"README.md",
|
|
80
|
+
HUB_PARAGRAPH_FILE,
|
|
77
81
|
"docs/hosts.md",
|
|
78
82
|
"docs/roadmap.md",
|
|
79
83
|
"skills/m0s-quickstart/SKILL.md",
|
|
@@ -114,19 +118,19 @@ describe("hub tool count (texts about https://mcp.mosadd.dev/mcp)", () => {
|
|
|
114
118
|
expect(HUB_COUNT).toBe(TOOL_COUNT + HUB_ONLY.length);
|
|
115
119
|
});
|
|
116
120
|
|
|
117
|
-
it(
|
|
118
|
-
const
|
|
119
|
-
const para =
|
|
120
|
-
expect(para,
|
|
121
|
-
for (const n of HUB_ONLY) expect(para,
|
|
121
|
+
it(`the hub paragraph (${HUB_PARAGRAPH_FILE}) points at the snapshot, names every hub-only tool and says which are held back`, () => {
|
|
122
|
+
const doc = readFileSync(resolve(repoRoot, HUB_PARAGRAPH_FILE), "utf8");
|
|
123
|
+
const para = doc.match(/[^\n]*distribution\/hub-tools\.json[^\n]*(?:\n(?!\n)[^\n]*)*/)?.[0] ?? "";
|
|
124
|
+
expect(para, `${HUB_PARAGRAPH_FILE} has no paragraph pointing at distribution/hub-tools.json`).not.toBe("");
|
|
125
|
+
for (const n of HUB_ONLY) expect(para, `${HUB_PARAGRAPH_FILE} hub paragraph does not name ${n}`).toContain(`\`${n}\``);
|
|
122
126
|
const listed = HELD_BACK.filter((n) => hubSnapshot.names.includes(n));
|
|
123
127
|
if (listed.length === 0) {
|
|
124
|
-
// calls are not open: the
|
|
128
|
+
// calls are not open: the hub paragraph must say so, and name the tools it holds back
|
|
125
129
|
expect(para).toMatch(/coming soon/);
|
|
126
130
|
expect(para).toMatch(/held back/);
|
|
127
|
-
for (const n of HELD_BACK) expect(para,
|
|
131
|
+
for (const n of HELD_BACK) expect(para, `${HUB_PARAGRAPH_FILE} does not name the held-back ${n}`).toContain(`\`${n}\``);
|
|
128
132
|
} else {
|
|
129
|
-
expect(para, `the hub lists ${listed.join(", ")} now —
|
|
133
|
+
expect(para, `the hub lists ${listed.join(", ")} now — ${HUB_PARAGRAPH_FILE} still says they are held back`).not.toMatch(/held back/);
|
|
130
134
|
}
|
|
131
135
|
});
|
|
132
136
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// 15.11.2026 — odbiorca głosówki przez MCP widział sam podpis. message-list (mosADD) oddaje już
|
|
2
|
+
// transcript / audio_url / duration_ms; mDM_list ma je przekazać w polu `voice`.
|
|
3
|
+
import { readFileSync } from "node:fs";
|
|
4
|
+
import { describe, expect, it } from "vitest";
|
|
5
|
+
import { voiceFields } from "../tools/voice-format.js";
|
|
6
|
+
|
|
7
|
+
describe("voiceFields", () => {
|
|
8
|
+
it("głosówka z transkryptem i adresem → pole voice", () => {
|
|
9
|
+
expect(voiceFields({ messageType: "voice", transcript: "raz dwa", audioUrl: "https://x/a.ogg", durationMs: 4500 }))
|
|
10
|
+
.toEqual({ voice: { transcript: "raz dwa", audio_url: "https://x/a.ogg", duration_ms: 4500 } });
|
|
11
|
+
});
|
|
12
|
+
it("tekst → brak pola voice", () => {
|
|
13
|
+
expect(voiceFields({ messageType: "text" })).toEqual({});
|
|
14
|
+
});
|
|
15
|
+
it("głosówka bez transkryptu → null, nie znika", () => {
|
|
16
|
+
expect(voiceFields({ messageType: "ptt" })).toEqual({ voice: { transcript: null, audio_url: null, duration_ms: null } });
|
|
17
|
+
});
|
|
18
|
+
it("provider i mDM_list przenoszą pola z message-list", () => {
|
|
19
|
+
const prov = readFileSync(new URL("../providers/supabase-dm.ts", import.meta.url), "utf8");
|
|
20
|
+
const tool = readFileSync(new URL("../tools/mdm.ts", import.meta.url), "utf8");
|
|
21
|
+
expect(prov).toContain("transcript: m.transcript ?? null");
|
|
22
|
+
expect(tool).toContain("...voiceFields(m)");
|
|
23
|
+
});
|
|
24
|
+
});
|
package/src/bin/mcp.ts
CHANGED
|
@@ -13,6 +13,9 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
13
13
|
import { createClient } from "@supabase/supabase-js";
|
|
14
14
|
import { createMosaddServer } from "../server.js";
|
|
15
15
|
import { loadSession, saveSession, isSessionExpired } from "../config.js";
|
|
16
|
+
import { allTools } from "../tools/index.js";
|
|
17
|
+
import { PKG_VERSION } from "../version.js";
|
|
18
|
+
import { parseCli, renderHelp, renderTools, renderVersion } from "../cli.js";
|
|
16
19
|
|
|
17
20
|
const DEFAULT_EXCHANGE =
|
|
18
21
|
"https://rooffhgbxafyjcwmwpsy.supabase.co/functions/v1/hub-key-exchange";
|
|
@@ -95,11 +98,25 @@ async function bootstrapFromSavedSession(): Promise<void> {
|
|
|
95
98
|
}
|
|
96
99
|
|
|
97
100
|
async function main(): Promise<void> {
|
|
98
|
-
//
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
// CLI: `--version`, `--help`, `tools` print and exit (they must NEVER start the stdio server — a bare
|
|
102
|
+
// `npx @mosadd/mcp --version` used to hang waiting for an MCP client). Auth subcommands: login | logout | whoami.
|
|
103
|
+
// Everything else starts the server.
|
|
104
|
+
const action = parseCli(process.argv.slice(2));
|
|
105
|
+
if (action.kind === "version") {
|
|
106
|
+
process.stdout.write(renderVersion(PKG_VERSION));
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (action.kind === "help") {
|
|
110
|
+
process.stdout.write(renderHelp(PKG_VERSION));
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (action.kind === "tools") {
|
|
114
|
+
process.stdout.write(renderTools(allTools));
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (action.kind === "auth") {
|
|
101
118
|
const { runAuthCommand } = await import("./login.js");
|
|
102
|
-
await runAuthCommand(sub,
|
|
119
|
+
await runAuthCommand(action.sub, action.rest);
|
|
103
120
|
return;
|
|
104
121
|
}
|
|
105
122
|
|
|
@@ -126,7 +143,7 @@ async function main(): Promise<void> {
|
|
|
126
143
|
JSON.stringify({
|
|
127
144
|
level: "info",
|
|
128
145
|
msg: "mosadd MCP server ready",
|
|
129
|
-
version:
|
|
146
|
+
version: PKG_VERSION,
|
|
130
147
|
ts: new Date().toISOString(),
|
|
131
148
|
}) + "\n",
|
|
132
149
|
);
|
package/src/cli.ts
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI front of `npx @mosadd/mcp` — the parts that print and exit instead of starting the stdio server.
|
|
3
|
+
*
|
|
4
|
+
* --version / -v print the package.json version and exit
|
|
5
|
+
* --help / -h print commands + env vars and exit
|
|
6
|
+
* tools print every registered tool, grouped by module, and exit
|
|
7
|
+
*
|
|
8
|
+
* Pure functions on purpose (no process.exit, no I/O): bin/mcp.ts decides what to do with the result,
|
|
9
|
+
* and the tests call these directly. The version comes from ./version.js (= package.json), never typed here.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export interface CliTool {
|
|
13
|
+
name: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type CliAction =
|
|
18
|
+
| { kind: "version" }
|
|
19
|
+
| { kind: "help" }
|
|
20
|
+
| { kind: "tools" }
|
|
21
|
+
| { kind: "auth"; sub: "login" | "logout" | "whoami"; rest: string[] }
|
|
22
|
+
| { kind: "serve" };
|
|
23
|
+
|
|
24
|
+
/** Decide what `argv` (process.argv.slice(2)) asks for. Flags win over subcommands; anything unknown starts the server. */
|
|
25
|
+
export function parseCli(args: readonly string[]): CliAction {
|
|
26
|
+
const first = args[0];
|
|
27
|
+
if (args.includes("--version") || args.includes("-v") || first === "version") return { kind: "version" };
|
|
28
|
+
if (args.includes("--help") || args.includes("-h") || first === "help") return { kind: "help" };
|
|
29
|
+
if (first === "tools") return { kind: "tools" };
|
|
30
|
+
if (first === "login" || first === "logout" || first === "whoami") return { kind: "auth", sub: first, rest: args.slice(1) };
|
|
31
|
+
return { kind: "serve" };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function renderVersion(version: string): string {
|
|
35
|
+
return `${version}\n`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function renderHelp(version: string): string {
|
|
39
|
+
return [
|
|
40
|
+
`mosadd-mcp ${version} — mosADD MCP server (stdio)`,
|
|
41
|
+
``,
|
|
42
|
+
`Usage:`,
|
|
43
|
+
` npx @mosadd/mcp [command] [options]`,
|
|
44
|
+
``,
|
|
45
|
+
`Commands:`,
|
|
46
|
+
` (none) start the MCP server over stdio (what your agent runtime runs)`,
|
|
47
|
+
` login sign in and save a session on this machine`,
|
|
48
|
+
` logout delete the saved session`,
|
|
49
|
+
` whoami show which identity the saved session / MOSADD_API_KEY resolves to`,
|
|
50
|
+
` tools list every tool this server registers, grouped by module, and exit`,
|
|
51
|
+
``,
|
|
52
|
+
`Options:`,
|
|
53
|
+
` -v, --version print the version and exit`,
|
|
54
|
+
` -h, --help print this help and exit`,
|
|
55
|
+
``,
|
|
56
|
+
`Environment:`,
|
|
57
|
+
` MOSADD_API_KEY hub API key — exchanged for a short-lived session at boot (hosted mode)`,
|
|
58
|
+
` MOSADD_HUB_URL override the hub url`,
|
|
59
|
+
` MOSADD_MODE local | cloud`,
|
|
60
|
+
` MOSADD_LOG_LEVEL debug | info | warn | error (default info)`,
|
|
61
|
+
` See the README for the full list (Supabase BYOK, Resend, LiveKit).`,
|
|
62
|
+
``,
|
|
63
|
+
].join("\n");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Module a tool belongs to: the part of the name before the first underscore (mDM_send -> mDM). */
|
|
67
|
+
export function moduleOf(toolName: string): string {
|
|
68
|
+
const i = toolName.indexOf("_");
|
|
69
|
+
return i > 0 ? toolName.slice(0, i) : toolName;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Tools grouped by module, groups ordered by size (largest first, then name), tools alphabetical inside a group. */
|
|
73
|
+
export function groupTools(tools: readonly CliTool[]): { module: string; tools: CliTool[] }[] {
|
|
74
|
+
const by = new Map<string, CliTool[]>();
|
|
75
|
+
for (const t of tools) {
|
|
76
|
+
const m = moduleOf(t.name);
|
|
77
|
+
by.set(m, [...(by.get(m) ?? []), t]);
|
|
78
|
+
}
|
|
79
|
+
return [...by.entries()]
|
|
80
|
+
.map(([module, list]) => ({ module, tools: [...list].sort((a, b) => a.name.localeCompare(b.name)) }))
|
|
81
|
+
.sort((a, b) => b.tools.length - a.tools.length || a.module.localeCompare(b.module));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const oneLine = (s: string | undefined, max = 90): string => {
|
|
85
|
+
const t = String(s ?? "").replace(/\s+/g, " ").trim();
|
|
86
|
+
const dot = t.search(/[.!?](\s|$)/);
|
|
87
|
+
const first = dot > 0 ? t.slice(0, dot + 1) : t;
|
|
88
|
+
return first.length > max ? `${first.slice(0, max - 1)}…` : first;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export function renderTools(tools: readonly CliTool[]): string {
|
|
92
|
+
const groups = groupTools(tools);
|
|
93
|
+
const lines: string[] = [`${tools.length} tools in ${groups.length} groups`, ``];
|
|
94
|
+
for (const g of groups) {
|
|
95
|
+
lines.push(`${g.module} (${g.tools.length})`);
|
|
96
|
+
for (const t of g.tools) lines.push(` ${t.name}${t.description ? ` — ${oneLine(t.description)}` : ""}`);
|
|
97
|
+
lines.push(``);
|
|
98
|
+
}
|
|
99
|
+
return lines.join("\n");
|
|
100
|
+
}
|
|
@@ -62,6 +62,10 @@ export interface DmMessageExt extends DmMessage {
|
|
|
62
62
|
selfPayload?: string | null;
|
|
63
63
|
recipientSelfPayload?: string | null;
|
|
64
64
|
messageType?: string;
|
|
65
|
+
/** 15.11: z message-list dla voice/ptt (voiceEnrich.ts w mosADD). */
|
|
66
|
+
transcript?: string | null;
|
|
67
|
+
audioUrl?: string | null;
|
|
68
|
+
durationMs?: number | null;
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
export class SupabaseDmProvider implements DmProvider {
|
|
@@ -171,6 +175,9 @@ export class SupabaseDmProvider implements DmProvider {
|
|
|
171
175
|
message_type?: string | null;
|
|
172
176
|
self_payload?: string | null;
|
|
173
177
|
recipient_self_payload?: string | null;
|
|
178
|
+
transcript?: string | null;
|
|
179
|
+
audio_url?: string | null;
|
|
180
|
+
duration_ms?: number | null;
|
|
174
181
|
}>;
|
|
175
182
|
cursor?: string | null;
|
|
176
183
|
has_more?: boolean;
|
|
@@ -194,6 +201,9 @@ export class SupabaseDmProvider implements DmProvider {
|
|
|
194
201
|
messageType: m.message_type ?? undefined,
|
|
195
202
|
selfPayload: m.self_payload ?? null,
|
|
196
203
|
recipientSelfPayload: m.recipient_self_payload ?? null,
|
|
204
|
+
transcript: m.transcript ?? null,
|
|
205
|
+
audioUrl: m.audio_url ?? null,
|
|
206
|
+
durationMs: m.duration_ms ?? null,
|
|
197
207
|
})),
|
|
198
208
|
// history mode (`before`) returns `next_before`; incremental (`since`) returns `cursor`+`has_more`.
|
|
199
209
|
nextCursor: data?.next_before ?? (data?.has_more ? (data?.cursor ?? null) : null),
|
|
@@ -45,7 +45,7 @@ export class SupabaseVoiceProvider implements VoiceProvider {
|
|
|
45
45
|
|
|
46
46
|
async createRoom(label?: string): Promise<{ roomId: string }> {
|
|
47
47
|
const self = await this.selfId();
|
|
48
|
-
const roomId =
|
|
48
|
+
const roomId = labelRoomId(self, label);
|
|
49
49
|
// Floor row is created lazily by mtalk-floor on first request; nothing to do
|
|
50
50
|
// here beyond returning the canonical id.
|
|
51
51
|
return { roomId };
|
|
@@ -82,6 +82,18 @@ export class SupabaseVoiceProvider implements VoiceProvider {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* 15.11.2026 — nazwa pokoju PTT. Bez etykiety: pokój osobisty `mosadd-room-<id>`. Z etykietą:
|
|
87
|
+
* `mosadd-room-<id otwierającego>-<etykieta>` — właściciel jest w nazwie, więc bramka
|
|
88
|
+
* (mosADD `livekit-token/labelRoom.ts`) wpuszcza właściciela i jego kontakty, a obcy nie przejmie
|
|
89
|
+
* pokoju wejściem jako pierwszy. Dawne `mosadd-room-<etykieta>` było jedną nazwą dla wszystkich
|
|
90
|
+
* kont bez właściciela → 403 dla każdego.
|
|
91
|
+
*/
|
|
92
|
+
export function labelRoomId(selfIdentityId: string, label?: string): string {
|
|
93
|
+
if (!label) return `${ROOM_PREFIX}${selfIdentityId}`;
|
|
94
|
+
return `${ROOM_PREFIX}${selfIdentityId}-${slug(label) || "room"}`;
|
|
95
|
+
}
|
|
96
|
+
|
|
85
97
|
function slug(s: string): string {
|
|
86
98
|
return s
|
|
87
99
|
.toLowerCase()
|
package/src/tools/mdm.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { z } from "zod";
|
|
18
18
|
import type { MosaddTool, MosaddToolContext } from "../types.js";
|
|
19
|
-
import { formatVoiceIfAny } from "./voice-format.js";
|
|
19
|
+
import { formatVoiceIfAny, voiceFields } from "./voice-format.js";
|
|
20
20
|
import { invokeFunction, getSupabase, readSupabaseEnv } from "../providers/supabase.js";
|
|
21
21
|
import {
|
|
22
22
|
encryptForPeer,
|
|
@@ -402,6 +402,7 @@ async function mDM_list(
|
|
|
402
402
|
timestamp: string;
|
|
403
403
|
thread_id: string;
|
|
404
404
|
encrypted: boolean;
|
|
405
|
+
voice?: { transcript: string | null; audio_url: string | null; duration_ms: number | null };
|
|
405
406
|
}>;
|
|
406
407
|
next_cursor: string | null;
|
|
407
408
|
threads: string[];
|
|
@@ -434,6 +435,7 @@ async function mDM_list(
|
|
|
434
435
|
sender_identity_id: m.senderId,
|
|
435
436
|
timestamp: m.timestamp,
|
|
436
437
|
thread_id: m.threadId,
|
|
438
|
+
...voiceFields(m),
|
|
437
439
|
};
|
|
438
440
|
// Legacy plaintext envelope (deprecated path) — unpack directly.
|
|
439
441
|
if (!isE2eeEnvelope(m.payload)) {
|
package/src/tools/mtalk.ts
CHANGED
|
@@ -84,7 +84,7 @@ export const mtalkTools: MosaddTool[] = [
|
|
|
84
84
|
annotations: { readOnlyHint: false },
|
|
85
85
|
requires: "any",
|
|
86
86
|
description:
|
|
87
|
-
"Open (or get) a push-to-talk room. Returns a stable room_id. Pass an optional label
|
|
87
|
+
"Open (or get) a push-to-talk room. Returns a stable room_id. Pass an optional label for a named room (e.g. 'ops') that you own: you and your accepted contacts can join it; omit the label for a personal room. Works over network (LiveKit) or off-grid radio depending on the host.",
|
|
88
88
|
inputSchema: mTALK_open_input,
|
|
89
89
|
handler: mTALK_open as MosaddTool["handler"],
|
|
90
90
|
},
|
|
@@ -26,3 +26,18 @@ export function formatVoiceIfAny(text: string): string {
|
|
|
26
26
|
}
|
|
27
27
|
return text;
|
|
28
28
|
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 15.11.2026 — głosówka niesie transkrypt i adres nagrania. message-list (mosADD) dokłada do
|
|
32
|
+
* wiadomości voice/ptt pola transcript / audio_url / duration_ms (RLS czytającego); tu
|
|
33
|
+
* przekazujemy je odbiorcy jako `voice`. Wcześniej agent widział sam podpis.
|
|
34
|
+
*/
|
|
35
|
+
export function voiceFields(m: {
|
|
36
|
+
messageType?: string;
|
|
37
|
+
transcript?: string | null;
|
|
38
|
+
audioUrl?: string | null;
|
|
39
|
+
durationMs?: number | null;
|
|
40
|
+
}): { voice?: { transcript: string | null; audio_url: string | null; duration_ms: number | null } } {
|
|
41
|
+
if (m.messageType !== "voice" && m.messageType !== "ptt") return {};
|
|
42
|
+
return { voice: { transcript: m.transcript ?? null, audio_url: m.audioUrl ?? null, duration_ms: m.durationMs ?? null } };
|
|
43
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 m.0S / mosADD contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|