@mosadd/mcp 3.0.0-alpha.16 → 3.0.0-alpha.18

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 ADDED
@@ -0,0 +1,82 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@mosadd/mcp` are documented here.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project follows the `3.0.0-alpha.N` pre-release line until the hosted
7
+ gateway (Phase 2) ships.
8
+
9
+ ## [3.0.0-alpha.18] — 2026-06-18
10
+
11
+ ### Added
12
+ - **`comms_embed_create`** — embed a LIVE mosadd channel into an app/site a builder-agent is
13
+ generating (Lovable / Bolt / Cursor / v0). Mints a publishable embed key (`m_pk_live_…`,
14
+ origin-scoped, via the `embed-keys` EF) and returns a paste-in widget snippet
15
+ (`<div>` + `<script src="https://embed.mosadd.com/v1.js" data-key=…>`). The widget exchanges
16
+ the publishable key for a short-lived channel-scoped JWT at runtime; the hub key never enters
17
+ the browser. Extends `mROOM_create_guest_link` (link → embeddable widget). CDN override via
18
+ `MOSADD_EMBED_CDN`. (Widget served from the dedicated `embed.mosadd.com` deploy.)
19
+
20
+ ## [3.0.0-alpha.17] — 2026-06-18
21
+
22
+ ### Added
23
+ - **Action Links — screen share.** `comms_action_create` gains a `screen_share` action
24
+ type, and a new `comms_action_frame_get` tool lets the creating agent read frames of the
25
+ recipient's shared screen (consent-gated, browser-sandbox only). Turns Action Links into
26
+ "remote-desktop-lite" — the agent sees what the human chooses to share.
27
+
28
+ ### Changed
29
+ - **Durable `mosadd login`.** The saved session (`~/.mosadd/session.json`) is now refreshed
30
+ from its refresh token at server boot, so a single `mosadd login` keeps working across
31
+ restarts — no more re-login when the access token expires.
32
+ - Onboarding README restructured (recommended auth path — `mosadd login` — first; hub API
33
+ key second; DevTools JWT demoted), and the 61→70 / `mosadd.dev`→`mosadd.com` reconciliation
34
+ (first shipped on the published package with this release).
35
+
36
+ ## [3.0.0-alpha.16] — 2026-06-17
37
+
38
+ ### Fixed
39
+ - `mAIL_view` now calls the `mp0st-get` Edge Function (read a message by id,
40
+ owner-scoped) instead of `mp0st-view` (the tracking-pixel endpoint, which
41
+ returned "Missing tracking ID"). ([LINEAR-2917])
42
+ - CI publish drops `--provenance` — npm returned 422 because the source repo
43
+ (`mosadd-os`) is private, so provenance attestation is not available.
44
+
45
+ ### Added (cumulative since alpha.4 — tool count 61 → 70)
46
+ - **Action links (Tier 1):** `comms_action_create` mints a one-link browser
47
+ action an agent can hand to a human (run-with-consent in the mosadd sandbox).
48
+ - **mAIL provenance:** `mAIL_send_as_agent` stamps agent/human provenance on the
49
+ message so the recipient sees who actually sent it.
50
+ - **File & voice attachments:** `mDM_send_voice` / `mDM_send_file`,
51
+ `mROOM_send_voice` / `mROOM_send_file`, `mIRC_send_voice` / `mIRC_send_file`
52
+ (reuse the existing `chat-files` bucket — no new transport).
53
+ - **mTALK → RAG:** `mTALK_ingest_ptt` feeds push-to-talk audio into the RAG index
54
+ (opt-in, gated server-side).
55
+ - **mROOM:** `mROOM_create_guest_link` (single-call, no-account guest links) and
56
+ `mROOM_voice_join`.
57
+ - **mIRC edge transport:** `mIRC_mint_channel_token`, `mIRC_send_edge`,
58
+ `mIRC_history_edge` — the low-latency path the agent-coordination skill rides.
59
+
60
+ ### Changed
61
+ - README, `package.json`, and the plugin `marketplace.json` reconciled to the
62
+ current surface: **70 tools across 6 modules** + `comms_capabilities`
63
+ discovery (71 callable), version `alpha.16`, and `mosadd.dev` → `mosadd.com`
64
+ (the dev surface was consolidated into the main site). ([LINEAR-3391])
65
+ - `mCALL` (telephony, carrier-pending) and `mURL` (brand/consumer surface)
66
+ remain **unregistered** in `tools/index.ts` — an agent only ever discovers
67
+ tools that actually work.
68
+
69
+ ## [3.0.0-alpha.4]
70
+
71
+ ### Added
72
+ - Initial public alpha: **61 tools across 6 live modules** — mDM (incl. voice),
73
+ mIRC, mROOM, mAIL, mTALK, mRAG — plus the `comms_capabilities` discovery tool.
74
+ - BYOK mode: the server talks to your own mosadd Supabase backend via
75
+ `MOSADD_SUPABASE_URL` / `MOSADD_SUPABASE_ANON_KEY` / `MOSADD_USER_JWT`.
76
+ - Apache-2.0 license; tool names follow [RFC 0001] (`m<MODULE>_<operation>`).
77
+
78
+ [3.0.0-alpha.16]: https://github.com/Hei33enberg/mosadd-os/tree/main/packages/mcp
79
+ [3.0.0-alpha.4]: https://github.com/Hei33enberg/mosadd-os/tree/main/packages/mcp
80
+ [LINEAR-2917]: https://linear.app/ip-ra/issue/LINEAR-2917
81
+ [LINEAR-3391]: https://linear.app/ip-ra/issue/LINEAR-3391
82
+ [RFC 0001]: https://github.com/Hei33enberg/mosadd-os/blob/main/docs/rfcs/0001-module-naming.md
package/README.md CHANGED
@@ -1,20 +1,43 @@
1
1
  # @mosadd/mcp
2
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.
3
+ MCP server for [mosadd](https://mosadd.com) — 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
4
 
5
- > **3.0.0-alpha.4** — **61 live tools across 6 live modules** (mDM incl. voice, mIRC, mROOM, mAIL, mTALK, mRAG) + the `comms_capabilities` discovery tool, wired to the mosadd backend (BYOK) as a strangler-fig step. Phase 2 routes through the hosted gateway at `mcp.mosadd.com` with the 166-event radar in front.
5
+ > **3.0.0-alpha.16** — **70 live tools across 6 live modules** (mDM incl. voice + files, mIRC, mROOM, mAIL incl. provenance, mTALK, mRAG) + agent→user action links + the `comms_capabilities` discovery tool, wired to the mosadd backend (BYOK) as a strangler-fig step. Phase 2 routes through the hosted gateway at `mcp.mosadd.com` with the 166-event radar in front.
6
6
 
7
- ## Install
7
+ ## Connect your agent
8
8
 
9
- ### Claude Code
9
+ Three ways to authenticate, friendliest first — all three end with the same ~70 tools.
10
+
11
+ ### 1. `mosadd login` — recommended (one command, stays logged in)
12
+
13
+ Sign in once; the session is saved to `~/.mosadd/session.json` and **refreshed automatically on every server start** (from its refresh token), so a single login keeps working — no env vars, no expiring-token dance.
10
14
 
11
15
  ```bash
