@mosadd/mcp 3.0.0-alpha.52 → 3.0.0-alpha.54

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 (58) hide show
  1. package/CHANGELOG.md +363 -309
  2. package/README.md +150 -150
  3. package/dist/bin/mcp.js +1 -1
  4. package/dist/{chunk-KVN7LZFW.js → chunk-3PUOM4R5.js} +470 -112
  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__/golden-path.test.ts +139 -139
  9. package/src/__tests__/integration.test.ts +182 -182
  10. package/src/__tests__/knowledge-ingest.test.ts +114 -114
  11. package/src/__tests__/mdm-e2ee.test.ts +212 -212
  12. package/src/__tests__/mdm-mcp-readable.test.ts +386 -0
  13. package/src/__tests__/mirc-invite.test.ts +112 -112
  14. package/src/__tests__/mtalk.test.ts +122 -122
  15. package/src/__tests__/server.test.ts +71 -71
  16. package/src/__tests__/serverJsonVersion.test.ts +45 -45
  17. package/src/__tests__/tool-count-consistency.test.ts +199 -199
  18. package/src/bin/login.ts +138 -138
  19. package/src/bin/mcp.ts +145 -145
  20. package/src/config.ts +66 -66
  21. package/src/crypto/mdm-session.ts +842 -502
  22. package/src/index.ts +19 -19
  23. package/src/observability/sentry.ts +79 -79
  24. package/src/providers/memory-voice.ts +79 -79
  25. package/src/providers/supabase-dm.ts +202 -122
  26. package/src/providers/supabase-voice.ts +91 -91
  27. package/src/providers/supabase.ts +231 -231
  28. package/src/server.ts +195 -162
  29. package/src/tools/__tests__/ragDeleteFoldsSourceId.test.ts +67 -67
  30. package/src/tools/actions.ts +166 -166
  31. package/src/tools/attachments.ts +276 -276
  32. package/src/tools/capabilities.ts +70 -70
  33. package/src/tools/embed.ts +110 -110
  34. package/src/tools/index.ts +181 -181
  35. package/src/tools/knowledge-graph.ts +186 -186
  36. package/src/tools/knowledge.ts +344 -344
  37. package/src/tools/mail-agentbox.ts +155 -155
  38. package/src/tools/mail-aliases.ts +25 -25
  39. package/src/tools/mail-provenance.ts +137 -137
  40. package/src/tools/mail.ts +403 -403
  41. package/src/tools/mcall.ts +216 -216
  42. package/src/tools/mdm-as-agent.ts +126 -126
  43. package/src/tools/mdm-voice.ts +220 -220
  44. package/src/tools/mdm.ts +211 -29
  45. package/src/tools/mirc-edge.ts +196 -196
  46. package/src/tools/mirc-members.ts +287 -287
  47. package/src/tools/mirc.ts +308 -308
  48. package/src/tools/mroom-messages.ts +142 -142
  49. package/src/tools/mroom.ts +221 -221
  50. package/src/tools/mtalk.ts +131 -131
  51. package/src/tools/murl.ts +314 -314
  52. package/src/tools/presence.ts +442 -442
  53. package/src/tools/ptt-ingest.ts +99 -99
  54. package/src/tools/threat.ts +123 -123
  55. package/src/types.ts +121 -121
  56. package/src/version.ts +8 -8
  57. package/src/voice/floor.ts +132 -132
  58. 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
+ }