@mosadd/mcp 3.0.0-alpha.55 → 3.0.0-alpha.56

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 (53) hide show
  1. package/CHANGELOG.md +5 -11
  2. package/LICENSE +21 -0
  3. package/README.md +151 -150
  4. package/dist/bin/mcp.js +1 -1
  5. package/dist/{chunk-IWUGKLDX.js → chunk-T3KDVUAT.js} +14 -10
  6. package/dist/index.js +1 -1
  7. package/package.json +10 -10
  8. package/src/__tests__/blob-upload.test.ts +93 -93
  9. package/src/__tests__/channel-e2ee.test.ts +62 -62
  10. package/src/__tests__/flota-jawnie.test.ts +2 -2
  11. package/src/__tests__/golden-path.test.ts +139 -139
  12. package/src/__tests__/integration.test.ts +209 -182
  13. package/src/__tests__/mdm-e2ee.test.ts +212 -212
  14. package/src/__tests__/mdm-mcp-readable.test.ts +390 -390
  15. package/src/__tests__/mirc-invite.test.ts +112 -112
  16. package/src/__tests__/mtalk.test.ts +122 -122
  17. package/src/__tests__/presence.test.ts +199 -199
  18. package/src/__tests__/server.test.ts +71 -71
  19. package/src/__tests__/tool-count-consistency.test.ts +255 -199
  20. package/src/bin/login.ts +138 -138
  21. package/src/bin/mcp.ts +145 -145
  22. package/src/config.ts +66 -66
  23. package/src/crypto/channel-e2ee.ts +288 -288
  24. package/src/crypto/mdm-session.ts +842 -842
  25. package/src/index.ts +19 -19
  26. package/src/observability/sentry.ts +79 -79
  27. package/src/providers/blob-upload.ts +162 -162
  28. package/src/providers/memory-voice.ts +79 -79
  29. package/src/providers/supabase-dm.ts +202 -202
  30. package/src/providers/supabase-voice.ts +91 -91
  31. package/src/server.ts +195 -195
  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/channel-payload.ts +2 -2
  36. package/src/tools/embed.ts +110 -110
  37. package/src/tools/index.ts +181 -181
  38. package/src/tools/knowledge.ts +344 -344
  39. package/src/tools/mail-aliases.ts +25 -25
  40. package/src/tools/mail-provenance.ts +137 -137
  41. package/src/tools/mail.ts +403 -403
  42. package/src/tools/mdm-as-agent.ts +138 -126
  43. package/src/tools/mdm.ts +3 -3
  44. package/src/tools/mirc-edge.ts +196 -196
  45. package/src/tools/mirc-members.ts +287 -287
  46. package/src/tools/mirc-messages.ts +1 -1
  47. package/src/tools/mirc.ts +308 -308
  48. package/src/tools/mroom.ts +221 -221
  49. package/src/tools/mtalk.ts +131 -131
  50. package/src/tools/presence.ts +442 -442
  51. package/src/tools/voice-format.ts +28 -28
  52. package/src/types.ts +121 -121
  53. package/src/voice/floor.ts +132 -132
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
+ }