16
+ npx -y @mosadd/mcp@alpha login
17
+ # prompts for your Supabase URL + anon key (both public) and your mosadd email + password
18
+ ```
19
+
20
+ Then register the server with **no env block**:
21
+
22
+ ```bash
23
+ # Claude Code
12
24
  claude mcp add mosadd -- npx -y @mosadd/mcp@alpha
13
25
  ```
14
26
 
15
- ### Cursor
27
+ ```json
28
+ // Claude Desktop / Cursor / Cline / Windsurf — mcpServers config, no env needed
29
+ {
30
+ "mcpServers": {
31
+ "mosadd": { "command": "npx", "args": ["-y", "@mosadd/mcp@alpha"] }
32
+ }
33
+ }
34
+ ```
35
+
36
+ `npx @mosadd/mcp@alpha whoami` shows who you're signed in as; `… logout` clears it.
37
+
38
+ ### 2. `MOSADD_API_KEY` — headless / CI (one long-lived key)
16
39
 
17
- `~/.cursor/mcp.json`:
40
+ A `mosadd_sk_live_…` hub key does not expire; the server exchanges it for a fresh session on every start. Best for servers, cron, and our own `mosadd-agent`.
18
41
 
19
42
  ```json
20
43
  {
@@ -22,47 +45,39 @@ claude mcp add mosadd -- npx -y @mosadd/mcp@alpha
22
45
  "mosadd": {
23
46
  "command": "npx",
24
47
  "args": ["-y", "@mosadd/mcp@alpha"],
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
- }
48
+ "env": { "MOSADD_API_KEY": "mosadd_sk_live_…" }
30
49
  }
31
50
  }
32
51
  }
33
52
  ```
34
53
 
35
- ### Standalone
54
+ Mint a key by POSTing to the `hub-keys` Edge Function with your user JWT (it returns the secret once). A one-click "API keys" screen on mosadd.com is the planned UX.
36
55
 
37
- ```bash
38
- MOSADD_SUPABASE_URL=... MOSADD_SUPABASE_ANON_KEY=... MOSADD_USER_JWT=... npx @mosadd/mcp@alpha
39
- ```
56
+ ### 3. BYOK + `MOSADD_USER_JWT` — advanced / debugging
40
57
 
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 mosadd backend.
58
+ Bring your own Supabase URL + anon key + a raw session token. **The JWT expires (~1h)** — prefer option 1 or 2 for anything ongoing.
44
59
 
45
60
  - `MOSADD_SUPABASE_URL` — your Supabase project URL (e.g. `https://abc.supabase.co`)
