@mosadd/mcp 3.0.0-alpha.57 → 3.0.0-alpha.58

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 CHANGED
@@ -8,6 +8,14 @@ gateway (Phase 2) ships.
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [3.0.0-alpha.58] — 2026-11-16
12
+
13
+ ### Added
14
+ - **CLI:** `npx @mosadd/mcp --version`, `--help` and `tools` print (version, commands + env vars, all tools grouped by module) and exit instead of starting the stdio server.
15
+
16
+ ### Fixed
17
+ - The "ready" log line now reports the `package.json` version (it said `3.0.0-alpha.0`).
18
+
11
19
  ## [3.0.0-alpha.57] — 2026-11-15
12
20
 
13
21
  ### Fixed
package/README.md CHANGED
@@ -123,6 +123,19 @@ mosadd.com app (receiver)
123
123
 
124
124
  For PTT / CALL (real-time media), the architecture separates **control plane** (MCP) from **data plane** (WebRTC daemon). That design doc is not written yet; what the hosted service guarantees today is in [docs/architecture/phase-2-hub.md](https://github.com/Hei33enberg/mosADD-OS/blob/main/docs/architecture/phase-2-hub.md).
125
125
 
126
+ ## CLI
127
+
128
+ `npx @mosadd/mcp` with no arguments starts the MCP server over stdio (what your agent runtime runs). These commands print and exit instead:
129
+
130
+ | Command | What it does |
131
+ |---|---|
132
+ | `npx @mosadd/mcp --version` (`-v`) | prints the installed version (from `package.json`) |
133
+ | `npx @mosadd/mcp --help` (`-h`) | prints the commands and the environment variables, including `MOSADD_API_KEY` |
134
+ | `npx @mosadd/mcp tools` | lists every registered tool, grouped by module |
135
+ | `npx @mosadd/mcp login` / `logout` / `whoami` | save, delete, or show the signed-in session |
136
+
137
+ The server's `serverInfo.version` and its "ready" log line use the same `package.json` version.
138
+
126
139
  ## Configuration via env vars
127
140
 
128
141
  | Env | Description | Required |
package/dist/bin/mcp.js CHANGED
@@ -1,7 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
+ PKG_VERSION,
4
+ allTools,
3
5
  createMosaddServer
4
- } from "../chunk-WEGSITAH.js";
6
+ } from "../chunk-W4FAEM6N.js";
5
7
  import {
6
8
  isSessionExpired,
7
9
  loadSession,
@@ -11,6 +13,77 @@ import {
11
13
  // src/bin/mcp.ts
12
14
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
13
15
  import { createClient } from "@supabase/supabase-js";
16
+
17
+ // src/cli.ts
18
+ function parseCli(args) {
19
+ const first = args[0];
20
+ if (args.includes("--version") || args.includes("-v") || first === "version") return { kind: "version" };
21
+ if (args.includes("--help") || args.includes("-h") || first === "help") return { kind: "help" };
22
+ if (first === "tools") return { kind: "tools" };
23
+ if (first === "login" || first === "logout" || first === "whoami") return { kind: "auth", sub: first, rest: args.slice(1) };
24
+ return { kind: "serve" };
25
+ }
26
+ function renderVersion(version) {
27
+ return `${version}
28
+ `;
29
+ }
30
+ function renderHelp(version) {
31
+ return [
32
+ `mosadd-mcp ${version} \u2014 mosADD MCP server (stdio)`,
33
+ ``,
34
+ `Usage:`,
35
+ ` npx @mosadd/mcp [command] [options]`,
36
+ ``,
37
+ `Commands:`,
38
+ ` (none) start the MCP server over stdio (what your agent runtime runs)`,
39
+ ` login sign in and save a session on this machine`,
40
+ ` logout delete the saved session`,
41
+ ` whoami show which identity the saved session / MOSADD_API_KEY resolves to`,
42
+ ` tools list every tool this server registers, grouped by module, and exit`,
43
+ ``,
44
+ `Options:`,
45
+ ` -v, --version print the version and exit`,
46
+ ` -h, --help print this help and exit`,
47
+ ``,
48
+ `Environment:`,
49
+ ` MOSADD_API_KEY hub API key \u2014 exchanged for a short-lived session at boot (hosted mode)`,
50
+ ` MOSADD_HUB_URL override the hub url`,
51
+ ` MOSADD_MODE local | cloud`,
52
+ ` MOSADD_LOG_LEVEL debug | info | warn | error (default info)`,
53
+ ` See the README for the full list (Supabase BYOK, Resend, LiveKit).`,
54
+ ``
55
+ ].join("\n");
56
+ }
57
+ function moduleOf(toolName) {
58
+ const i = toolName.indexOf("_");
59
+ return i > 0 ? toolName.slice(0, i) : toolName;
60
+ }
61
+ function groupTools(tools) {
62
+ const by = /* @__PURE__ */ new Map();
63
+ for (const t of tools) {
64
+ const m = moduleOf(t.name);
65
+ by.set(m, [...by.get(m) ?? [], t]);
66
+ }
67
+ return [...by.entries()].map(([module, list]) => ({ module, tools: [...list].sort((a, b) => a.name.localeCompare(b.name)) })).sort((a, b) => b.tools.length - a.tools.length || a.module.localeCompare(b.module));
68
+ }
69
+ var oneLine = (s, max = 90) => {
70
+ const t = String(s ?? "").replace(/\s+/g, " ").trim();
71
+ const dot = t.search(/[.!?](\s|$)/);
72
+ const first = dot > 0 ? t.slice(0, dot + 1) : t;
73
+ return first.length > max ? `${first.slice(0, max - 1)}\u2026` : first;
74
+ };
75
+ function renderTools(tools) {
76
+ const groups = groupTools(tools);
77
+ const lines = [`${tools.length} tools in ${groups.length} groups`, ``];
78
+ for (const g of groups) {
79
+ lines.push(`${g.module} (${g.tools.length})`);
80
+ for (const t of g.tools) lines.push(` ${t.name}${t.description ? ` \u2014 ${oneLine(t.description)}` : ""}`);
81
+ lines.push(``);
82
+ }
83
+ return lines.join("\n");
84
+ }
85
+
86
+ // src/bin/mcp.ts
14
87
  var DEFAULT_EXCHANGE = "https://rooffhgbxafyjcwmwpsy.supabase.co/functions/v1/hub-key-exchange";
15
88
  async function bootstrapFromApiKey() {
16
89
  const apiKey = process.env.MOSADD_API_KEY;
@@ -69,10 +142,22 @@ async function bootstrapFromSavedSession() {
69
142
  }
70
143
  }
71
144
  async function main() {
72
- const sub = process.argv[2];
73
- if (sub === "login" || sub === "logout" || sub === "whoami") {
145
+ const action = parseCli(process.argv.slice(2));
146
+ if (action.kind === "version") {
147
+ process.stdout.write(renderVersion(PKG_VERSION));
148
+ return;
149
+ }
150
+ if (action.kind === "help") {
151
+ process.stdout.write(renderHelp(PKG_VERSION));
152
+ return;
153
+ }
154
+ if (action.kind === "tools") {
155
+ process.stdout.write(renderTools(allTools));
156
+ return;
157
+ }
158
+ if (action.kind === "auth") {
74
159
  const { runAuthCommand } = await import("./login.js");
75
- await runAuthCommand(sub, process.argv.slice(3));
160
+ await runAuthCommand(action.sub, action.rest);
76
161
  return;
77
162
  }
78
163
  await bootstrapFromApiKey();
@@ -92,7 +177,7 @@ async function main() {
92
177
  JSON.stringify({
93
178
  level: "info",
94
179
  msg: "mosadd MCP server ready",
95
- version: "3.0.0-alpha.0",
180
+ version: PKG_VERSION,
96
181
  ts: (/* @__PURE__ */ new Date()).toISOString()
97
182
  }) + "\n"
98
183
  );
@@ -3966,13 +3966,10 @@ var allTools = [
3966
3966
  ];
3967
3967
  var TOOL_COUNT = allTools.length;
3968
3968
 
3969
- // src/server.ts
3970
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3971
-
3972
3969
  // package.json
3973
3970
  var package_default = {
3974
3971
  name: "@mosadd/mcp",
3975
- version: "3.0.0-alpha.57",
3972
+ version: "3.0.0-alpha.58",
3976
3973
  mcpName: "io.github.hei33enberg/mosadd-mcp",
3977
3974
  description: "Model Context Protocol server for mosadd. Exposes 4 modules (mDM, mIRC, mURL, mAYL) and capabilities (mTALK, mRAG) plus comms agent-actions \u2014 85 tools \u2014 to any agent runtime (Claude Code, Cursor, Windsurf, Cline, ChatGPT Apps, Lovable, Bolt, Goose, Manus, custom).",
3978
3975
  homepage: "https://github.com/Hei33enberg/mosADD-OS/tree/main/packages/mcp",
@@ -4047,6 +4044,9 @@ var package_default = {
4047
4044
  // src/version.ts
4048
4045
  var PKG_VERSION = package_default.version;
4049
4046
 
4047
+ // src/server.ts
4048
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4049
+
4050
4050
  // src/providers/supabase-voice.ts
4051
4051
  var ROOM_PREFIX = "mosadd-room-";
4052
4052
  var SupabaseVoiceProvider = class {
@@ -4223,6 +4223,7 @@ export {
4223
4223
  runWithSupabaseEnv,
4224
4224
  allTools,
4225
4225
  TOOL_COUNT,
4226
+ PKG_VERSION,
4226
4227
  defaultProviders,
4227
4228
  createMosaddServer
4228
4229
  };
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  createMosaddServer,
5
5
  defaultProviders,
6
6
  runWithSupabaseEnv
7
- } from "./chunk-WEGSITAH.js";
7
+ } from "./chunk-W4FAEM6N.js";
8
8
  import "./chunk-Z7WR52GE.js";
9
9
  export {
10
10
  TOOL_COUNT,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mosadd/mcp",
3
- "version": "3.0.0-alpha.57",
3
+ "version": "3.0.0-alpha.58",
4
4
  "mcpName": "io.github.hei33enberg/mosadd-mcp",
5
5
  "description": "Model Context Protocol server for mosadd. Exposes 4 modules (mDM, mIRC, mURL, mAYL) and capabilities (mTALK, mRAG) plus comms agent-actions — 85 tools — to any agent runtime (Claude Code, Cursor, Windsurf, Cline, ChatGPT Apps, Lovable, Bolt, Goose, Manus, custom).",
6
6
  "homepage": "https://github.com/Hei33enberg/mosADD-OS/tree/main/packages/mcp",
@@ -0,0 +1,47 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { readFileSync } from "node:fs";
3
+ import { fileURLToPath } from "node:url";
4
+ import { dirname, resolve } from "node:path";
5
+ import { allTools, TOOL_COUNT } from "../tools/index.js";
6
+ import { PKG_VERSION } from "../version.js";
7
+ import { groupTools, moduleOf, parseCli, renderHelp, renderTools, renderVersion } from "../cli.js";
8
+
9
+ const here = dirname(fileURLToPath(import.meta.url));
10
+ const pkg = JSON.parse(readFileSync(resolve(here, "../../package.json"), "utf8")) as { version: string };
11
+
12
+ describe("CLI: parseCli", () => {
13
+ it("--version / -v / version print and never serve", () => {
14
+ for (const a of [["--version"], ["-v"], ["version"], ["tools", "--version"]]) expect(parseCli(a).kind).toBe("version");
15
+ });
16
+ it("--help / -h / help print and never serve", () => {
17
+ for (const a of [["--help"], ["-h"], ["help"]]) expect(parseCli(a).kind).toBe("help");
18
+ });
19
+ it("tools lists, auth subcommands keep their args, no args serves", () => {
20
+ expect(parseCli(["tools"]).kind).toBe("tools");
21
+ expect(parseCli(["login", "--email", "a@b.c"])).toEqual({ kind: "auth", sub: "login", rest: ["--email", "a@b.c"] });
22
+ expect(parseCli(["whoami"]).kind).toBe("auth");
23
+ expect(parseCli([]).kind).toBe("serve");
24
+ });
25
+ });
26
+
27
+ describe("CLI: output", () => {
28
+ it("version comes from package.json, not a hand-typed string", () => {
29
+ expect(PKG_VERSION).toBe(pkg.version);
30
+ expect(renderVersion(PKG_VERSION)).toBe(`${pkg.version}\n`);
31
+ expect(renderVersion(PKG_VERSION)).not.toContain("alpha.0");
32
+ });
33
+ it("help lists the commands and MOSADD_API_KEY", () => {
34
+ const h = renderHelp(PKG_VERSION);
35
+ for (const w of ["login", "logout", "whoami", "tools", "--version", "--help", "MOSADD_API_KEY"]) expect(h).toContain(w);
36
+ expect(h).toContain(pkg.version);
37
+ });
38
+ it("tools prints every registered tool exactly once, grouped by module", () => {
39
+ const out = renderTools(allTools);
40
+ expect(out.startsWith(`${TOOL_COUNT} tools in `)).toBe(true);
41
+ for (const t of allTools) expect(out).toContain(` ${t.name}`);
42
+ const groups = groupTools(allTools);
43
+ expect(groups.reduce((n, g) => n + g.tools.length, 0)).toBe(TOOL_COUNT);
44
+ expect(groups.map((g) => g.module)).toContain("mDM");
45
+ for (const g of groups) for (const t of g.tools) expect(moduleOf(t.name)).toBe(g.module);
46
+ });
47
+ });
package/src/bin/mcp.ts CHANGED
@@ -13,6 +13,9 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
13
13
  import { createClient } from "@supabase/supabase-js";
14
14
  import { createMosaddServer } from "../server.js";
15
15
  import { loadSession, saveSession, isSessionExpired } from "../config.js";
16
+ import { allTools } from "../tools/index.js";
17
+ import { PKG_VERSION } from "../version.js";
18
+ import { parseCli, renderHelp, renderTools, renderVersion } from "../cli.js";
16
19
 
17
20
  const DEFAULT_EXCHANGE =
18
21
  "https://rooffhgbxafyjcwmwpsy.supabase.co/functions/v1/hub-key-exchange";
@@ -95,11 +98,25 @@ async function bootstrapFromSavedSession(): Promise<void> {
95
98
  }
96
99
 
97
100
  async function main(): Promise<void> {
98
- // Auth subcommands: `mosadd login | logout | whoami`. Everything else starts the server.
99
- const sub = process.argv[2];
100
- if (sub === "login" || sub === "logout" || sub === "whoami") {
101
+ // CLI: `--version`, `--help`, `tools` print and exit (they must NEVER start the stdio server — a bare
102
+ // `npx @mosadd/mcp --version` used to hang waiting for an MCP client). Auth subcommands: login | logout | whoami.
103
+ // Everything else starts the server.
104
+ const action = parseCli(process.argv.slice(2));
105
+ if (action.kind === "version") {
106
+ process.stdout.write(renderVersion(PKG_VERSION));
107
+ return;
108
+ }
109
+ if (action.kind === "help") {
110
+ process.stdout.write(renderHelp(PKG_VERSION));
111
+ return;
112
+ }
113
+ if (action.kind === "tools") {
114
+ process.stdout.write(renderTools(allTools));
115
+ return;
116
+ }
117
+ if (action.kind === "auth") {
101
118
  const { runAuthCommand } = await import("./login.js");
102
- await runAuthCommand(sub, process.argv.slice(3));
119
+ await runAuthCommand(action.sub, action.rest);
103
120
  return;
104
121
  }
105
122
 
@@ -126,7 +143,7 @@ async function main(): Promise<void> {
126
143
  JSON.stringify({
127
144
  level: "info",
128
145
  msg: "mosadd MCP server ready",
129
- version: "3.0.0-alpha.0",
146
+ version: PKG_VERSION,
130
147
  ts: new Date().toISOString(),
131
148
  }) + "\n",
132
149
  );
package/src/cli.ts ADDED
@@ -0,0 +1,100 @@
1
+ /**
2
+ * CLI front of `npx @mosadd/mcp` — the parts that print and exit instead of starting the stdio server.
3
+ *
4
+ * --version / -v print the package.json version and exit
5
+ * --help / -h print commands + env vars and exit
6
+ * tools print every registered tool, grouped by module, and exit
7
+ *
8
+ * Pure functions on purpose (no process.exit, no I/O): bin/mcp.ts decides what to do with the result,
9
+ * and the tests call these directly. The version comes from ./version.js (= package.json), never typed here.
10
+ */
11
+
12
+ export interface CliTool {
13
+ name: string;
14
+ description?: string;
15
+ }
16
+
17
+ export type CliAction =
18
+ | { kind: "version" }
19
+ | { kind: "help" }
20
+ | { kind: "tools" }
21
+ | { kind: "auth"; sub: "login" | "logout" | "whoami"; rest: string[] }
22
+ | { kind: "serve" };
23
+
24
+ /** Decide what `argv` (process.argv.slice(2)) asks for. Flags win over subcommands; anything unknown starts the server. */
25
+ export function parseCli(args: readonly string[]): CliAction {
26
+ const first = args[0];
27
+ if (args.includes("--version") || args.includes("-v") || first === "version") return { kind: "version" };
28
+ if (args.includes("--help") || args.includes("-h") || first === "help") return { kind: "help" };
29
+ if (first === "tools") return { kind: "tools" };
30
+ if (first === "login" || first === "logout" || first === "whoami") return { kind: "auth", sub: first, rest: args.slice(1) };
31
+ return { kind: "serve" };
32
+ }
33
+
34
+ export function renderVersion(version: string): string {
35
+ return `${version}\n`;
36
+ }
37
+
38
+ export function renderHelp(version: string): string {
39
+ return [
40
+ `mosadd-mcp ${version} — mosADD MCP server (stdio)`,
41
+ ``,
42
+ `Usage:`,
43
+ ` npx @mosadd/mcp [command] [options]`,
44
+ ``,
45
+ `Commands:`,
46
+ ` (none) start the MCP server over stdio (what your agent runtime runs)`,
47
+ ` login sign in and save a session on this machine`,
48
+ ` logout delete the saved session`,
49
+ ` whoami show which identity the saved session / MOSADD_API_KEY resolves to`,
50
+ ` tools list every tool this server registers, grouped by module, and exit`,
51
+ ``,
52
+ `Options:`,
53
+ ` -v, --version print the version and exit`,
54
+ ` -h, --help print this help and exit`,
55
+ ``,
56
+ `Environment:`,
57
+ ` MOSADD_API_KEY hub API key — exchanged for a short-lived session at boot (hosted mode)`,
58
+ ` MOSADD_HUB_URL override the hub url`,
59
+ ` MOSADD_MODE local | cloud`,
60
+ ` MOSADD_LOG_LEVEL debug | info | warn | error (default info)`,
61
+ ` See the README for the full list (Supabase BYOK, Resend, LiveKit).`,
62
+ ``,
63
+ ].join("\n");
64
+ }
65
+
66
+ /** Module a tool belongs to: the part of the name before the first underscore (mDM_send -> mDM). */
67
+ export function moduleOf(toolName: string): string {
68
+ const i = toolName.indexOf("_");
69
+ return i > 0 ? toolName.slice(0, i) : toolName;
70
+ }
71
+
72
+ /** Tools grouped by module, groups ordered by size (largest first, then name), tools alphabetical inside a group. */
73
+ export function groupTools(tools: readonly CliTool[]): { module: string; tools: CliTool[] }[] {
74
+ const by = new Map<string, CliTool[]>();
75
+ for (const t of tools) {
76
+ const m = moduleOf(t.name);
77
+ by.set(m, [...(by.get(m) ?? []), t]);
78
+ }
79
+ return [...by.entries()]
80
+ .map(([module, list]) => ({ module, tools: [...list].sort((a, b) => a.name.localeCompare(b.name)) }))
81
+ .sort((a, b) => b.tools.length - a.tools.length || a.module.localeCompare(b.module));
82
+ }
83
+
84
+ const oneLine = (s: string | undefined, max = 90): string => {
85
+ const t = String(s ?? "").replace(/\s+/g, " ").trim();
86
+ const dot = t.search(/[.!?](\s|$)/);
87
+ const first = dot > 0 ? t.slice(0, dot + 1) : t;
88
+ return first.length > max ? `${first.slice(0, max - 1)}…` : first;
89
+ };
90
+
91
+ export function renderTools(tools: readonly CliTool[]): string {
92
+ const groups = groupTools(tools);
93
+ const lines: string[] = [`${tools.length} tools in ${groups.length} groups`, ``];
94
+ for (const g of groups) {
95
+ lines.push(`${g.module} (${g.tools.length})`);
96
+ for (const t of g.tools) lines.push(` ${t.name}${t.description ? ` — ${oneLine(t.description)}` : ""}`);
97
+ lines.push(``);
98
+ }
99
+ return lines.join("\n");
100
+ }