@nyuchi/mzizi-mcp 0.3.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.
- package/README.md +186 -0
- package/dist/auth/authkit-handler.d.ts +28 -0
- package/dist/auth/authkit-handler.d.ts.map +1 -0
- package/dist/auth/authkit-handler.js +164 -0
- package/dist/auth/authkit-handler.js.map +1 -0
- package/dist/auth/mcp-api-handler.d.ts +19 -0
- package/dist/auth/mcp-api-handler.d.ts.map +1 -0
- package/dist/auth/mcp-api-handler.js +30 -0
- package/dist/auth/mcp-api-handler.js.map +1 -0
- package/dist/auth/oauth-utils.d.ts +47 -0
- package/dist/auth/oauth-utils.d.ts.map +1 -0
- package/dist/auth/oauth-utils.js +295 -0
- package/dist/auth/oauth-utils.js.map +1 -0
- package/dist/auth/props.d.ts +18 -0
- package/dist/auth/props.d.ts.map +1 -0
- package/dist/auth/props.js +2 -0
- package/dist/auth/props.js.map +1 -0
- package/dist/env.d.ts +22 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +12 -0
- package/dist/env.js.map +1 -0
- package/dist/http.d.ts +22 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +72 -0
- package/dist/http.js.map +1 -0
- package/dist/server.d.ts +33 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +272 -0
- package/dist/server.js.map +1 -0
- package/dist/stdio.d.ts +13 -0
- package/dist/stdio.d.ts.map +1 -0
- package/dist/stdio.js +34 -0
- package/dist/stdio.js.map +1 -0
- package/dist/worker.d.ts +23 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +30 -0
- package/dist/worker.js.map +1 -0
- package/package.json +69 -0
package/dist/server.js
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mzizi MCP — registry-driven server factory.
|
|
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:
|
|
7
|
+
*
|
|
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)
|
|
11
|
+
*
|
|
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.
|
|
17
|
+
*
|
|
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.
|
|
22
|
+
*/
|
|
23
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
24
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
25
|
+
export const MZIZI_MCP_VERSION = "0.3.0";
|
|
26
|
+
const str = (description) => ({ type: ["string", "null"], description });
|
|
27
|
+
const reqStr = (description) => ({ type: "string", description });
|
|
28
|
+
const int = (description) => ({ type: ["integer", "null"], description });
|
|
29
|
+
const bool = (description) => ({ type: ["boolean", "null"], description });
|
|
30
|
+
const num = (description) => ({ type: ["number", "null"], description });
|
|
31
|
+
/**
|
|
32
|
+
* Curated input schemas for the parameterized tools whose registry
|
|
33
|
+
* `input_schema` is not (yet) populated. Property names are the exact SQL
|
|
34
|
+
* function parameter names so `rpc()` receives them unchanged. No-arg tools are
|
|
35
|
+
* omitted — they fall back to an empty-object schema.
|
|
36
|
+
*/
|
|
37
|
+
const INPUT_SCHEMAS = {
|
|
38
|
+
// component
|
|
39
|
+
get_component: { type: "object", properties: { p_name: reqStr("Component name, e.g. 'button'") }, required: ["p_name"] },
|
|
40
|
+
get_component_history: { type: "object", properties: { p_component_name: reqStr("Component name"), p_limit: int("Max rows (default 20)") }, required: ["p_component_name"] },
|
|
41
|
+
get_component_links: { type: "object", properties: { p_name: reqStr("Component name") }, required: ["p_name"] },
|
|
42
|
+
list_components: { type: "object", properties: { p_node: int("Ecosystem node 1-10"), p_status: str("Status filter"), p_category: str("Category filter"), p_limit: int("Max rows (default 100)"), p_offset: int("Offset") } },
|
|
43
|
+
search_components: { type: "object", properties: { p_query: reqStr("Search query"), p_limit: int("Max rows (default 50)") }, required: ["p_query"] },
|
|
44
|
+
// documents
|
|
45
|
+
get_node_documents: { type: "object", properties: { p_node: int("Ecosystem node 1-10"), p_collection: str("Collection key, e.g. 'agentic-components'"), p_name: str("Exact document name"), p_owner: str("Owner: bundu | mzizi | framework | nyuchi"), p_limit: int("Max rows (default 200)") } },
|
|
46
|
+
// skills
|
|
47
|
+
get_skill: { type: "object", properties: { p_name: reqStr("Skill name") }, required: ["p_name"] },
|
|
48
|
+
// ai
|
|
49
|
+
get_ai_instructions: { type: "object", properties: { p_name: reqStr("Target/instruction name, e.g. 'claude'") }, required: ["p_name"] },
|
|
50
|
+
list_ai_instructions: { type: "object", properties: { p_target: str("Filter by target") } },
|
|
51
|
+
// brand
|
|
52
|
+
get_brand_tokens: { type: "object", properties: { p_category: reqStr("Token category") }, required: ["p_category"] },
|
|
53
|
+
list_ecosystem_brands: { type: "object", properties: { p_adopter_type: str("Adopter type filter") } },
|
|
54
|
+
// governance
|
|
55
|
+
get_bundu_convention: { type: "object", properties: { p_slug: reqStr("Convention slug") }, required: ["p_slug"] },
|
|
56
|
+
// release
|
|
57
|
+
get_changelog_entry: { type: "object", properties: { p_version: reqStr("Version, e.g. '7.0.0'") }, required: ["p_version"] },
|
|
58
|
+
get_component_status_history: { type: "object", properties: { p_name: reqStr("Component name") }, required: ["p_name"] },
|
|
59
|
+
get_release_with_diff: { type: "object", properties: { p_version: reqStr("Version") }, required: ["p_version"] },
|
|
60
|
+
compute_release_diff: { type: "object", properties: { p_since: reqStr("ISO timestamp (inclusive)"), p_until: str("ISO timestamp (default now)") }, required: ["p_since"] },
|
|
61
|
+
list_changelog: { type: "object", properties: { p_limit: int("Max rows (default 50)"), p_offset: int("Offset") } },
|
|
62
|
+
list_tool_versions: { type: "object", properties: { p_tool_name: reqStr("Tool name"), p_limit: int("Max rows (default 20)") }, required: ["p_tool_name"] },
|
|
63
|
+
// fundi (reads)
|
|
64
|
+
get_healing_log: { type: "object", properties: { p_issue_id: int("Filter by issue id"), p_limit: int("Max rows (default 100)") } },
|
|
65
|
+
list_recent_fundi_issues: { type: "object", properties: { p_status: str("Status filter"), p_severity: str("Severity filter"), p_limit: int("Max rows (default 50)") } },
|
|
66
|
+
// resolver
|
|
67
|
+
resolve_primitive: { type: "object", properties: { p_primitive_name: reqStr("Primitive name"), p_descriptor_slug: reqStr("Framework descriptor slug, e.g. 'react'") }, required: ["p_primitive_name", "p_descriptor_slug"] },
|
|
68
|
+
list_primitive_sources: { type: "object", properties: { p_primitive_name: reqStr("Primitive name") }, required: ["p_primitive_name"] },
|
|
69
|
+
list_framework_descriptors: { type: "object", properties: { p_active_only: bool("Only active descriptors") } },
|
|
70
|
+
// observability
|
|
71
|
+
is_domain_allowed: { type: "object", properties: { p_domain: reqStr("Domain"), p_feature: str("Feature (default 'portal_links')") }, required: ["p_domain"] },
|
|
72
|
+
list_observability_domains: { type: "object", properties: { p_feature: str("Feature filter") } },
|
|
73
|
+
list_observability_events: { type: "object", properties: { p_domain: str("Domain filter"), p_component_name: str("Component filter"), p_event_type: str("Event-type filter"), p_limit: int("Max rows (default 100)") } },
|
|
74
|
+
// chaos (read)
|
|
75
|
+
list_chaos_events: { type: "object", properties: { p_domain: str("Domain filter"), p_environment: str("Environment filter"), p_event_type: str("Event-type filter"), p_limit: int("Max rows (default 100)") } },
|
|
76
|
+
// a11y
|
|
77
|
+
calculate_contrast_ratio: { type: "object", properties: { fg_hex: reqStr("Foreground hex, e.g. '#111111'"), bg_hex: reqStr("Background hex, e.g. '#ffffff'") }, required: ["fg_hex", "bg_hex"] },
|
|
78
|
+
relative_luminance: { type: "object", properties: { hex: reqStr("Hex colour") }, required: ["hex"] },
|
|
79
|
+
simulate_color_blindness: { type: "object", properties: { hex: reqStr("Hex colour"), cb_type: reqStr("Type: protanopia | deuteranopia | tritanopia") }, required: ["hex", "cb_type"] },
|
|
80
|
+
run_accessibility_audit: { type: "object", properties: { p_file_fundi_issues: bool("File fundi issues for failures (default true)"), p_contrast_floor: num("Minimum contrast ratio (default 3.0)") } },
|
|
81
|
+
// meta
|
|
82
|
+
mcp_describe: { type: "object", properties: { p_category: str("Filter by category"), p_stability: str("Filter by stability"), p_tool_kind: str("Filter by tool kind") } },
|
|
83
|
+
};
|
|
84
|
+
const EMPTY_SCHEMA = { type: "object", properties: {} };
|
|
85
|
+
function jsonContent(value) {
|
|
86
|
+
return { content: [{ type: "text", text: JSON.stringify(value, null, 2) }] };
|
|
87
|
+
}
|
|
88
|
+
function toolError(message) {
|
|
89
|
+
return { isError: true, content: [{ type: "text", text: message }] };
|
|
90
|
+
}
|
|
91
|
+
function hasProperties(schema) {
|
|
92
|
+
const props = schema && schema.properties;
|
|
93
|
+
return !!props && typeof props === "object" && Object.keys(props).length > 0;
|
|
94
|
+
}
|
|
95
|
+
function schemaFor(row) {
|
|
96
|
+
if (hasProperties(row.input_schema))
|
|
97
|
+
return row.input_schema;
|
|
98
|
+
return INPUT_SCHEMAS[row.tool_name] ?? EMPTY_SCHEMA;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Build the Mzizi MCP server bound to a Supabase client with public read on
|
|
102
|
+
* `mcp_tool_registry` / `component_documents` and EXECUTE on the backing RPCs.
|
|
103
|
+
* The tool catalog is loaded from the registry; write-kind tools are excluded
|
|
104
|
+
* from this (anonymous, public) surface.
|
|
105
|
+
*/
|
|
106
|
+
export async function createMziziMcpServer(supabase) {
|
|
107
|
+
const server = new McpServer({
|
|
108
|
+
name: "mzizi-mcp",
|
|
109
|
+
version: MZIZI_MCP_VERSION,
|
|
110
|
+
title: "Mzizi",
|
|
111
|
+
}, {
|
|
112
|
+
capabilities: { tools: { listChanged: true }, resources: { listChanged: true } },
|
|
113
|
+
instructions: "Read-only access to the Mzizi design-system registry (a nyuchi-brand project of the Bundu ecosystem): components, design tokens, brand, the N1-N10 ecosystem architecture, Ubuntu doctrine, skills, releases, and the agentic-components surface. The tool surface is registry-driven — call mcp_describe to enumerate tools and categories, list_collections to see document collections, get_component / list_components / search_components for components, and get_node_documents for everything under an ecosystem node or collection.",
|
|
114
|
+
});
|
|
115
|
+
// ── Registry-driven tool catalog ───────────────────────────────────────────
|
|
116
|
+
const { data, error } = await supabase
|
|
117
|
+
.from("mcp_tool_registry")
|
|
118
|
+
.select("tool_name, description, category, tool_kind, sql_function, source_table, edge_function, input_schema, requires_first_party")
|
|
119
|
+
.eq("enabled", true);
|
|
120
|
+
if (error) {
|
|
121
|
+
// Surface the failure as a diagnostic tool rather than a silent empty server.
|
|
122
|
+
server.server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
123
|
+
tools: [
|
|
124
|
+
{
|
|
125
|
+
name: "registry_unavailable",
|
|
126
|
+
description: `The mcp_tool_registry could not be read: ${error.message}`,
|
|
127
|
+
inputSchema: EMPTY_SCHEMA,
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
}));
|
|
131
|
+
server.server.setRequestHandler(CallToolRequestSchema, async () => toolError(`mcp_tool_registry unavailable: ${error.message}`));
|
|
132
|
+
return server;
|
|
133
|
+
}
|
|
134
|
+
const rows = (data ?? []).filter((r) => !r.requires_first_party && r.tool_kind !== "write");
|
|
135
|
+
const byName = new Map(rows.map((r) => [r.tool_name, r]));
|
|
136
|
+
// Core document tools that are aggregates without an RPC, so they aren't
|
|
137
|
+
// registry-backed. Everything else is registry-driven.
|
|
138
|
+
const coreTools = [
|
|
139
|
+
{
|
|
140
|
+
name: "list_collections",
|
|
141
|
+
description: "List every collection in the Mzizi document store with document counts and per-owner breakdown (components, primitives, brand, agentic-components, skills, …).",
|
|
142
|
+
inputSchema: EMPTY_SCHEMA,
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: "get_database_status",
|
|
146
|
+
description: "Provider health, document-store row count, and registered-tool count.",
|
|
147
|
+
inputSchema: EMPTY_SCHEMA,
|
|
148
|
+
},
|
|
149
|
+
];
|
|
150
|
+
const tools = [
|
|
151
|
+
...rows.map((r) => ({
|
|
152
|
+
name: r.tool_name,
|
|
153
|
+
description: r.description ?? `${r.category ?? "mzizi"} ${r.tool_kind ?? "read"} tool (registry-driven).`,
|
|
154
|
+
inputSchema: schemaFor(r),
|
|
155
|
+
})),
|
|
156
|
+
...coreTools,
|
|
157
|
+
];
|
|
158
|
+
server.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools }));
|
|
159
|
+
server.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
160
|
+
const name = request.params.name;
|
|
161
|
+
const args = (request.params.arguments ?? {});
|
|
162
|
+
// Core document tools (aggregates without an RPC).
|
|
163
|
+
if (name === "list_collections") {
|
|
164
|
+
const { data, error } = await supabase
|
|
165
|
+
.from("component_documents")
|
|
166
|
+
.select("collection, node, owner");
|
|
167
|
+
if (error)
|
|
168
|
+
return toolError(`list_collections failed: ${error.message}`);
|
|
169
|
+
return jsonContent(summariseCollections(data ?? []));
|
|
170
|
+
}
|
|
171
|
+
if (name === "get_database_status") {
|
|
172
|
+
const docs = await supabase
|
|
173
|
+
.from("component_documents")
|
|
174
|
+
.select("*", { count: "exact", head: true });
|
|
175
|
+
const toolsCount = await supabase
|
|
176
|
+
.from("mcp_tool_registry")
|
|
177
|
+
.select("*", { count: "exact", head: true })
|
|
178
|
+
.eq("enabled", true);
|
|
179
|
+
return jsonContent({
|
|
180
|
+
provider: "supabase",
|
|
181
|
+
status: docs.error ? "error" : "connected",
|
|
182
|
+
error: docs.error?.message,
|
|
183
|
+
documents: docs.count ?? 0,
|
|
184
|
+
registryTools: toolsCount.count ?? 0,
|
|
185
|
+
version: MZIZI_MCP_VERSION,
|
|
186
|
+
readOnly: true,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
const row = byName.get(name);
|
|
190
|
+
if (!row)
|
|
191
|
+
return toolError(`Unknown tool: ${name}`);
|
|
192
|
+
try {
|
|
193
|
+
if (row.sql_function) {
|
|
194
|
+
const fn = row.sql_function.replace(/^public\./, "");
|
|
195
|
+
const { data, error } = await supabase.rpc(fn, args);
|
|
196
|
+
if (error)
|
|
197
|
+
return toolError(`${row.tool_name} failed: ${error.message}`);
|
|
198
|
+
return jsonContent(data);
|
|
199
|
+
}
|
|
200
|
+
if (row.edge_function) {
|
|
201
|
+
const { data, error } = await supabase.functions.invoke(row.edge_function, { body: args });
|
|
202
|
+
if (error)
|
|
203
|
+
return toolError(`${row.tool_name} (edge) failed: ${error.message}`);
|
|
204
|
+
return jsonContent(data);
|
|
205
|
+
}
|
|
206
|
+
if (row.source_table) {
|
|
207
|
+
const { data, error } = await supabase.from(row.source_table).select("*").limit(200);
|
|
208
|
+
if (error)
|
|
209
|
+
return toolError(`${row.tool_name} failed: ${error.message}`);
|
|
210
|
+
return jsonContent(data);
|
|
211
|
+
}
|
|
212
|
+
return toolError(`${row.tool_name} has no dispatch target in the registry.`);
|
|
213
|
+
}
|
|
214
|
+
catch (err) {
|
|
215
|
+
return toolError(`${row.tool_name} threw: ${err instanceof Error ? err.message : String(err)}`);
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
// ── Resources ──────────────────────────────────────────────────────────────
|
|
219
|
+
server.resource("collections", "mzizi://collections", {
|
|
220
|
+
description: "Index of every collection in the Mzizi document store with document counts and ownership breakdown.",
|
|
221
|
+
}, async () => {
|
|
222
|
+
const { data } = await supabase.from("component_documents").select("collection, node, owner");
|
|
223
|
+
return {
|
|
224
|
+
contents: [
|
|
225
|
+
{
|
|
226
|
+
uri: "mzizi://collections",
|
|
227
|
+
mimeType: "application/json",
|
|
228
|
+
text: JSON.stringify(summariseCollections(data ?? []), null, 2),
|
|
229
|
+
},
|
|
230
|
+
],
|
|
231
|
+
};
|
|
232
|
+
});
|
|
233
|
+
server.resource("components", "mzizi://components", {
|
|
234
|
+
description: "Lean index of the `components` collection (name / node / owner / status). Full documents via the get_component tool.",
|
|
235
|
+
}, async () => {
|
|
236
|
+
const { data } = await supabase.rpc("read_documents", {
|
|
237
|
+
p_collection: "components",
|
|
238
|
+
p_limit: 1000,
|
|
239
|
+
});
|
|
240
|
+
const rows = data ?? [];
|
|
241
|
+
const lean = rows.map((row) => ({
|
|
242
|
+
name: row.name,
|
|
243
|
+
owner: row.owner,
|
|
244
|
+
node: row.document?.["node"] ?? null,
|
|
245
|
+
status: row.document?.["status"] ?? null,
|
|
246
|
+
description: row.document?.["description"] ?? null,
|
|
247
|
+
}));
|
|
248
|
+
return {
|
|
249
|
+
contents: [
|
|
250
|
+
{ uri: "mzizi://components", mimeType: "application/json", text: JSON.stringify(lean, null, 2) },
|
|
251
|
+
],
|
|
252
|
+
};
|
|
253
|
+
});
|
|
254
|
+
return server;
|
|
255
|
+
}
|
|
256
|
+
/** Aggregate `(collection, node, owner)` rows into a per-collection summary. */
|
|
257
|
+
function summariseCollections(rows) {
|
|
258
|
+
const summary = new Map();
|
|
259
|
+
for (const row of rows) {
|
|
260
|
+
const entry = summary.get(row.collection) ?? {
|
|
261
|
+
collection: row.collection,
|
|
262
|
+
node: row.node,
|
|
263
|
+
total: 0,
|
|
264
|
+
byOwner: {},
|
|
265
|
+
};
|
|
266
|
+
entry.total += 1;
|
|
267
|
+
entry.byOwner[row.owner] = (entry.byOwner[row.owner] ?? 0) + 1;
|
|
268
|
+
summary.set(row.collection, entry);
|
|
269
|
+
}
|
|
270
|
+
return [...summary.values()].sort((a, b) => a.collection.localeCompare(b.collection));
|
|
271
|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,CAAC,UAAU,CAAC,IAAI;YAC3C,UAAU,EAAE,GAAG,CAAC,UAAU;YAC1B,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,KAAK,EAAE,CAAC;YACR,OAAO,EAAE,EAAE;SACZ,CAAA;QACD,KAAK,CAAC,KAAK,IAAI,CAAC,CAAA;QAChB,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAA;QAC9D,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;IACpC,CAAC;IACD,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAA;AACvF,CAAC"}
|
package/dist/stdio.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* stdio entry — for the MCP registry (`npx mzizi-mcp`).
|
|
4
|
+
*
|
|
5
|
+
* Spawns the server over the stdio transport, using a long-lived Supabase
|
|
6
|
+
* anon client. RLS on `component_documents` enforces read-only.
|
|
7
|
+
*
|
|
8
|
+
* Env:
|
|
9
|
+
* SUPABASE_URL (or NEXT_PUBLIC_SUPABASE_URL)
|
|
10
|
+
* SUPABASE_PUBLISHABLE_KEY (or NEXT_PUBLIC_SUPABASE_ANON_KEY)
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=stdio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":";AACA;;;;;;;;;GASG"}
|
package/dist/stdio.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* stdio entry — for the MCP registry (`npx mzizi-mcp`).
|
|
4
|
+
*
|
|
5
|
+
* Spawns the server over the stdio transport, using a long-lived Supabase
|
|
6
|
+
* anon client. RLS on `component_documents` enforces read-only.
|
|
7
|
+
*
|
|
8
|
+
* Env:
|
|
9
|
+
* SUPABASE_URL (or NEXT_PUBLIC_SUPABASE_URL)
|
|
10
|
+
* SUPABASE_PUBLISHABLE_KEY (or NEXT_PUBLIC_SUPABASE_ANON_KEY)
|
|
11
|
+
*/
|
|
12
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
13
|
+
import { createClient } from "@supabase/supabase-js";
|
|
14
|
+
import { createMziziMcpServer } from "./server.js";
|
|
15
|
+
async function main() {
|
|
16
|
+
const url = process.env.SUPABASE_URL ?? process.env.NEXT_PUBLIC_SUPABASE_URL ?? "";
|
|
17
|
+
const key = process.env.SUPABASE_PUBLISHABLE_KEY ?? process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY ?? "";
|
|
18
|
+
if (!url || !key) {
|
|
19
|
+
process.stderr.write("mzizi-mcp: missing SUPABASE_URL or SUPABASE_PUBLISHABLE_KEY (NEXT_PUBLIC_ equivalents are accepted)\n");
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
const supabase = createClient(url, key, {
|
|
23
|
+
auth: { persistSession: false, autoRefreshToken: false },
|
|
24
|
+
});
|
|
25
|
+
const server = await createMziziMcpServer(supabase);
|
|
26
|
+
const transport = new StdioServerTransport();
|
|
27
|
+
await server.connect(transport);
|
|
28
|
+
}
|
|
29
|
+
main().catch((err) => {
|
|
30
|
+
const message = err instanceof Error ? (err.stack ?? err.message) : String(err);
|
|
31
|
+
process.stderr.write(`mzizi-mcp: ${message}\n`);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
});
|
|
34
|
+
//# sour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AAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC/E,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,OAAO,IAAI,CAAC,CAAA;IAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
|
package/dist/worker.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudflare Worker entry — mcp.mzizi.dev
|
|
3
|
+
*
|
|
4
|
+
* mzizi-mcp is a free, public tool gated by a WorkOS AuthKit signup. The
|
|
5
|
+
* `@cloudflare/workers-oauth-provider` front makes it a spec-compliant OAuth
|
|
6
|
+
* resource server — it serves `/.well-known/*` metadata + Dynamic Client
|
|
7
|
+
* Registration (`/register`) + `/authorize` + `/token`, which is what lets
|
|
8
|
+
* remote MCP clients (including the claude.ai web "custom connector" flow)
|
|
9
|
+
* complete the handshake and connect.
|
|
10
|
+
*
|
|
11
|
+
* apiRoute "/mcp" → the MCP itself, behind the access token (mcpApiHandler)
|
|
12
|
+
* defaultHandler → WorkOS AuthKit login/consent (AuthkitHandler)
|
|
13
|
+
*
|
|
14
|
+
* This is the reusable auth foundation the rest of the Mzizi tooling (the fundi
|
|
15
|
+
* agent, gated collections) sits behind later. Auth here is a FREE signup; any
|
|
16
|
+
* paid/subscription gate (e.g. fundi) is an entitlement check layered on top at
|
|
17
|
+
* the tool level, not a second login.
|
|
18
|
+
*/
|
|
19
|
+
import OAuthProvider from "@cloudflare/workers-oauth-provider";
|
|
20
|
+
export type { Env } from "./env.js";
|
|
21
|
+
declare const _default: OAuthProvider<Cloudflare.Env>;
|
|
22
|
+
export default _default;
|
|
23
|
+
//# sourceMappingURL=worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,aAAa,MAAM,oCAAoC,CAAA;AAI9D,YAAY,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;;AAEnC,wBAOE"}
|
package/dist/worker.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudflare Worker entry — mcp.mzizi.dev
|
|
3
|
+
*
|
|
4
|
+
* mzizi-mcp is a free, public tool gated by a WorkOS AuthKit signup. The
|
|
5
|
+
* `@cloudflare/workers-oauth-provider` front makes it a spec-compliant OAuth
|
|
6
|
+
* resource server — it serves `/.well-known/*` metadata + Dynamic Client
|
|
7
|
+
* Registration (`/register`) + `/authorize` + `/token`, which is what lets
|
|
8
|
+
* remote MCP clients (including the claude.ai web "custom connector" flow)
|
|
9
|
+
* complete the handshake and connect.
|
|
10
|
+
*
|
|
11
|
+
* apiRoute "/mcp" → the MCP itself, behind the access token (mcpApiHandler)
|
|
12
|
+
* defaultHandler → WorkOS AuthKit login/consent (AuthkitHandler)
|
|
13
|
+
*
|
|
14
|
+
* This is the reusable auth foundation the rest of the Mzizi tooling (the fundi
|
|
15
|
+
* agent, gated collections) sits behind later. Auth here is a FREE signup; any
|
|
16
|
+
* paid/subscription gate (e.g. fundi) is an entitlement check layered on top at
|
|
17
|
+
* the tool level, not a second login.
|
|
18
|
+
*/
|
|
19
|
+
import OAuthProvider from "@cloudflare/workers-oauth-provider";
|
|
20
|
+
import { AuthkitHandler } from "./auth/authkit-handler.js";
|
|
21
|
+
import { mcpApiHandler } from "./auth/mcp-api-handler.js";
|
|
22
|
+
export default new OAuthProvider({
|
|
23
|
+
apiRoute: "/mcp",
|
|
24
|
+
apiHandler: mcpApiHandler,
|
|
25
|
+
defaultHandler: AuthkitHandler,
|
|
26
|
+
authorizeEndpoint: "/authorize",
|
|
27
|
+
tokenEndpoint: "/token",
|
|
28
|
+
clientRegistrationEndpoint: "/register",
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,aAAa,MAAM,oCAAoC,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAIzD,eAAe,IAAI,aAAa,CAAC;IAC/B,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,aAAsB;IAClC,cAAc,EAAE,cAAuB;IACvC,iBAAiB,EAAE,YAAY;IAC/B,aAAa,EAAE,QAAQ;IACvB,0BAA0B,EAAE,WAAW;CACxC,CAAC,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nyuchi/mzizi-mcp",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"mcpName": "io.github.nyuchi/mzizi-mcp",
|
|
8
|
+
"description": "Mzizi MCP — Model Context Protocol server for the Mzizi component registry. Reads the document-route store, one component per JSON document.",
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"homepage": "https://mzizi.dev",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/nyuchi/mzizi-tools.git",
|
|
14
|
+
"directory": "mzizi-mcp"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"mcp",
|
|
18
|
+
"model-context-protocol",
|
|
19
|
+
"mzizi",
|
|
20
|
+
"bundu",
|
|
21
|
+
"supabase",
|
|
22
|
+
"registry"
|
|
23
|
+
],
|
|
24
|
+
"type": "module",
|
|
25
|
+
"bin": {
|
|
26
|
+
"mzizi-mcp": "./dist/stdio.js"
|
|
27
|
+
},
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/server.d.ts",
|
|
31
|
+
"import": "./dist/server.js"
|
|
32
|
+
},
|
|
33
|
+
"./http": {
|
|
34
|
+
"types": "./dist/http.d.ts",
|
|
35
|
+
"import": "./dist/http.js"
|
|
36
|
+
},
|
|
37
|
+
"./stdio": "./dist/stdio.js"
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"dist",
|
|
41
|
+
"README.md"
|
|
42
|
+
],
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@cloudflare/workers-oauth-provider": "^0.8.0",
|
|
45
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
46
|
+
"@supabase/server": "^1.1.0",
|
|
47
|
+
"@supabase/supabase-js": "^2.104.0",
|
|
48
|
+
"@workos-inc/node": "^9.3.0",
|
|
49
|
+
"hono": "^4.12.19",
|
|
50
|
+
"jose": "^6.2.3",
|
|
51
|
+
"zod": "^4.3.6"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@cloudflare/workers-types": "^4.20251020.0",
|
|
55
|
+
"@types/node": "^25.6.0",
|
|
56
|
+
"typescript": "^6.0.3",
|
|
57
|
+
"wrangler": "^4.45.0"
|
|
58
|
+
},
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": ">=20"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "tsc -p tsconfig.json",
|
|
64
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
65
|
+
"wrangler": "wrangler",
|
|
66
|
+
"cf:dev": "wrangler dev",
|
|
67
|
+
"cf:deploy": "wrangler deploy"
|
|
68
|
+
}
|
|
69
|
+
}
|