@mosadd/mcp 3.0.0-alpha.58 → 3.0.0-alpha.59
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 +407 -399
- package/dist/bin/mcp.js +2 -2
- package/dist/{chunk-W4FAEM6N.js → chunk-RL4SB6UG.js} +10 -6
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/__tests__/mrag-search-answer.test.ts +42 -0
- package/src/__tests__/no-dead-host.test.ts +37 -0
- package/src/bin/mcp.ts +1 -1
- package/src/tools/knowledge.ts +351 -344
- package/src/tools/mail-provenance.ts +1 -1
- package/src/tools/mirc-edge.ts +1 -1
package/dist/bin/mcp.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
PKG_VERSION,
|
|
4
4
|
allTools,
|
|
5
5
|
createMosaddServer
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-RL4SB6UG.js";
|
|
7
7
|
import {
|
|
8
8
|
isSessionExpired,
|
|
9
9
|
loadSession,
|
|
@@ -84,7 +84,7 @@ function renderTools(tools) {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
// src/bin/mcp.ts
|
|
87
|
-
var DEFAULT_EXCHANGE = "https://
|
|
87
|
+
var DEFAULT_EXCHANGE = "https://api.mosadd.com/functions/v1/hub-key-exchange";
|
|
88
88
|
async function bootstrapFromApiKey() {
|
|
89
89
|
const apiKey = process.env.MOSADD_API_KEY;
|
|
90
90
|
if (!apiKey || process.env.MOSADD_USER_JWT) return;
|
|
@@ -2066,7 +2066,7 @@ var mircMessagesTools = [
|
|
|
2066
2066
|
// src/tools/mirc-edge.ts
|
|
2067
2067
|
import { z as z7 } from "zod";
|
|
2068
2068
|
var DEFAULT_EDGE_URL = "https://mosadd-edge.mr-brics-33.workers.dev";
|
|
2069
|
-
var DEFAULT_SUPABASE_URL = "https://
|
|
2069
|
+
var DEFAULT_SUPABASE_URL = "https://api.mosadd.com";
|
|
2070
2070
|
function edgeUrl() {
|
|
2071
2071
|
return process.env.MOSADD_EDGE_URL?.replace(/\/$/, "") ?? DEFAULT_EDGE_URL;
|
|
2072
2072
|
}
|
|
@@ -2411,7 +2411,7 @@ var mailTools = [
|
|
|
2411
2411
|
|
|
2412
2412
|
// src/tools/mail-provenance.ts
|
|
2413
2413
|
import { z as z9 } from "zod";
|
|
2414
|
-
var DEFAULT_SUPABASE_URL2 = "https://
|
|
2414
|
+
var DEFAULT_SUPABASE_URL2 = "https://api.mosadd.com";
|
|
2415
2415
|
function supabaseUrl2() {
|
|
2416
2416
|
return process.env.MOSADD_SUPABASE_URL?.replace(/\/$/, "") ?? process.env.SUPABASE_URL?.replace(/\/$/, "") ?? DEFAULT_SUPABASE_URL2;
|
|
2417
2417
|
}
|
|
@@ -2966,7 +2966,10 @@ var mRAG_search_input = z14.object({
|
|
|
2966
2966
|
source_types: z14.array(z14.enum(["message", "email", "call", "note", "contact", "file", "ptt"])).optional().describe(
|
|
2967
2967
|
"Restrict retrieval to these source types. Omit to search everything. 'file' covers anything added with mRAG_ingest (its default, and where 'note' ingests land); 'ptt' covers push-to-talk transcripts ingested by mTALK_ingest_ptt."
|
|
2968
2968
|
),
|
|
2969
|
-
thread_id: z14.string().optional().describe("Optional: restrict retrieval to a single thread id (e.g. a dm:/chat: thread).")
|
|
2969
|
+
thread_id: z14.string().optional().describe("Optional: restrict retrieval to a single thread id (e.g. a dm:/chat: thread)."),
|
|
2970
|
+
answer: z14.boolean().optional().describe(
|
|
2971
|
+
"Set true to also get a generated answer (answer field) grounded in the returned sources. Default false: ranked sources only, answer is empty."
|
|
2972
|
+
)
|
|
2970
2973
|
});
|
|
2971
2974
|
async function mRAG_search(input, ctx) {
|
|
2972
2975
|
readSupabaseEnv();
|
|
@@ -2975,7 +2978,8 @@ async function mRAG_search(input, ctx) {
|
|
|
2975
2978
|
query: input.query,
|
|
2976
2979
|
top_k: input.top_k ?? 8,
|
|
2977
2980
|
source_types: input.source_types ?? null,
|
|
2978
|
-
thread_id: input.thread_id ?? null
|
|
2981
|
+
thread_id: input.thread_id ?? null,
|
|
2982
|
+
answer: input.answer ?? false
|
|
2979
2983
|
});
|
|
2980
2984
|
return {
|
|
2981
2985
|
answer: data.answer ?? "",
|
|
@@ -3087,7 +3091,7 @@ var knowledgeTools = [
|
|
|
3087
3091
|
title: "Search memory",
|
|
3088
3092
|
annotations: { readOnlyHint: true },
|
|
3089
3093
|
requires: "network",
|
|
3090
|
-
description: "Search and answer questions over the USER'S OWN mosadd data (messages, emails, calls, notes) with a private per-user RAG index \u2014 hybrid vector + keyword retrieval, reranked, grounded in cited sources (no fabrication). Use it to recall 'what did X say about Y', summarize a thread, or pull facts the user has received.
|
|
3094
|
+
description: "Search and answer questions over the USER'S OWN mosadd data (messages, emails, calls, notes) with a private per-user RAG index \u2014 hybrid vector + keyword retrieval, reranked, grounded in cited sources (no fabrication). Use it to recall 'what did X say about Y', summarize a thread, or pull facts the user has received. By DEFAULT (via MCP) it returns the ranked source snippets only and `answer` is an empty string (answer_mode retrieve_only): fast, no model call. Pass answer:true to also get a generated answer grounded in those sources (slower, uses the model budget). If the index search runs out of time the call still succeeds and carries partial:true with partial_reason, instead of failing. This is agent memory (mRAG = RAG over your own data) over the user's communications, available outside the mosadd app. NOTE: RAG requires content to be indexed server-side in plaintext, so anything searchable here is NOT covered b",
|
|
3091
3095
|
inputSchema: mRAG_search_input,
|
|
3092
3096
|
handler: mRAG_search
|
|
3093
3097
|
},
|
|
@@ -3969,7 +3973,7 @@ var TOOL_COUNT = allTools.length;
|
|
|
3969
3973
|
// package.json
|
|
3970
3974
|
var package_default = {
|
|
3971
3975
|
name: "@mosadd/mcp",
|
|
3972
|
-
version: "3.0.0-alpha.
|
|
3976
|
+
version: "3.0.0-alpha.59",
|
|
3973
3977
|
mcpName: "io.github.hei33enberg/mosadd-mcp",
|
|
3974
3978
|
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).",
|
|
3975
3979
|
homepage: "https://github.com/Hei33enberg/mosADD-OS/tree/main/packages/mcp",
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mosadd/mcp",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.59",
|
|
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,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mRAG_search `answer` flag — forwarded to rag-query (default false = ranked sources only, no model call).
|
|
3
|
+
*/
|
|
4
|
+
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
5
|
+
|
|
6
|
+
const sent: Record<string, unknown>[] = [];
|
|
7
|
+
|
|
8
|
+
vi.mock("../providers/supabase.js", () => ({
|
|
9
|
+
readSupabaseEnv: () => ({ url: "https://example.supabase.co", anonKey: "anon", userJwt: "jwt" }),
|
|
10
|
+
invokeFunction: (_fn: string, body: Record<string, unknown>) => {
|
|
11
|
+
sent.push(body);
|
|
12
|
+
return Promise.resolve({ answer: "", sources: [], chunks_found: 0 });
|
|
13
|
+
},
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
const { knowledgeTools } = await import("../tools/knowledge.js");
|
|
17
|
+
const search = knowledgeTools.find((t) => t.name === "mRAG_search")!;
|
|
18
|
+
const ctx = { log: () => {} } as never;
|
|
19
|
+
const last = () => sent[sent.length - 1];
|
|
20
|
+
|
|
21
|
+
describe("mRAG_search answer flag", () => {
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
sent.length = 0;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("defaults to answer:false (sources only)", async () => {
|
|
27
|
+
await search.handler({ query: "co pisal Jan" }, ctx);
|
|
28
|
+
expect(last().answer).toBe(false);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("forwards answer:true", async () => {
|
|
32
|
+
await search.handler({ query: "co pisal Jan", answer: true }, ctx);
|
|
33
|
+
expect(last().answer).toBe(true);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("the input schema accepts answer and documents it", () => {
|
|
37
|
+
const shape = (search.inputSchema as unknown as { shape: Record<string, { description?: string }> }).shape;
|
|
38
|
+
expect(shape.answer).toBeDefined();
|
|
39
|
+
expect(shape.answer.description).toMatch(/generated answer/);
|
|
40
|
+
expect(search.description).toMatch(/answer:true/);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The old cloud (`rooffhgbxafyjcwmwpsy.supabase.co`) is dead; the live backend is `https://api.mosadd.com`.
|
|
3
|
+
* A published package that defaults to the dead host breaks `MOSADD_API_KEY` login (hub-key-exchange never answers),
|
|
4
|
+
* so no source file may carry the old host as a URL. Comments that merely name the project id are fine.
|
|
5
|
+
*/
|
|
6
|
+
import { describe, it, expect } from "vitest";
|
|
7
|
+
import { readdirSync, readFileSync, statSync } from "node:fs";
|
|
8
|
+
import { dirname, join, resolve } from "node:path";
|
|
9
|
+
import { fileURLToPath } from "node:url";
|
|
10
|
+
|
|
11
|
+
const SRC = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
12
|
+
const DEAD = /https?:\/\/rooffhgbxafyjcwmwpsy\.supabase\.co/i;
|
|
13
|
+
|
|
14
|
+
function walk(dir: string): string[] {
|
|
15
|
+
return readdirSync(dir).flatMap((n) => {
|
|
16
|
+
const p = join(dir, n);
|
|
17
|
+
if (n === "__tests__" || n === "node_modules") return [];
|
|
18
|
+
return statSync(p).isDirectory() ? walk(p) : /\.(ts|tsx|mjs|js)$/.test(n) ? [p] : [];
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
describe("no dead backend host in the package source", () => {
|
|
23
|
+
it("no source file carries the old supabase host as a URL", () => {
|
|
24
|
+
const hits = walk(SRC).filter((f) => DEAD.test(readFileSync(f, "utf8")));
|
|
25
|
+
expect(hits, `dead host found in: ${hits.join(", ")}`).toEqual([]);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("the default hub-key-exchange endpoint is api.mosadd.com", () => {
|
|
29
|
+
const src = readFileSync(join(SRC, "bin", "mcp.ts"), "utf8");
|
|
30
|
+
expect(src).toMatch(/DEFAULT_EXCHANGE\s*=\s*"https:\/\/api\.mosadd\.com\/functions\/v1\/hub-key-exchange"/);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it("the gate fires: the dead host would be caught", () => {
|
|
34
|
+
expect(DEAD.test('const X = "https://rooffhgbxafyjcwmwpsy.supabase.co/functions/v1/hub-key-exchange";')).toBe(true);
|
|
35
|
+
expect(DEAD.test("// project rooffhgbxafyjcwmwpsy, 16.09")).toBe(false);
|
|
36
|
+
});
|
|
37
|
+
});
|
package/src/bin/mcp.ts
CHANGED
|
@@ -18,7 +18,7 @@ import { PKG_VERSION } from "../version.js";
|
|
|
18
18
|
import { parseCli, renderHelp, renderTools, renderVersion } from "../cli.js";
|
|
19
19
|
|
|
20
20
|
const DEFAULT_EXCHANGE =
|
|
21
|
-
"https://
|
|
21
|
+
"https://api.mosadd.com/functions/v1/hub-key-exchange";
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Hosted-hub path: when MOSADD_API_KEY is set, exchange it for a short-lived
|