@mosadd/mcp 3.0.0-alpha.2 → 3.0.0-alpha.4

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/README.md CHANGED
@@ -1,116 +1,116 @@
1
- # @mosadd/mcp
2
-
3
- MCP server for [mosadd](https://mosadd.dev) — exposes the OS modules (m\*) as Model Context Protocol tools so any agent runtime can talk to mosadd: Claude Code, Cursor, Windsurf, Cline, ChatGPT Apps, Lovable, Bolt, Goose, Manus, custom.
4
-
5
- > **3.0.0-alpha** — `mDM` only, wired to the m0ssad-3 Supabase backend as a strangler-fig step. Phase 1 full will add mTALK / mAIL / mCALL / mIRC / mIRL / mROOM + bridges. Phase 2 routes through the hosted gateway at `mcp.mosadd.com` with the 167-event radar in front.
6
-
7
- ## Install
8
-
9
- ### Claude Code
10
-
11
- ```bash
12
- claude mcp add mosadd npx -- -y @mosadd/mcp
13
- ```
14
-
15
- ### Cursor
16
-
17
- `~/.cursor/mcp.json`:
18
-
19
- ```json
20
- {
21
- "mcpServers": {
22
- "mosadd": {
23
- "command": "npx",
24
- "args": ["-y", "@mosadd/mcp"],
25
- "env": {
26
- "MOSADD_SUPABASE_URL": "https://<your-project>.supabase.co",
27
- "MOSADD_SUPABASE_ANON_KEY": "<anon key>",
28
- "MOSADD_USER_JWT": "<your session JWT>"
29
- }
30
- }
31
- }
32
- }
33
- ```
34
-
35
- ### Standalone
36
-
37
- ```bash
38
- MOSADD_SUPABASE_URL=... MOSADD_SUPABASE_ANON_KEY=... MOSADD_USER_JWT=... npx @mosadd/mcp
39
- ```
40
-
41
- ## BYOK — get your env values
42
-
43
- While the hosted gateway is in development, the alpha runs in **local BYOK mode** — you supply your own Supabase credentials to talk to your own m0ssad-3 backend.
44
-
45
- - `MOSADD_SUPABASE_URL` — your Supabase project URL (e.g. `https://abc.supabase.co`)
46
- - `MOSADD_SUPABASE_ANON_KEY` — the public anon key from project settings
47
- - `MOSADD_USER_JWT` — a Supabase session token for your mosadd user. Get it from the browser:
48
- 1. Sign in to mosadd.com
49
- 2. Open DevTools → Application → Local Storage → `sb-<ref>-auth-token`
50
- 3. Copy the `access_token` field
51
-
52
- In Phase 2, run `mosadd login` to OAuth into hub.mosadd.com — no JWT-juggling required.
53
-
54
- ## Tools shipped in alpha
55
-
56
- | Tool | Description |
57
- |---|---|
58
- | `mDM_list_contacts` | List your mosadd contacts (returns `identity_id` to use elsewhere) |
59
- | `mDM_send` | Send a DM. `{ to: identity_id, text, thread_label?, reply_to_id? }` |
60
- | `mDM_list` | Read DM thread |
61
- | `mDM_respond_request` | Accept/reject incoming DM request |
62
-
63
- All tool names follow [RFC 0001](https://github.com/Hei33enberg/mosadd-os/blob/main/docs/rfcs/0001-module-naming.md) — `m<MODULE>_<operation>` snake_case.
64
-
65
- ## Try it (60-second demo)
66
-
67
- In Claude Code with env vars set:
68
-
69
- > List my mosadd contacts.
70
-
71
- Claude calls `mDM_list_contacts` → you see your contact list.
72
-
73
- > Send "hello from Claude" to <id> with thread label `notes`.
74
-
75
- Claude calls `mDM_send({ to, text, thread_label: "notes" })` → message appears in your mosadd app under a `notes` thread.
76
-
77
- ## Architecture
78
-
79
- ```
80
- Agent (Claude / Cursor / ...)
81
- │
82
- │ stdio MCP
83
- ▼
84
- @mosadd/mcp server (this package)
85
- │
86
- │ supabase.functions.invoke('message-send', ...)
87
- │ + Authorization: Bearer <MOSADD_USER_JWT>
88
- ▼
89
- m0ssad-3 Edge Function
90
- │
91
- │ RLS-checked insert
92
- ▼
93
- Postgres `messages` table
94
- │
95
- │ Realtime broadcast
96
- ▼
97
- mosadd.com app (receiver)
98
- ```
99
-
100
- For PTT / CALL / ROOM (real-time media), the architecture separates **control plane** (MCP) from **data plane** (WebRTC daemon). See [docs/architecture/control-data-plane.md](https://github.com/Hei33enberg/mosadd-os/blob/main/docs/architecture/control-data-plane.md) when it lands.
101
-
102
- ## Configuration via env vars
103
-
104
- | Env | Description | Required |
105
- |---|---|---|
106
- | `MOSADD_SUPABASE_URL` | Supabase project URL | yes |
107
- | `MOSADD_SUPABASE_ANON_KEY` | Supabase anon key | yes |
108
- | `MOSADD_USER_JWT` | User session token | yes (for tools that touch user data) |
109
- | `MOSADD_API_KEY` | Hub API key (Phase 2 hosted mode) | no |
110
- | `MOSADD_HUB_URL` | Override hub url | no |
111
- | `MOSADD_MODE` | `local` / `cloud` / `self-host` | no (auto-detected) |
112
- | `MOSADD_LOG_LEVEL` | `debug` / `info` / `warn` / `error` | no (default `info`) |
113
-
114
- ## License
115
-
116
- Apache-2.0. See repo [LICENSE](https://github.com/Hei33enberg/mosadd-os/blob/main/LICENSE) and [NOTICE](https://github.com/Hei33enberg/mosadd-os/blob/main/NOTICE).
1
+ # @mosadd/mcp
2
+
3
+ MCP server for [mosadd](https://mosadd.dev) — exposes the OS modules (m\*) as Model Context Protocol tools so any agent runtime can talk to mosadd: Claude Code, Cursor, Windsurf, Cline, ChatGPT Apps, Lovable, Bolt, Goose, Manus, custom.
4
+
5
+ > **3.0.0-alpha** — `mDM` only, wired to the m0ssad-3 Supabase backend as a strangler-fig step. Phase 1 full will add mTALK / mAIL / mCALL / mIRC / mIRL / mROOM + bridges. Phase 2 routes through the hosted gateway at `mcp.mosadd.com` with the 167-event radar in front.
6
+
7
+ ## Install
8
+
9
+ ### Claude Code
10
+
11
+ ```bash
12
+ claude mcp add mosadd npx -- -y @mosadd/mcp
13
+ ```
14
+
15
+ ### Cursor
16
+
17
+ `~/.cursor/mcp.json`:
18
+
19
+ ```json
20
+ {
21
+ "mcpServers": {
22
+ "mosadd": {
23
+ "command": "npx",
24
+ "args": ["-y", "@mosadd/mcp"],
25
+ "env": {
26
+ "MOSADD_SUPABASE_URL": "https://<your-project>.supabase.co",
27
+ "MOSADD_SUPABASE_ANON_KEY": "<anon key>",
28
+ "MOSADD_USER_JWT": "<your session JWT>"
29
+ }
30
+ }
31
+ }
32
+ }
33
+ ```
34
+
35
+ ### Standalone
36
+
37
+ ```bash
38
+ MOSADD_SUPABASE_URL=... MOSADD_SUPABASE_ANON_KEY=... MOSADD_USER_JWT=... npx @mosadd/mcp
39
+ ```
40
+
41
+ ## BYOK — get your env values
42
+
43
+ While the hosted gateway is in development, the alpha runs in **local BYOK mode** — you supply your own Supabase credentials to talk to your own m0ssad-3 backend.
44
+
45
+ - `MOSADD_SUPABASE_URL` — your Supabase project URL (e.g. `https://abc.supabase.co`)
46
+ - `MOSADD_SUPABASE_ANON_KEY` — the public anon key from project settings
47
+ - `MOSADD_USER_JWT` — a Supabase session token for your mosadd user. Get it from the browser:
48
+ 1. Sign in to mosadd.com
49
+ 2. Open DevTools → Application → Local Storage → `sb-<ref>-auth-token`
50
+ 3. Copy the `access_token` field
51
+
52
+ In Phase 2, run `mosadd login` to OAuth into hub.mosadd.com — no JWT-juggling required.
53
+
54
+ ## Tools shipped in alpha
55
+
56
+ | Tool | Description |
57
+ |---|---|
58
+ | `mDM_list_contacts` | List your mosadd contacts (returns `identity_id` to use elsewhere) |
59
+ | `mDM_send` | Send a DM. `{ to: identity_id, text, thread_label?, reply_to_id? }` |
60
+ | `mDM_list` | Read DM thread |
61
+ | `mDM_respond_request` | Accept/reject incoming DM request |
62
+
63
+ All tool names follow [RFC 0001](https://github.com/Hei33enberg/mosadd-os/blob/main/docs/rfcs/0001-module-naming.md) — `m<MODULE>_<operation>` snake_case.
64
+
65
+ ## Try it (60-second demo)
66
+
67
+ In Claude Code with env vars set:
68
+
69
+ > List my mosadd contacts.
70
+
71
+ Claude calls `mDM_list_contacts` → you see your contact list.
72
+
73
+ > Send "hello from Claude" to <id> with thread label `notes`.
74
+
75
+ Claude calls `mDM_send({ to, text, thread_label: "notes" })` → message appears in your mosadd app under a `notes` thread.
76
+
77
+ ## Architecture
78
+
79
+ ```
80
+ Agent (Claude / Cursor / ...)
81
+ │
82
+ │ stdio MCP
83
+ ▼
84
+ @mosadd/mcp server (this package)
85
+ │
86
+ │ supabase.functions.invoke('message-send', ...)
87
+ │ + Authorization: Bearer <MOSADD_USER_JWT>
88
+ ▼
89
+ m0ssad-3 Edge Function
90
+ │
91
+ │ RLS-checked insert
92
+ ▼
93
+ Postgres `messages` table
94
+ │
95
+ │ Realtime broadcast
96
+ ▼
97
+ mosadd.com app (receiver)
98
+ ```
99
+
100
+ For PTT / CALL / ROOM (real-time media), the architecture separates **control plane** (MCP) from **data plane** (WebRTC daemon). See [docs/architecture/control-data-plane.md](https://github.com/Hei33enberg/mosadd-os/blob/main/docs/architecture/control-data-plane.md) when it lands.
101
+
102
+ ## Configuration via env vars
103
+
104
+ | Env | Description | Required |
105
+ |---|---|---|
106
+ | `MOSADD_SUPABASE_URL` | Supabase project URL | yes |
107
+ | `MOSADD_SUPABASE_ANON_KEY` | Supabase anon key | yes |
108
+ | `MOSADD_USER_JWT` | User session token | yes (for tools that touch user data) |
109
+ | `MOSADD_API_KEY` | Hub API key (Phase 2 hosted mode) | no |
110
+ | `MOSADD_HUB_URL` | Override hub url | no |
111
+ | `MOSADD_MODE` | `local` / `cloud` / `self-host` | no (auto-detected) |
112
+ | `MOSADD_LOG_LEVEL` | `debug` / `info` / `warn` / `error` | no (default `info`) |
113
+
114
+ ## License
115
+
116
+ Apache-2.0. See repo [LICENSE](https://github.com/Hei33enberg/mosadd-os/blob/main/LICENSE) and [NOTICE](https://github.com/Hei33enberg/mosadd-os/blob/main/NOTICE).
package/dist/bin/mcp.js CHANGED
@@ -1,11 +1,38 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  createMosaddServer
4
- } from "../chunk-HD5RLE5K.js";
4
+ } from "../chunk-YDFU6S5E.js";
5
5
  import "../chunk-Z7WR52GE.js";
6
6
 
7
7
  // src/bin/mcp.ts
8
8
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
9
+ var DEFAULT_EXCHANGE = "https://rooffhgbxafyjcwmwpsy.supabase.co/functions/v1/hub-key-exchange";
10
+ async function bootstrapFromApiKey() {
11
+ const apiKey = process.env.MOSADD_API_KEY;
12
+ if (!apiKey || process.env.MOSADD_USER_JWT) return;
13
+ const endpoint = process.env.MOSADD_HUB_URL ? `${process.env.MOSADD_HUB_URL.replace(/\/$/, "")}/hub-key-exchange` : DEFAULT_EXCHANGE;
14
+ try {
15
+ const res = await fetch(endpoint, {
16
+ method: "POST",
17
+ headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
18
+ body: "{}"
19
+ });
20
+ if (!res.ok) {
21
+ process.stderr.write(
22
+ JSON.stringify({ level: "warn", msg: "mosadd hub key exchange failed", status: res.status }) + "\n"
23
+ );
24
+ return;
25
+ }
26
+ const d = await res.json();
27
+ if (d.url) process.env.MOSADD_SUPABASE_URL = d.url;
28
+ if (d.anon_key) process.env.MOSADD_SUPABASE_ANON_KEY = d.anon_key;
29
+ if (d.access_token) process.env.MOSADD_USER_JWT = d.access_token;
30
+ } catch (err) {
31
+ process.stderr.write(
32
+ JSON.stringify({ level: "warn", msg: "mosadd hub unreachable", error: String(err) }) + "\n"
33
+ );
34
+ }
35
+ }
9
36
  async function main() {
10
37
  const sub = process.argv[2];
11
38
  if (sub === "login" || sub === "logout" || sub === "whoami") {
@@ -13,6 +40,7 @@ async function main() {
13
40
  await runAuthCommand(sub, process.argv.slice(3));
14
41
  return;
15
42
  }
43
+ await bootstrapFromApiKey();
16
44
  const server = createMosaddServer({
17
45
  apiKey: process.env.MOSADD_API_KEY,
18
46
  hubUrl: process.env.MOSADD_HUB_URL,