@mosadd/mcp 3.0.0-alpha.51 → 3.0.0-alpha.53

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +334 -309
  2. package/README.md +150 -150
  3. package/dist/bin/mcp.js +1 -1
  4. package/dist/{chunk-BTAIZKYT.js → chunk-AWKITPZQ.js} +407 -106
  5. package/dist/index.d.ts +11 -1
  6. package/dist/index.js +1 -1
  7. package/package.json +9 -9
  8. package/src/__tests__/blob-upload.test.ts +93 -0
  9. package/src/__tests__/golden-path.test.ts +139 -139
  10. package/src/__tests__/integration.test.ts +182 -182
  11. package/src/__tests__/knowledge-ingest.test.ts +114 -114
  12. package/src/__tests__/mdm-e2ee.test.ts +212 -212
  13. package/src/__tests__/mdm-mcp-readable.test.ts +284 -0
  14. package/src/__tests__/mirc-invite.test.ts +112 -112
  15. package/src/__tests__/mtalk.test.ts +122 -122
  16. package/src/__tests__/server.test.ts +71 -71
  17. package/src/__tests__/serverJsonVersion.test.ts +45 -45
  18. package/src/__tests__/tool-count-consistency.test.ts +199 -199
  19. package/src/bin/login.ts +138 -138
  20. package/src/bin/mcp.ts +145 -145
  21. package/src/config.ts +66 -66
  22. package/src/crypto/mdm-session.ts +798 -502
  23. package/src/index.ts +19 -19
  24. package/src/observability/sentry.ts +79 -79
  25. package/src/providers/blob-upload.ts +52 -6
  26. package/src/providers/memory-voice.ts +79 -79
  27. package/src/providers/supabase-dm.ts +174 -122
  28. package/src/providers/supabase-voice.ts +91 -91
  29. package/src/providers/supabase.ts +231 -231
  30. package/src/server.ts +186 -162
  31. package/src/tools/__tests__/ragDeleteFoldsSourceId.test.ts +67 -67
  32. package/src/tools/actions.ts +166 -166
  33. package/src/tools/attachments.ts +276 -276
  34. package/src/tools/capabilities.ts +70 -70
  35. package/src/tools/embed.ts +110 -110
  36. package/src/tools/index.ts +181 -181
  37. package/src/tools/knowledge-graph.ts +186 -186
  38. package/src/tools/knowledge.ts +344 -344
  39. package/src/tools/mail-agentbox.ts +155 -155
  40. package/src/tools/mail-aliases.ts +25 -25
  41. package/src/tools/mail-provenance.ts +137 -137
  42. package/src/tools/mail.ts +403 -403
  43. package/src/tools/mcall.ts +216 -216
  44. package/src/tools/mdm-as-agent.ts +126 -126
  45. package/src/tools/mdm-voice.ts +220 -220
  46. package/src/tools/mdm.ts +119 -17
  47. package/src/tools/mirc-edge.ts +196 -196
  48. package/src/tools/mirc-members.ts +287 -287
  49. package/src/tools/mirc.ts +308 -308
  50. package/src/tools/mroom-messages.ts +142 -142
  51. package/src/tools/mroom.ts +221 -221
  52. package/src/tools/mtalk.ts +131 -131
  53. package/src/tools/murl.ts +314 -314
  54. package/src/tools/presence.ts +442 -442
  55. package/src/tools/ptt-ingest.ts +99 -99
  56. package/src/tools/threat.ts +123 -123
  57. package/src/types.ts +121 -121
  58. package/src/version.ts +8 -8
  59. package/src/voice/floor.ts +132 -132
  60. package/LICENSE +0 -201
