@nyuchi/mzizi-mcp 0.6.0 → 0.8.0

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.
@@ -0,0 +1,44 @@
1
+ // The WorkOS identity tenant this Worker trusts — resolved in ONE place.
2
+ //
3
+ // Mirrors `fundi/src/identity.ts`. The two Workers must agree: mzizi-mcp mints
4
+ // the M2M token that fundi's gate binds, so a tenant mismatch between them means
5
+ // every call mints a token that cannot pass.
6
+ //
7
+ // It is a SECRET, not a `[vars]` entry (see wrangler.toml). A hostname is not
8
+ // confidential; it is environment-specific and vendor-dependent, and a var of
9
+ // the same name wins on every deploy and silently discards the secret. THIS
10
+ // Worker is the worked example — corrected through the settings API, verified,
11
+ // and later found back on a host that no longer resolves.
12
+ /**
13
+ * The tenant used when `WORKOS_AUTHKIT_DOMAIN` is unset.
14
+ *
15
+ * `accounts.mukoko.com`, NOT the `identity.nyuchi.com` that was configured until
16
+ * 10 Aug 2026. That host no longer resolves at all — attaching a new WorkOS
17
+ * custom domain detaches the old one with no overlap window, so it began
18
+ * returning Cloudflare 1014 the moment the new one landed.
19
+ *
20
+ * A default is what a Worker gets when configuration is missing, so it has to
21
+ * name something that works. Defaulting to the retired host would mean a Worker
22
+ * deployed before its secret is set fails every login while looking correctly
23
+ * configured.
24
+ *
25
+ * `accounts` is PLURAL. `account.mukoko.com` is the Mukoko Account app;
26
+ * `accounts.mukoko.com` is the issuer that mints its tokens.
27
+ */
28
+ export const DEFAULT_AUTHKIT_DOMAIN = "https://accounts.mukoko.com";
29
+ /**
30
+ * Resolve the identity tenant for this Worker.
31
+ *
32
+ * The trailing slash is trimmed: callers compose paths onto this, and while
33
+ * `new URL()` tolerates a slash, an `iss` claim comparison is an exact string
34
+ * match — `https://x/` never equals the `https://x` WorkOS issues. That would
35
+ * present as "every token is invalid", which is a long way from "someone left a
36
+ * trailing slash".
37
+ */
38
+ export function authkitDomain(env) {
39
+ const raw = env.WORKOS_AUTHKIT_DOMAIN?.trim();
40
+ if (!raw)
41
+ return DEFAULT_AUTHKIT_DOMAIN;
42
+ return raw.replace(/\/+$/, "");
43
+ }
44
+ //# sourceMappingURL=identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.js","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,+EAA+E;AAC/E,iFAAiF;AACjF,6CAA6C;AAC7C,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,4EAA4E;AAC5E,+EAA+E;AAC/E,0DAA0D;AAI1D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,6BAA6B,CAAA;AAEnE;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,GAAuC;IACnE,MAAM,GAAG,GAAG,GAAG,CAAC,qBAAqB,EAAE,IAAI,EAAE,CAAA;IAC7C,IAAI,CAAC,GAAG;QAAE,OAAO,sBAAsB,CAAA;IACvC,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AAChC,CAAC"}
package/dist/server.d.ts CHANGED
@@ -1,36 +1,34 @@
1
1
  /**
2
- * Mzizi MCP — registry-driven server factory.
2
+ * The Mzizi MCP server.
3
3
  *
4
- * The tool surface is NOT hardcoded. It is read at startup from the public
5
- * `mcp_tool_registry` table (the same registry that powers the design system's
6
- * MCP), and each tool is dispatched dynamically to its backing implementation:
4
+ * Backed by `mzizi.dev/api/v1` over HTTP. There is no Supabase client here.
7
5
  *
8
- * • `sql_function` → `supabase.rpc(fn, args)` (the common case)
9
- * • `edge_function` → `supabase.functions.invoke(fn, { body: args })`
10
- * • `source_table` → `supabase.from(table).select()` (fallback)
6
+ * WHAT CHANGED AND WHY. This server used to build its tool catalog at startup from the
7
+ * `mcp_tool_registry` table and dispatch each call to a Supabase RPC, edge function or
8
+ * table read — 62 enabled tools, defined as data. Two things were wrong with that:
11
9
  *
12
- * This makes mzizi-mcp a drop-in replacement for the legacy design MCP: adding,
13
- * renaming, or retiring a tool is a registry edit, not a code change. Argument
14
- * names in the registry's `input_schema` (and in the curated fallback schemas
15
- * below) match the SQL function parameters exactly, so arguments pass straight
16
- * through to `rpc()` with no remapping.
10
+ * 1. Components are not rows. They are real files in `nyuchi/mzizi` that the Next.js
11
+ * app compiles and typechecks, so an error in one fails the build. The app serves
12
+ * them over `/api/v1/*`, which makes that API the source of truth and this server
13
+ * one of its clients. Reading the database put a second, uncompiled representation
14
+ * in the path — one that could disagree with the code while still looking correct.
17
15
  *
18
- * The factory takes a pre-built `SupabaseClient` so the same factory works
19
- * across transports (HTTP per-request anon client; stdio long-lived anon
20
- * client). RLS grants public read on `mcp_tool_registry`, `component_documents`,
21
- * and EXECUTE on the document/registry RPCs.
16
+ * 2. A tool surface defined in a table changes whenever someone edits a row: no diff,
17
+ * no review, no test. The 10 tools live in `tools.ts` as code, so changing them is
18
+ * a pull request.
19
+ *
20
+ * The 10 are specified in `docs/mcp-tool-consolidation.md` (mzizi repo). Each carries its
21
+ * `replaces` list in `TOOL_COVERAGE`, so coverage of the old 62 is checkable rather than
22
+ * asserted.
22
23
  */
23
24
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
24
- import type { SupabaseClient } from "@supabase/supabase-js";
25
25
  import type { FundiToolContext } from "./fundi-client.js";
26
- export declare const MZIZI_MCP_VERSION = "0.6.0";
27
- /**
28
- * Build the Mzizi MCP server bound to a Supabase client with public read on
29
- * `mcp_tool_registry` / `component_documents` and EXECUTE on the backing RPCs.
30
- * The tool catalog is loaded from the registry; write-kind tools are excluded
31
- * from this (anonymous, public) surface.
32
- */
33
- export declare function createMziziMcpServer(supabase: SupabaseClient, opts?: {
26
+ export declare const MZIZI_MCP_VERSION = "0.8.0";
27
+ export type CreateServerOptions = {
34
28
  fundi?: FundiToolContext;
35
- }): Promise<McpServer>;
29
+ /** Override the API base — used by tests and by a preview deployment. */
30
+ apiBaseUrl?: string;
31
+ fetchImpl?: typeof fetch;
32
+ };
33
+ export declare function createMziziMcpServer(opts?: CreateServerOptions): Promise<McpServer>;
36
34
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAQ1D,eAAO,MAAM,iBAAiB,UAAU,CAAC;AAwezC;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,cAAc,EACxB,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,gBAAgB,CAAA;CAAO,GACtC,OAAO,CAAC,SAAS,CAAC,CAwTpB"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAEnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAIzD,eAAO,MAAM,iBAAiB,UAAU,CAAA;AAExC,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,gBAAgB,CAAA;IACxB,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAA;CACzB,CAAA;AAED,wBAAsB,oBAAoB,CAAC,IAAI,GAAE,mBAAwB,GAAG,OAAO,CAAC,SAAS,CAAC,CA+D7F"}