46
61
  - `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
62
+ - `MOSADD_USER_JWT` — sign in to mosadd.com → DevTools → Application → Local Storage → `sb-<ref>-auth-token` → copy the `access_token` field
51
63
 
52
- In Phase 2, run `mosadd login` to OAuth into hub.mosadd.com — no JWT-juggling required.
64
+ In Phase 2 the hosted gateway at `mcp.mosadd.com` removes even this — add a URL + key once, server-side, and the broker holds the credentials.
53
65
 
54
66
  ## Tools shipped in alpha
55
67
 
56
- **61 live tools across 6 live modules** (mDM, mIRC, mROOM, mAIL, mTALK, mRAG) + the `comms_capabilities` discovery tool. Highlights per module:
68
+ **70 live tools across 6 live modules** (mDM, mIRC, mROOM, mAIL, mTALK, mRAG) + agent→user action links + the `comms_capabilities` discovery tool. Highlights per module:
57
69
 
58
70
  | Module | Tools | What it does |
59
71
  |---|---|---|
60
- | **mDM** (12) | `mDM_list_contacts`, `mDM_send`, `mDM_send_unencrypted`, `mDM_edit`, `mDM_delete`, `mDM_list`, `mDM_publish_keys`, `mDM_respond_request` + 4 voice ops | 1:1 text + voice. Multi-thread per contact, X3DH / Double-Ratchet E2EE on `mDM_send` |
61
- | **mIRC** (20) | `mIRC_create/list/get/update/delete`, member RBAC ops, `mIRC_post_message`, `mIRC_list_messages` + admin | Persistent Discord/Slack-style channels |
62
- | **mROOM** (9) | `mROOM_create`, **`mROOM_create_guest_link`**, `mROOM_join/leave/close/list`, `mROOM_send_message`, `mROOM_list_messages` | Ephemeral rooms + single-call no-account guest links |
63
- | **mTALK** (5) | `mTALK_open`, `mTALK_join`, `mTALK_press`, `mTALK_release`, `mTALK_state` | Half-duplex push-to-talk: one speaker, FIFO queue, anti-hog auto-release |
64
- | **mAIL** (11) | `mAIL_send`, `mAIL_view`, `mAIL_list`, `mAIL_delete`, `mAIL_stats`, `mAIL_events`, `mAIL_metrics`, `mAIL_revoke`, `mAIL_audit_export`, `mAIL_consent`, `mAIL_notify` | Mail; every user gets `<id>@mosadd.com`. `mAIL_revoke` recalls secure-reader access; `mAIL_audit_export` emits an HMAC-SHA256-signed engagement audit; `mAIL_consent` manages recipient tracking opt-outs (GDPR); `mAIL_notify` pulls the inbound-mail notification feed |
72
+ | **mDM** (14) | `mDM_list_contacts`, `mDM_send`, `mDM_send_unencrypted`, `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, X3DH / Double-Ratchet E2EE on `mDM_send` |
73
+ | **mIRC** (22) | `mIRC_create/list/get/update/delete`, member RBAC (`mIRC_join/leave/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 |
74
+ | **mROOM** (11) | `mROOM_create`, **`mROOM_create_guest_link`**, `mROOM_join/leave/close/list`, `mROOM_voice_join`, `mROOM_send_message`, `mROOM_list_messages`, `mROOM_send_voice/file` | Ephemeral rooms + single-call no-account guest links |
75
+ | **mAIL** (12) | `mAIL_send`, `mAIL_view`, `mAIL_list`, `mAIL_delete`, `mAIL_stats`, `mAIL_events`, `mAIL_metrics`, `mAIL_revoke`, `mAIL_audit_export`, `mAIL_consent`, `mAIL_notify`, `mAIL_send_as_agent` | Mail; every user gets `<id>@mosadd.com`. `mAIL_send_as_agent` stamps agent/human provenance; `mAIL_revoke` recalls secure-reader access; `mAIL_audit_export` emits an HMAC-SHA256-signed engagement audit; `mAIL_consent` manages recipient tracking opt-outs (GDPR); `mAIL_notify` pulls the inbound-mail feed |
76
+ | **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; `mTALK_ingest_ptt` feeds PTT audio to RAG |
65
77
  | **mRAG** (4) | `mRAG_ingest`, `mRAG_search`, `mRAG_list_sources`, `mRAG_delete` | RAG recall over the user's own data (hybrid vector + BM25) |
78
+ | **comms_** (2) | `comms_action_create`, `comms_capabilities` | `comms_action_create` mints an agent→user one-link browser action (Tier 1); `comms_capabilities` is one-call discovery of every tool's transport `requires` flag |
79
+
80
+ Counts by module prefix sum to **70 channel tools**; `comms_capabilities` (discovery) makes **71 callable** in total. `mCALL` (telephony) and `mURL` (brand surface) tools exist in the source but are **not registered** — agents only ever see tools that actually work.
66
81
 
67
82
  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.
68
83
 
package/dist/bin/mcp.js CHANGED
@@ -1,11 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  createMosaddServer
4
- } from "../chunk-KZ3HIZ74.js";
5
- import "../chunk-Z7WR52GE.js";
4
+ } from "../chunk-D2PH2HYY.js";
5
+ import {
6
+ isSessionExpired,
7
+ loadSession,
8
+ saveSession
9
+ } from "../chunk-Z7WR52GE.js";
6
10
 
7
11
  // src/bin/mcp.ts
8
12
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
13
+ import { createClient } from "@supabase/supabase-js";
9
14
  var DEFAULT_EXCHANGE = "https://rooffhgbxafyjcwmwpsy.supabase.co/functions/v1/hub-key-exchange";
10
15
  async function bootstrapFromApiKey() {
11
16
  const apiKey = process.env.MOSADD_API_KEY;
@@ -33,6 +38,36 @@ async function bootstrapFromApiKey() {
33
38
  );
34
39
  }
35
40
  }
41
+ async function bootstrapFromSavedSession() {
42
+ if (process.env.MOSADD_USER_JWT) return;
43
+ const session = loadSession();
44
+ if (!session?.refreshToken) return;
45
+ if (!isSessionExpired(session)) return;
46
+ try {
47
+ const client = createClient(session.url, session.anonKey, {
48
+ auth: { persistSession: false, autoRefreshToken: false, detectSessionInUrl: false }
49
+ });
50
+ const { data, error } = await client.auth.refreshSession({ refresh_token: session.refreshToken });
51
+ if (error || !data.session) {
52
+ process.stderr.write(
53
+ JSON.stringify({ level: "warn", msg: "mosadd session refresh failed \u2014 run `mosadd login`", error: error?.message }) + "\n"
54
+ );
55
+ return;
56
+ }
57
+ saveSession({
58
+ url: session.url,
59
+ anonKey: session.anonKey,
60
+ accessToken: data.session.access_token,
61
+ refreshToken: data.session.refresh_token ?? session.refreshToken,
62
+ expiresAt: data.session.expires_at,
63
+ email: data.user?.email ?? session.email
64
+ });
65
+ } catch (err) {
66
+ process.stderr.write(
67
+ JSON.stringify({ level: "warn", msg: "mosadd session refresh error \u2014 run `mosadd login`", error: String(err) }) + "\n"
68
+ );
69
+ }
70
+ }
36
71
  async function main() {
37
72
  const sub = process.argv[2];
38
73
  if (sub === "login" || sub === "logout" || sub === "whoami") {
@@ -41,6 +76,7 @@ async function main() {
41
76
  return;
42
77
  }
43
78
  await bootstrapFromApiKey();
79
+ await bootstrapFromSavedSession();
44
80
  const server = createMosaddServer({
45
81
  apiKey: process.env.MOSADD_API_KEY,
46
82
  hubUrl: process.env.MOSADD_HUB_URL,
@@ -2154,8 +2154,8 @@ var formField = z15.object({
2154
2154
  required: z15.boolean().optional().describe("Whether the recipient must fill this field.")
2155
2155
  });
2156
2156
  var action_create_input = z15.object({
2157
- action_type: z15.enum(["confirm", "file_request", "form", "open_url"]).describe(
2158
- "What you want the recipient to do: 'confirm' (yes/no), 'file_request' (pick a file from their computer), 'form' (fill fields), 'open_url' (open a vetted https URL)."
2157
+ action_type: z15.enum(["confirm", "file_request", "form", "open_url", "screen_share"]).describe(
2158
+ "What you want the recipient to do: 'confirm' (yes/no), 'file_request' (pick a file from their computer), 'form' (fill fields), 'open_url' (open a vetted https URL), 'screen_share' (recipient shares their screen so you can SEE it via comms_action_frame_get \u2014 view only)."
2159
2159
  ),
2160
2160
  message: z15.string().min(1).max(2e3).describe("What you're asking \u2014 shown on the consent screen above the action UI."),
2161
2161
  creator_label: z15.string().max(80).optional().describe("How you're identified to the recipient (e.g. your agent name). Default 'Agent'."),
@@ -2169,6 +2169,8 @@ var action_create_input = z15.object({
2169
2169
  fields: z15.array(formField).min(1).max(20).optional().describe("[form] Fields to collect from the recipient."),
2170
2170
  // open_url
2171
2171
  url: z15.string().url().optional().describe("[open_url] The https URL to open. The full URL is shown to the recipient before they open it."),
2172
+ // screen_share
2173
+ max_width: z15.number().int().positive().max(1920).optional().describe("[screen_share] Max captured frame width in px (default 1280). Frames are downscaled JPEGs."),
2172
2174
  // lifecycle
2173
2175
  ttl_ms: z15.number().int().positive().optional().describe("Link lifetime in milliseconds. Default 24h, capped at 7d."),
2174
2176
  max_uses: z15.number().int().min(1).max(50).optional().describe("How many times the link can be redeemed. Default 1 (single-use).")
@@ -2185,6 +2187,8 @@ function buildParams(input) {
2185
2187
  case "open_url":
2186
2188
  if (!input.url) throw new Error("action_type 'open_url' requires `url`.");
2187
2189
  return { message: input.message, url: input.url };
2190
+ case "screen_share":
2191
+ return { message: input.message, maxWidth: input.max_width };
2188
2192
  default:
2189
2193
  return { message: input.message };
2190
2194
  }
@@ -2210,6 +2214,27 @@ async function action_create(input, ctx) {
2210
2214
  expires_at: res.expires_at ?? ""
2211
2215
  };
2212
2216
  }
2217
+ var action_frame_get_input = z15.object({
2218
+ action_id: z15.string().min(1).describe("The action_id returned by comms_action_create for a 'screen_share' action you created.")
2219
+ });
2220
+ async function action_frame_get(input, ctx) {
2221
+ readSupabaseEnv();
2222
+ ctx.log("debug", "action_frame_get reading frame", { action_id: input.action_id });
2223
+ const sb = getSupabase();
2224
+ const { data, error } = await sb.from("action_screen_frames").select("image_jpeg, width, seq, updated_at").eq("action_id", input.action_id).maybeSingle();
2225
+ if (error) throw new Error(error.message);
2226
+ if (!data) {
2227
+ return { mcpContent: [{ type: "text", text: "No frame yet \u2014 the recipient hasn't started sharing their screen (or you don't own this action)." }] };
2228
+ }
2229
+ const row = data;
2230
+ const ageSec = Math.round((Date.now() - new Date(row.updated_at).getTime()) / 1e3);
2231
+ return {
2232
+ mcpContent: [
2233
+ { type: "text", text: `Latest screen frame \u2014 seq ${row.seq}, ${row.width ?? "?"}px wide, ${ageSec}s old.` },
2234
+ { type: "image", data: row.image_jpeg, mimeType: "image/jpeg" }
2235
+ ]
2236
+ };
2237
+ }
2213
2238
  var actionTools = [
2214
2239
  {
2215
2240
  // RFC 0001: channel-agnostic capability (link is sent over ANY channel), so it
@@ -2220,11 +2245,72 @@ var actionTools = [
2220
2245
  description: "Mint a single-use, expiring action link (https://mosadd.com/do/<token>) that asks a human to DO something in their browser, with explicit consent. action_type: 'confirm' (yes/no) | 'file_request' (recipient picks a file from their computer) | 'form' (recipient fills fields you define) | 'open_url' (recipient opens a vetted https URL). Returns { action_id, token, link, expires_at }. Send the `link` to the person via mDM/mIRC/mAIL; they open it, consent, and the browser performs the action in its sandbox (no install, no OS access). The action is owned by you (the calling user). HONEST LIMITS: this is browser-sandbox only \u2014 it cannot click other apps, run programs, or read files the user didn't pick; and file_request payloads are not yet end-to-end encrypted (don't request sensitive files until Tier 1.1).",
2221
2246
  inputSchema: action_create_input,
2222
2247
  handler: action_create
2248
+ },
2249
+ {
2250
+ name: "comms_action_frame_get",
2251
+ requires: "network",
2252
+ description: "See the LATEST screen frame from a 'screen_share' action you created (pass the action_id from comms_action_create). Returns the current screenshot AS AN IMAGE you can look at, plus how old it is. The recipient must have opened the link and clicked 'share screen' first. Poll this every few seconds to watch live. VIEW ONLY \u2014 you cannot click or control their screen. Returns a 'no frame yet' note until they start sharing.",
2253
+ inputSchema: action_frame_get_input,
2254
+ handler: action_frame_get
2223
2255
  }
2224
2256
  ];
2225
2257
 
2226
- // src/tools/capabilities.ts
2258
+ // src/tools/embed.ts
2227
2259
  import { z as z16 } from "zod";
2260
+ var EMBED_CDN = (process.env.MOSADD_EMBED_CDN ?? "https://embed.mosadd.com").replace(/\/+$/, "");
2261
+ var POSITIONS = ["inline", "sidebar-left", "sidebar-right", "floating-bl", "floating-br", "fullscreen"];
2262
+ var SKINS = ["default", "retro-irc-1990", "terminal", "minimal-dark", "minimal-light"];
2263
+ var embed_create_input = z16.object({
2264
+ channel: z16.string().min(1).max(128).regex(/^[A-Za-z0-9_-]+$/).describe("The mIRC channel id everyone on the embed shares (e.g. 'acme-support'). Auto-created on first message if new."),
2265
+ allowed_origins: z16.array(z16.string().min(1)).min(1).max(10).describe("REQUIRED. Domain(s) where the widget will be served \u2014 the key only works from these origins. Use the host(s) of the app you're building, e.g. ['app.acme.com','*.acme.com']. For local testing use mode:'test' and e.g. 'localhost:3000'."),
2266
+ name: z16.string().max(64).optional().describe("Label for the key in the owner's dashboard. Default 'embed: <channel>'."),
2267
+ position: z16.enum(POSITIONS).optional().describe("Where the widget renders. Default 'inline'."),
2268
+ skin: z16.enum(SKINS).optional().describe("Visual skin. Default 'default' (mosadd-branded retro mIRC)."),
2269
+ title: z16.string().max(60).optional().describe("Header title shown in the widget. Default 'mIRC'."),
2270
+ anon: z16.boolean().optional().describe("Allow visitors to join with just a nick (no mosadd account). Default true."),
2271
+ locale: z16.enum(["en", "pl"]).optional().describe("Widget UI language. Default 'en'."),
2272
+ mode: z16.enum(["live", "test"]).optional().describe("Key mode \u2014 'test' for local/dev origins, 'live' for production. Default 'live'.")
2273
+ });
2274
+ var attrSafe = (s) => s.replace(/["'<>]/g, "");
2275
+ function buildSnippet(input, key) {
2276
+ const attrs = [`data-channel="${attrSafe(input.channel)}"`, `data-position="${input.position ?? "inline"}"`];
2277
+ if (input.skin) attrs.push(`data-skin="${input.skin}"`);
2278
+ if (input.title) attrs.push(`data-title="${attrSafe(input.title)}"`);
2279
+ if (input.anon === false) attrs.push(`data-anon="false"`);
2280
+ if (input.locale) attrs.push(`data-locale="${input.locale}"`);
2281
+ return `<div id="mosadd-mirc" ${attrs.join(" ")}></div>
2282
+ <script src="${EMBED_CDN}/v1.js" data-key="${key}"></script>`;
2283
+ }
2284
+ async function embed_create(input, ctx) {
2285
+ readSupabaseEnv();
2286
+ ctx.log("debug", "comms_embed_create minting embed key", { channel: input.channel, origins: input.allowed_origins.length });
2287
+ const res = await invokeFunction("embed-keys", {
2288
+ name: input.name ?? `embed: ${input.channel}`,
2289
+ channels: [input.channel],
2290
+ allowed_origins: input.allowed_origins,
2291
+ mode: input.mode ?? "live"
2292
+ });
2293
+ if (res.error) throw new Error(res.error);
2294
+ if (!res.key) throw new Error("embed-keys returned no publishable key (missing `key`).");
2295
+ return {
2296
+ embed_key: res.key,
2297
+ channel: input.channel,
2298
+ allowed_origins: input.allowed_origins,
2299
+ snippet: buildSnippet(input, res.key)
2300
+ };
2301
+ }
2302
+ var embedTools = [
2303
+ {
2304
+ name: "comms_embed_create",
2305
+ requires: "network",
2306
+ description: "Embed a LIVE mosadd chat channel into an app/site you're building (great for builder-agents on Lovable/Bolt/Cursor/v0). Mints a publishable embed key scoped to a channel + the app's domain(s) and returns a ready-to-paste HTML snippet (a <div> + <script src=embed.mosadd.com/v1.js data-key=\u2026>). Visitors of the host page chat in real time (anonymous nick or mosadd login). REQUIRES `allowed_origins` \u2014 the domain(s) the app is served from (the key only works there). The publishable key is browser-safe (mints only channel-scoped JWTs); your hub key never leaves the server. Returns { embed_key, channel, allowed_origins, snippet }. Extends mROOM_create_guest_link (link \u2192 embeddable widget).",
2307
+ inputSchema: embed_create_input,
2308
+ handler: embed_create
2309
+ }
2310
+ ];
2311
+
2312
+ // src/tools/capabilities.ts
2313
+ import { z as z17 } from "zod";
2228
2314
  var CONTRACT_VERSION = "1.0.0";
2229
2315
  var ALL_REQUIREMENTS = ["any", "radio", "network"];
2230
2316
  function buildCapabilityManifest(tools) {
@@ -2247,7 +2333,7 @@ function makeCapabilitiesTool(channelTools2) {
2247
2333
  name: "comms_capabilities",
2248
2334
  requires: "any",
2249
2335
  description: "Discover which mosadd tools are available and what transport each requires (any | radio | network). Carrier-aware hosts (e.g. off-grid radio devices) call this once to gate the tool list to what the current carrier supports. Returns a manifest with per-tool requirements grouped by transport.",
2250
- inputSchema: z16.object({}),
2336
+ inputSchema: z17.object({}),
2251
2337
  handler: async () => buildCapabilityManifest([...channelTools2, tool])
2252
2338
  };
2253
2339
  return tool;
@@ -2269,8 +2355,10 @@ var channelTools = [
2269
2355
  ...attachmentTools,
2270
2356
  ...pttIngestTools,
2271
2357
  ...knowledgeTools,
2272
- ...actionTools
2358
+ ...actionTools,
2273
2359
  // Action links (Tier 1): agent → user one-link browser action via action-create EF
2360
+ ...embedTools
2361
+ // comms_embed_create: agent embeds a live channel into the app it builds (embed-keys EF + embed.mosadd.com widget)
2274
2362
  // ...murlTools, // mURL: brand/consumer surface (murl.mosadd.com), not a dev product
2275
2363
  // ...mcallTools, // mCALL: carrier-pending (no telephony carrier live) — re-register when a carrier is configured
2276
2364
  // mirlTools,
@@ -2465,6 +2553,10 @@ function createMosaddServer(options = {}) {
2465
2553
  const parsed = tool.inputSchema.parse(input);
2466
2554
  try {
2467
2555
  const result = await tool.handler(parsed, ctx);
2556
+ const rich = result;
2557
+ if (rich && Array.isArray(rich.mcpContent)) {
2558
+ return { content: rich.mcpContent };
2559
+ }
2468
2560
  return {
2469
2561
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
2470
2562
  };
package/dist/index.d.ts CHANGED
@@ -195,8 +195,9 @@ declare function createMosaddServer(options?: MosaddServerOptions): McpServer;
195
195
  /**
196
196
  * Tool registry. Each m* module contributes a set of tools.
197
197
  *
198
- * Live modules (6): mDM, mIRC, mROOM, mTALK, mAIL, mRAG — 61 tools + comms_capabilities.
199
- * Plus action links (Tier 1): comms_action_create — agent → user one-link browser action.
198
+ * Live modules (6): mDM, mIRC, mROOM, mTALK, mAIL, mRAG — 70 tools + comms_capabilities.
199
+ * Plus action links: comms_action_create (agent → user one-link browser action,
200
+ * incl. screen_share) + comms_action_frame_get (see the recipient's shared screen).
200
201
  * mURL is a consumer/brand surface (murl.mosadd.com), NOT a dev product — its tools
201
202
  * live in tools/murl.ts but are NOT registered here (founder decision 2026-06-10).
202
203
  * mCALL is carrier-pending (no telephony carrier live yet): its tools live in
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  createMosaddServer,
4
4
  defaultProviders,
5
5
  runWithSupabaseEnv
6
- } from "./chunk-KZ3HIZ74.js";
6
+ } from "./chunk-D2PH2HYY.js";
7
7
  import "./chunk-Z7WR52GE.js";
8
8
  export {
9
9
  allTools,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mosadd/mcp",
3
- "version": "3.0.0-alpha.16",
4
- "description": "Model Context Protocol server for mosadd. Exposes the 6 live m* modules (mDM, mIRC, mROOM, mTALK, mAIL, mRAG) — 61 tools — to any agent runtime (Claude Code, Cursor, Windsurf, Cline, ChatGPT Apps, Lovable, Bolt, Goose, Manus, custom).",
3
+ "version": "3.0.0-alpha.18",
4
+ "description": "Model Context Protocol server for mosadd. Exposes the 6 live m* modules (mDM, mIRC, mROOM, mTALK, mAIL, mRAG) — 70 tools — to any agent runtime (Claude Code, Cursor, Windsurf, Cline, ChatGPT Apps, Lovable, Bolt, Goose, Manus, custom).",
5
5
  "homepage": "https://github.com/Hei33enberg/mosadd-os/tree/main/packages/mcp",
6
6
  "repository": {
7
7
  "type": "git",
@@ -27,6 +27,7 @@
27
27
  "dist",
28
28
  "src",
29
29
  "README.md",
30
+ "CHANGELOG.md",
30
31
  "LICENSE"
31
32
  ],
32
33
  "publishConfig": {
package/src/bin/mcp.ts CHANGED
@@ -10,7 +10,9 @@
10
10
  */
11
11
 
12
12
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
13
+ import { createClient } from "@supabase/supabase-js";
13
14
  import { createMosaddServer } from "../server.js";
15
+ import { loadSession, saveSession, isSessionExpired } from "../config.js";
14
16
 
15
17
  const DEFAULT_EXCHANGE =
16
18
  "https://rooffhgbxafyjcwmwpsy.supabase.co/functions/v1/hub-key-exchange";
@@ -51,6 +53,47 @@ async function bootstrapFromApiKey(): Promise<void> {
51
53
  }
52
54
  }
53
55
 
56
+ /**
57
+ * `mosadd login` path: refresh the saved session at boot so a stored token that
58
+ * expired since the last launch (Supabase access tokens last ~1h) is renewed
59
+ * silently from its refresh token — instead of failing the first tool call with
60
+ * "session expired, run `mosadd login` again". This makes a single `mosadd login`
61
+ * durable across restarts (the founder's "set once, forget" expectation). No-op
62
+ * when an explicit env JWT or hub key already resolved a session, when there is no
63
+ * saved session, or when the saved token is still valid.
64
+ */
65
+ async function bootstrapFromSavedSession(): Promise<void> {
66
+ if (process.env.MOSADD_USER_JWT) return;
67
+ const session = loadSession();
68
+ if (!session?.refreshToken) return;
69
+ // Still-valid token → the provider uses it as-is; don't churn the refresh token.
70
+ if (!isSessionExpired(session)) return;
71
+ try {
72
+ const client = createClient(session.url, session.anonKey, {
73
+ auth: { persistSession: false, autoRefreshToken: false, detectSessionInUrl: false },
74
+ });
75
+ const { data, error } = await client.auth.refreshSession({ refresh_token: session.refreshToken });
76
+ if (error || !data.session) {
77
+ process.stderr.write(
78
+ JSON.stringify({ level: "warn", msg: "mosadd session refresh failed — run `mosadd login`", error: error?.message }) + "\n",
79
+ );
80
+ return;
81
+ }
82
+ saveSession({
83
+ url: session.url,
84
+ anonKey: session.anonKey,
85
+ accessToken: data.session.access_token,
86
+ refreshToken: data.session.refresh_token ?? session.refreshToken,
87
+ expiresAt: data.session.expires_at,
88
+ email: data.user?.email ?? session.email,
89
+ });
90
+ } catch (err) {
91
+ process.stderr.write(
92
+ JSON.stringify({ level: "warn", msg: "mosadd session refresh error — run `mosadd login`", error: String(err) }) + "\n",
93
+ );
94
+ }
95
+ }
96
+
54
97
  async function main(): Promise<void> {
55
98
  // Auth subcommands: `mosadd login | logout | whoami`. Everything else starts the server.
56
99
  const sub = process.argv[2];
@@ -62,6 +105,8 @@ async function main(): Promise<void> {
62
105
 
63
106
  // Hosted: trade MOSADD_API_KEY for a live session before the server reads env.
64
107
  await bootstrapFromApiKey();
108
+ // `mosadd login`: renew a saved session whose access token expired since last launch.
109
+ await bootstrapFromSavedSession();
65
110
 
66
111
  const server = createMosaddServer({
67
112
  apiKey: process.env.MOSADD_API_KEY,
package/src/server.ts CHANGED
@@ -86,6 +86,12 @@ export function createMosaddServer(options: MosaddServerOptions = {}) {
86
86
  const parsed = tool.inputSchema.parse(input);
87
87
  try {
88
88
  const result = await tool.handler(parsed as never, ctx);
89
+ // A tool may return rich MCP content (e.g. an image frame from
90
+ // comms_action_frame_get) via `mcpContent`; pass it through verbatim.
91
+ const rich = result as { mcpContent?: unknown[] } | null;
92
+ if (rich && Array.isArray(rich.mcpContent)) {
93
+ return { content: rich.mcpContent as never[] };
94
+ }
89
95
  return {
90
96
  content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }],
91
97
  };
@@ -19,7 +19,7 @@
19
19
 
20
20
  import { z } from "zod";
21
21
  import type { MosaddTool, MosaddToolContext } from "../types.js";
22
- import { invokeFunction, readSupabaseEnv } from "../providers/supabase.js";
22
+ import { invokeFunction, readSupabaseEnv, getSupabase } from "../providers/supabase.js";
23
23
 
24
24
  const formField = z.object({
25
25
  name: z.string().min(1).max(60).describe("Field key — returned verbatim in the result."),
@@ -29,8 +29,8 @@ const formField = z.object({
29
29
  });
30
30
 
31
31
  const action_create_input = z.object({
32
- action_type: z.enum(["confirm", "file_request", "form", "open_url"]).describe(
33
- "What you want the recipient to do: 'confirm' (yes/no), 'file_request' (pick a file from their computer), 'form' (fill fields), 'open_url' (open a vetted https URL).",
32
+ action_type: z.enum(["confirm", "file_request", "form", "open_url", "screen_share"]).describe(
33
+ "What you want the recipient to do: 'confirm' (yes/no), 'file_request' (pick a file from their computer), 'form' (fill fields), 'open_url' (open a vetted https URL), 'screen_share' (recipient shares their screen so you can SEE it via comms_action_frame_get — view only).",
34
34
  ),
35
35
  message: z.string().min(1).max(2000).describe("What you're asking — shown on the consent screen above the action UI."),
36
36
  creator_label: z.string().max(80).optional().describe("How you're identified to the recipient (e.g. your agent name). Default 'Agent'."),
@@ -44,6 +44,8 @@ const action_create_input = z.object({
44
44
  fields: z.array(formField).min(1).max(20).optional().describe("[form] Fields to collect from the recipient."),
45
45
  // open_url
46
46
  url: z.string().url().optional().describe("[open_url] The https URL to open. The full URL is shown to the recipient before they open it."),
47
+ // screen_share
48
+ max_width: z.number().int().positive().max(1920).optional().describe("[screen_share] Max captured frame width in px (default 1280). Frames are downscaled JPEGs."),
47
49
  // lifecycle
48
50
  ttl_ms: z.number().int().positive().optional().describe("Link lifetime in milliseconds. Default 24h, capped at 7d."),
49
51
  max_uses: z.number().int().min(1).max(50).optional().describe("How many times the link can be redeemed. Default 1 (single-use)."),
@@ -61,6 +63,8 @@ function buildParams(input: z.infer<typeof action_create_input>): Record<string,
61
63
  case "open_url":
62
64
  if (!input.url) throw new Error("action_type 'open_url' requires `url`.");
63
65
  return { message: input.message, url: input.url };
66
+ case "screen_share":
67
+ return { message: input.message, maxWidth: input.max_width };
64
68
  default:
65
69
  return { message: input.message };
66
70
  }
@@ -102,6 +106,39 @@ async function action_create(
102
106
  };
103
107
  }
104
108
 
109
+ // ── comms_action_frame_get — read the latest screen frame (Tier 1.5) ──────────
110
+ const action_frame_get_input = z.object({
111
+ action_id: z.string().min(1).describe("The action_id returned by comms_action_create for a 'screen_share' action you created."),
112
+ });
113
+
114
+ async function action_frame_get(
115
+ input: z.infer<typeof action_frame_get_input>,
116
+ ctx: MosaddToolContext,
117
+ ): Promise<{ mcpContent: Array<Record<string, unknown>> }> {
118
+ readSupabaseEnv();
119
+ ctx.log("debug", "action_frame_get reading frame", { action_id: input.action_id });
120
+ // Read directly via RLS ("creators read own frames") — the agent's JWT gates it
121
+ // to screen_share actions it created. No edge function needed.
122
+ const sb = getSupabase();
123
+ const { data, error } = await sb
124
+ .from("action_screen_frames")
125
+ .select("image_jpeg, width, seq, updated_at")
126
+ .eq("action_id", input.action_id)
127
+ .maybeSingle();
128
+ if (error) throw new Error(error.message);
129
+ if (!data) {
130
+ return { mcpContent: [{ type: "text", text: "No frame yet — the recipient hasn't started sharing their screen (or you don't own this action)." }] };
131
+ }
132
+ const row = data as { image_jpeg: string; width: number | null; seq: number; updated_at: string };
133
+ const ageSec = Math.round((Date.now() - new Date(row.updated_at).getTime()) / 1000);
134
+ return {
135
+ mcpContent: [
136
+ { type: "text", text: `Latest screen frame — seq ${row.seq}, ${row.width ?? "?"}px wide, ${ageSec}s old.` },
137
+ { type: "image", data: row.image_jpeg, mimeType: "image/jpeg" },
138
+ ],
139
+ };
140
+ }
141
+
105
142
  export const actionTools: MosaddTool[] = [
106
143
  {
107
144
  // RFC 0001: channel-agnostic capability (link is sent over ANY channel), so it
@@ -114,4 +151,12 @@ export const actionTools: MosaddTool[] = [
114
151
  inputSchema: action_create_input,
115
152
  handler: action_create as MosaddTool["handler"],
116
153
  },
154
+ {
155
+ name: "comms_action_frame_get",
156
+ requires: "network",
157
+ description:
158
+ "See the LATEST screen frame from a 'screen_share' action you created (pass the action_id from comms_action_create). Returns the current screenshot AS AN IMAGE you can look at, plus how old it is. The recipient must have opened the link and clicked 'share screen' first. Poll this every few seconds to watch live. VIEW ONLY — you cannot click or control their screen. Returns a 'no frame yet' note until they start sharing.",
159
+ inputSchema: action_frame_get_input,
160
+ handler: action_frame_get as MosaddTool["handler"],
161
+ },
117
162
  ];
@@ -0,0 +1,108 @@
1
+ /**
2
+ * comms_embed — let a builder-agent drop a LIVE mosadd channel into the app/site
3
+ * it is generating.
4
+ *
5
+ * Mints a publishable embed key (`m_pk_live_…`) scoped to a channel + the app's
6
+ * domain(s) via the `embed-keys` Edge Function, and returns a paste-in HTML
7
+ * snippet that loads the mosadd widget from the CDN (embed.mosadd.com/v1.js).
8
+ *
9
+ * Security: the publishable key is safe to ship in HTML — it can ONLY mint
10
+ * channel-scoped JWTs (the widget exchanges it at runtime via `mirc-embed-token`,
11
+ * validated against the key's origin allow-list). Your hub key (`mosadd_sk_live_…`)
12
+ * never enters the browser. The action is owned by the calling user (user-JWT
13
+ * scoped — `mosadd login` / MOSADD_USER_JWT / hub-key exchange).
14
+ *
15
+ * Reuses the shipped embed infra (apps/embed widget + embed-keys + mirc-embed-token).
16
+ * RFC 0001: channel-agnostic capability → `comms_` namespace (not an m<MODULE>_ prefix).
17
+ */
18
+
19
+ import { z } from "zod";
20
+ import type { MosaddTool, MosaddToolContext } from "../types.js";
21
+ import { invokeFunction, readSupabaseEnv } from "../providers/supabase.js";
22
+
23
+ /** Widget CDN base. Override with MOSADD_EMBED_CDN for self-host / dev. */
24
+ const EMBED_CDN = (process.env.MOSADD_EMBED_CDN ?? "https://embed.mosadd.com").replace(/\/+$/, "");
25
+
26
+ const POSITIONS = ["inline", "sidebar-left", "sidebar-right", "floating-bl", "floating-br", "fullscreen"] as const;
27
+ const SKINS = ["default", "retro-irc-1990", "terminal", "minimal-dark", "minimal-light"] as const;
28
+
29
+ const embed_create_input = z.object({
30
+ channel: z
31
+ .string().min(1).max(128).regex(/^[A-Za-z0-9_-]+$/)
32
+ .describe("The mIRC channel id everyone on the embed shares (e.g. 'acme-support'). Auto-created on first message if new."),
33
+ allowed_origins: z
34
+ .array(z.string().min(1)).min(1).max(10)
35
+ .describe("REQUIRED. Domain(s) where the widget will be served — the key only works from these origins. Use the host(s) of the app you're building, e.g. ['app.acme.com','*.acme.com']. For local testing use mode:'test' and e.g. 'localhost:3000'."),
36
+ name: z.string().max(64).optional().describe("Label for the key in the owner's dashboard. Default 'embed: <channel>'."),
37
+ position: z.enum(POSITIONS).optional().describe("Where the widget renders. Default 'inline'."),
38
+ skin: z.enum(SKINS).optional().describe("Visual skin. Default 'default' (mosadd-branded retro mIRC)."),
39
+ title: z.string().max(60).optional().describe("Header title shown in the widget. Default 'mIRC'."),
40
+ anon: z.boolean().optional().describe("Allow visitors to join with just a nick (no mosadd account). Default true."),
41
+ locale: z.enum(["en", "pl"]).optional().describe("Widget UI language. Default 'en'."),
42
+ mode: z.enum(["live", "test"]).optional().describe("Key mode — 'test' for local/dev origins, 'live' for production. Default 'live'."),
43
+ });
44
+
45
+ interface EmbedKeyResult {
46
+ id?: string;
47
+ key?: string;
48
+ pk_prefix?: string;
49
+ allowed_channels?: string[];
50
+ error?: string;
51
+ }
52
+
53
+ interface EmbedCreateResult {
54
+ embed_key: string;
55
+ channel: string;
56
+ allowed_origins: string[];
57
+ snippet: string;
58
+ }
59
+
60
+ /** HTML-attr-safe: drop quotes/angle brackets (inputs are already length-bounded). */
61
+ const attrSafe = (s: string): string => s.replace(/["'<>]/g, "");
62
+
63
+ function buildSnippet(input: z.infer<typeof embed_create_input>, key: string): string {
64
+ const attrs = [`data-channel="${attrSafe(input.channel)}"`, `data-position="${input.position ?? "inline"}"`];
65
+ if (input.skin) attrs.push(`data-skin="${input.skin}"`);
66
+ if (input.title) attrs.push(`data-title="${attrSafe(input.title)}"`);
67
+ if (input.anon === false) attrs.push(`data-anon="false"`);
68
+ if (input.locale) attrs.push(`data-locale="${input.locale}"`);
69
+ return (
70
+ `<div id="mosadd-mirc" ${attrs.join(" ")}></div>\n` +
71
+ `<script src="${EMBED_CDN}/v1.js" data-key="${key}"></script>`
72
+ );
73
+ }
74
+
75
+ async function embed_create(
76
+ input: z.infer<typeof embed_create_input>,
77
+ ctx: MosaddToolContext,
78
+ ): Promise<EmbedCreateResult> {
79
+ readSupabaseEnv();
80
+ ctx.log("debug", "comms_embed_create minting embed key", { channel: input.channel, origins: input.allowed_origins.length });
81
+
82
+ const res = await invokeFunction<EmbedKeyResult>("embed-keys", {
83
+ name: input.name ?? `embed: ${input.channel}`,
84
+ channels: [input.channel],
85
+ allowed_origins: input.allowed_origins,
86
+ mode: input.mode ?? "live",
87
+ });
88
+ if (res.error) throw new Error(res.error);
89
+ if (!res.key) throw new Error("embed-keys returned no publishable key (missing `key`).");
90
+
91
+ return {
92
+ embed_key: res.key,
93
+ channel: input.channel,
94
+ allowed_origins: input.allowed_origins,
95
+ snippet: buildSnippet(input, res.key),
96
+ };
97
+ }
98
+
99
+ export const embedTools: MosaddTool[] = [
100
+ {
101
+ name: "comms_embed_create",
102
+ requires: "network",
103
+ description:
104
+ "Embed a LIVE mosadd chat channel into an app/site you're building (great for builder-agents on Lovable/Bolt/Cursor/v0). Mints a publishable embed key scoped to a channel + the app's domain(s) and returns a ready-to-paste HTML snippet (a <div> + <script src=embed.mosadd.com/v1.js data-key=…>). Visitors of the host page chat in real time (anonymous nick or mosadd login). REQUIRES `allowed_origins` — the domain(s) the app is served from (the key only works there). The publishable key is browser-safe (mints only channel-scoped JWTs); your hub key never leaves the server. Returns { embed_key, channel, allowed_origins, snippet }. Extends mROOM_create_guest_link (link → embeddable widget).",
105
+ inputSchema: embed_create_input,
106
+ handler: embed_create as MosaddTool["handler"],
107
+ },
108
+ ];
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * Tool registry. Each m* module contributes a set of tools.
3
3
  *
4
- * Live modules (6): mDM, mIRC, mROOM, mTALK, mAIL, mRAG — 61 tools + comms_capabilities.
5
- * Plus action links (Tier 1): comms_action_create — agent → user one-link browser action.
4
+ * Live modules (6): mDM, mIRC, mROOM, mTALK, mAIL, mRAG — 70 tools + comms_capabilities.
5
+ * Plus action links: comms_action_create (agent → user one-link browser action,
6
+ * incl. screen_share) + comms_action_frame_get (see the recipient's shared screen).
6
7
  * mURL is a consumer/brand surface (murl.mosadd.com), NOT a dev product — its tools
7
8
  * live in tools/murl.ts but are NOT registered here (founder decision 2026-06-10).
8
9
  * mCALL is carrier-pending (no telephony carrier live yet): its tools live in
@@ -27,6 +28,7 @@ import { pttIngestTools } from "./ptt-ingest.js";
27
28
  // import { mcallTools } from "./mcall.js"; // mCALL: carrier-pending — not registered (see header note)
28
29
  import { knowledgeTools } from "./knowledge.js";
29
30
  import { actionTools } from "./actions.js";
31
+ import { embedTools } from "./embed.js";
30
32
  // import { murlTools } from "./murl.js"; // mURL: brand/consumer surface, not a dev product — not registered
31
33
  import { makeCapabilitiesTool } from "./capabilities.js";
32
34
 
@@ -47,6 +49,7 @@ const channelTools: MosaddTool[] = [
47
49
  ...pttIngestTools,
48
50
  ...knowledgeTools,
49
51
  ...actionTools, // Action links (Tier 1): agent → user one-link browser action via action-create EF
52
+ ...embedTools, // comms_embed_create: agent embeds a live channel into the app it builds (embed-keys EF + embed.mosadd.com widget)
50
53
  // ...murlTools, // mURL: brand/consumer surface (murl.mosadd.com), not a dev product
51
54
  // ...mcallTools, // mCALL: carrier-pending (no telephony carrier live) — re-register when a carrier is configured
52
55
  // mirlTools,