@mosadd/mcp 3.0.0-alpha.16 → 3.0.0-alpha.17
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 +71 -0
- package/README.md +44 -29
- package/dist/bin/mcp.js +38 -2
- package/dist/{chunk-KZ3HIZ74.js → chunk-5ZMJB5YU.js} +38 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/package.json +5 -4
- package/src/bin/mcp.ts +45 -0
- package/src/server.ts +6 -0
- package/src/tools/actions.ts +48 -3
- package/src/tools/index.ts +3 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
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.17] — 2026-06-18
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- **Action Links — screen share.** `comms_action_create` gains a `screen_share` action
|
|
13
|
+
type, and a new `comms_action_frame_get` tool lets the creating agent read frames of the
|
|
14
|
+
recipient's shared screen (consent-gated, browser-sandbox only). Turns Action Links into
|
|
15
|
+
"remote-desktop-lite" — the agent sees what the human chooses to share.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- **Durable `mosadd login`.** The saved session (`~/.mosadd/session.json`) is now refreshed
|
|
19
|
+
from its refresh token at server boot, so a single `mosadd login` keeps working across
|
|
20
|
+
restarts — no more re-login when the access token expires.
|
|
21
|
+
- Onboarding README restructured (recommended auth path — `mosadd login` — first; hub API
|
|
22
|
+
key second; DevTools JWT demoted), and the 61→70 / `mosadd.dev`→`mosadd.com` reconciliation
|
|
23
|
+
(first shipped on the published package with this release).
|
|
24
|
+
|
|
25
|
+
## [3.0.0-alpha.16] — 2026-06-17
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
- `mAIL_view` now calls the `mp0st-get` Edge Function (read a message by id,
|
|
29
|
+
owner-scoped) instead of `mp0st-view` (the tracking-pixel endpoint, which
|
|
30
|
+
returned "Missing tracking ID"). ([LINEAR-2917])
|
|
31
|
+
- CI publish drops `--provenance` — npm returned 422 because the source repo
|
|
32
|
+
(`mosadd-os`) is private, so provenance attestation is not available.
|
|
33
|
+
|
|
34
|
+
### Added (cumulative since alpha.4 — tool count 61 → 70)
|
|
35
|
+
- **Action links (Tier 1):** `comms_action_create` mints a one-link browser
|
|
36
|
+
action an agent can hand to a human (run-with-consent in the mosadd sandbox).
|
|
37
|
+
- **mAIL provenance:** `mAIL_send_as_agent` stamps agent/human provenance on the
|
|
38
|
+
message so the recipient sees who actually sent it.
|
|
39
|
+
- **File & voice attachments:** `mDM_send_voice` / `mDM_send_file`,
|
|
40
|
+
`mROOM_send_voice` / `mROOM_send_file`, `mIRC_send_voice` / `mIRC_send_file`
|
|
41
|
+
(reuse the existing `chat-files` bucket — no new transport).
|
|
42
|
+
- **mTALK → RAG:** `mTALK_ingest_ptt` feeds push-to-talk audio into the RAG index
|
|
43
|
+
(opt-in, gated server-side).
|
|
44
|
+
- **mROOM:** `mROOM_create_guest_link` (single-call, no-account guest links) and
|
|
45
|
+
`mROOM_voice_join`.
|
|
46
|
+
- **mIRC edge transport:** `mIRC_mint_channel_token`, `mIRC_send_edge`,
|
|
47
|
+
`mIRC_history_edge` — the low-latency path the agent-coordination skill rides.
|
|
48
|
+
|
|
49
|
+
### Changed
|
|
50
|
+
- README, `package.json`, and the plugin `marketplace.json` reconciled to the
|
|
51
|
+
current surface: **70 tools across 6 modules** + `comms_capabilities`
|
|
52
|
+
discovery (71 callable), version `alpha.16`, and `mosadd.dev` → `mosadd.com`
|
|
53
|
+
(the dev surface was consolidated into the main site). ([LINEAR-3391])
|
|
54
|
+
- `mCALL` (telephony, carrier-pending) and `mURL` (brand/consumer surface)
|
|
55
|
+
remain **unregistered** in `tools/index.ts` — an agent only ever discovers
|
|
56
|
+
tools that actually work.
|
|
57
|
+
|
|
58
|
+
## [3.0.0-alpha.4]
|
|
59
|
+
|
|
60
|
+
### Added
|
|
61
|
+
- Initial public alpha: **61 tools across 6 live modules** — mDM (incl. voice),
|
|
62
|
+
mIRC, mROOM, mAIL, mTALK, mRAG — plus the `comms_capabilities` discovery tool.
|
|
63
|
+
- BYOK mode: the server talks to your own mosadd Supabase backend via
|
|
64
|
+
`MOSADD_SUPABASE_URL` / `MOSADD_SUPABASE_ANON_KEY` / `MOSADD_USER_JWT`.
|
|
65
|
+
- Apache-2.0 license; tool names follow [RFC 0001] (`m<MODULE>_<operation>`).
|
|
66
|
+
|
|
67
|
+
[3.0.0-alpha.16]: https://github.com/Hei33enberg/mosadd-os/tree/main/packages/mcp
|
|
68
|
+
[3.0.0-alpha.4]: https://github.com/Hei33enberg/mosadd-os/tree/main/packages/mcp
|
|
69
|
+
[LINEAR-2917]: https://linear.app/ip-ra/issue/LINEAR-2917
|
|
70
|
+
[LINEAR-3391]: https://linear.app/ip-ra/issue/LINEAR-3391
|
|
71
|
+
[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.
|
|
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.
|
|
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
|
-
##
|
|
7
|
+
## Connect your agent
|
|
8
8
|
|
|
9
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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` —
|
|
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
|
|
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
|
-
**
|
|
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** (
|
|
61
|
-
| **mIRC** (
|
|
62
|
-
| **mROOM** (
|
|
63
|
-
| **
|
|
64
|
-
| **
|
|
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-
|
|
5
|
-
import
|
|
4
|
+
} from "../chunk-5ZMJB5YU.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,6 +2245,13 @@ 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
|
|
|
@@ -2465,6 +2497,10 @@ function createMosaddServer(options = {}) {
|
|
|
2465
2497
|
const parsed = tool.inputSchema.parse(input);
|
|
2466
2498
|
try {
|
|
2467
2499
|
const result = await tool.handler(parsed, ctx);
|
|
2500
|
+
const rich = result;
|
|
2501
|
+
if (rich && Array.isArray(rich.mcpContent)) {
|
|
2502
|
+
return { content: rich.mcpContent };
|
|
2503
|
+
}
|
|
2468
2504
|
return {
|
|
2469
2505
|
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
2470
2506
|
};
|
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 —
|
|
199
|
-
* Plus action links
|
|
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
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mosadd/mcp",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
4
|
-
"description": "Model Context Protocol server for mosadd. Exposes the 6 live m* modules (mDM, mIRC, mROOM, mTALK, mAIL, mRAG) —
|
|
3
|
+
"version": "3.0.0-alpha.17",
|
|
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": {
|
|
@@ -37,8 +38,8 @@
|
|
|
37
38
|
"@supabase/supabase-js": "^2.48.0",
|
|
38
39
|
"zod": "^4.3.6",
|
|
39
40
|
"@mosadd/crypto": "3.0.0-alpha.4",
|
|
40
|
-
"@mosadd/
|
|
41
|
-
"@mosadd/
|
|
41
|
+
"@mosadd/providers": "3.0.0-alpha.4",
|
|
42
|
+
"@mosadd/protocol": "3.0.0-alpha.4"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"tsup": "^8.3.5",
|
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
|
};
|
package/src/tools/actions.ts
CHANGED
|
@@ -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
|
];
|
package/src/tools/index.ts
CHANGED
|
@@ -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 —
|
|
5
|
-
* Plus action links
|
|
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
|