package/src/config.ts CHANGED
@@ -1,66 +1,66 @@
1
- /**
2
- * Local session config for the mosadd CLI (`mosadd login`).
3
- *
4
- * Stores the authenticated session at `~/.mosadd/session.json` so the MCP
5
- * server can pick up credentials without the user pasting an expiring JWT
6
- * from mosadd.com DevTools into env vars. Env vars still take precedence.
7
- *
8
- * The file holds a Supabase session (BYOK): the project URL + anon key (both
9
- * public, RLS-gated) and the user's access/refresh tokens.
10
- */
11
-
12
- import { homedir } from "node:os";
13
- import { join } from "node:path";
14
- import { mkdirSync, readFileSync, writeFileSync, rmSync, existsSync, chmodSync } from "node:fs";
15
-
16
- export interface MosaddSession {
17
- url: string;
18
- anonKey: string;
19
- accessToken: string;
20
- refreshToken?: string;
21
- /** Unix seconds when the access token expires. */
22
- expiresAt?: number;
23
- email?: string;
24
- }
25
-
26
- export function configDir(): string {
27
- return join(homedir(), ".mosadd");
28
- }
29
-
30
- export function sessionPath(): string {
31
- return join(configDir(), "session.json");
32
- }
33
-
34
- export function loadSession(): MosaddSession | null {
35
- try {
36
- const raw = readFileSync(sessionPath(), "utf8");
37
- const s = JSON.parse(raw) as MosaddSession;
38
- if (s && typeof s.url === "string" && typeof s.anonKey === "string") return s;
39
- return null;
40
- } catch {
41
- return null;
42
- }
43
- }
44
-
45
- export function saveSession(session: MosaddSession): void {
46
- mkdirSync(configDir(), { recursive: true });
47
- writeFileSync(sessionPath(), JSON.stringify(session, null, 2), "utf8");
48
- // Best-effort tighten perms (no-op on platforms that ignore it).
49
- try {
50
- chmodSync(sessionPath(), 0o600);
51
- } catch {
52
- /* ignore */
53
- }
54
- }
55
-
56
- export function clearSession(): boolean {
57
- if (!existsSync(sessionPath())) return false;
58
- rmSync(sessionPath());
59
- return true;
60
- }
61
-
62
- /** True if the stored token is past (or within 30s of) its expiry. */
63
- export function isSessionExpired(session: MosaddSession): boolean {
64
- if (!session.expiresAt) return false;
65
- return Date.now() / 1000 >= session.expiresAt - 30;
66
- }
1
+ /**
2
+ * Local session config for the mosadd CLI (`mosadd login`).
3
+ *
4
+ * Stores the authenticated session at `~/.mosadd/session.json` so the MCP
5
+ * server can pick up credentials without the user pasting an expiring JWT
6
+ * from mosadd.com DevTools into env vars. Env vars still take precedence.
7
+ *
8
+ * The file holds a Supabase session (BYOK): the project URL + anon key (both
9
+ * public, RLS-gated) and the user's access/refresh tokens.
10
+ */
11
+
12
+ import { homedir } from "node:os";
13
+ import { join } from "node:path";
14
+ import { mkdirSync, readFileSync, writeFileSync, rmSync, existsSync, chmodSync } from "node:fs";
15
+
16
+ export interface MosaddSession {
17
+ url: string;
18
+ anonKey: string;
19
+ accessToken: string;
20
+ refreshToken?: string;
21
+ /** Unix seconds when the access token expires. */
22
+ expiresAt?: number;
23
+ email?: string;
24
+ }
25
+
26
+ export function configDir(): string {
27
+ return join(homedir(), ".mosadd");
28
+ }
29
+
30
+ export function sessionPath(): string {
31
+ return join(configDir(), "session.json");
32
+ }
33
+
34
+ export function loadSession(): MosaddSession | null {
35
+ try {
36
+ const raw = readFileSync(sessionPath(), "utf8");
37
+ const s = JSON.parse(raw) as MosaddSession;
38
+ if (s && typeof s.url === "string" && typeof s.anonKey === "string") return s;
39
+ return null;
40
+ } catch {
41
+ return null;
42
+ }
43
+ }
44
+
45
+ export function saveSession(session: MosaddSession): void {
46
+ mkdirSync(configDir(), { recursive: true });
47
+ writeFileSync(sessionPath(), JSON.stringify(session, null, 2), "utf8");
48
+ // Best-effort tighten perms (no-op on platforms that ignore it).
49
+ try {
50
+ chmodSync(sessionPath(), 0o600);
51
+ } catch {
52
+ /* ignore */
53
+ }
54
+ }
55
+
56
+ export function clearSession(): boolean {
57
+ if (!existsSync(sessionPath())) return false;
58
+ rmSync(sessionPath());
59
+ return true;
60
+ }
61
+
62
+ /** True if the stored token is past (or within 30s of) its expiry. */
63
+ export function isSessionExpired(session: MosaddSession): boolean {
64
+ if (!session.expiresAt) return false;
65
+ return Date.now() / 1000 >= session.expiresAt - 30;
66
+ }