@dbm-system/mcp 0.2.1 → 0.2.2

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 CHANGED
@@ -38,7 +38,7 @@ or, for a client that takes a JSON configuration:
38
38
  }
39
39
  ```
40
40
 
41
- It starts in the folder the agent runs in, so a project without `@dbm-system/components` installed gets the copies this package depends on (the answers say which with `origin`).
41
+ It looks for `@dbm-system/components` and `@dbm-system/tokens` in the folder it is started in. If your client starts it somewhere else, name your project's root with the `DBM_SYSTEM_PROJECT_DIR` environment variable or a `--project <folder>` argument (Claude Code also sets `CLAUDE_PROJECT_DIR`, which it reads), for example `"env": { "DBM_SYSTEM_PROJECT_DIR": "/path/to/your/project" }` in the JSON entry. With none of them it answers from the copies this package depends on: every answer says which with `source.origin`, and a result that comes from the bundled copy carries a `note` that says so and what to do.
42
42
 
43
43
  The repository's `packages/mcp/evaluation/` holds ten questions with verified answers for measuring how well an agent uses the tools.
44
44
 
package/dist/index.js CHANGED
@@ -20,12 +20,12 @@ function tryResolve(require2, specifier) {
20
20
  return void 0;
21
21
  }
22
22
  }
23
- function locatePackage(name, startDir) {
23
+ var locatePackage = (name, startDirs) => {
24
24
  const candidates = [
25
- [createRequire(join(startDir, "dbm-system-mcp.js")), "project"],
26
- [createRequire(import.meta.url), "bundled"]
25
+ ...startDirs.map((dir) => [createRequire(join(dir, "dbm-system-mcp.js")), "project", dir]),
26
+ [createRequire(import.meta.url), "bundled", void 0]
27
27
  ];
28
- for (const [require2, origin] of candidates) {
28
+ for (const [require2, origin, foundFrom] of candidates) {
29
29
  const manifestPath = tryResolve(require2, `${name}/package.json`);
30
30
  if (!manifestPath) continue;
31
31
  const { version: version2 } = JSON.parse(readFileSync(manifestPath, "utf8"));
@@ -34,6 +34,7 @@ function locatePackage(name, startDir) {
34
34
  version: version2,
35
35
  root: dirname(manifestPath),
36
36
  origin,
37
+ ...foundFrom ? { foundFrom } : {},
37
38
  resolveExport(subpath) {
38
39
  const resolved = tryResolve(require2, `${name}/${subpath}`);
39
40
  if (!resolved) {
@@ -43,8 +44,8 @@ function locatePackage(name, startDir) {
43
44
  }
44
45
  };
45
46
  }
46
- throw new SourceError(`${name} is not installed in ${startDir}. Install it there with \`npm install ${name}\`.`);
47
- }
47
+ throw new SourceError(`${name} is not installed in ${startDirs.join(" or ")}. Install it there with \`npm install ${name}\`.`);
48
+ };
48
49
 
49
50
  // src/data.ts
50
51
  var SUPPORTED_SCHEMA_VERSION = 1;
@@ -65,14 +66,15 @@ function editDistance(a, b) {
65
66
  }
66
67
  return previous[y.length] ?? 0;
67
68
  }
68
- function openData(startDir) {
69
+ function openData(startDirs, warnings2 = [], locate = locatePackage) {
70
+ const folders2 = typeof startDirs === "string" ? [startDirs] : startDirs;
69
71
  const cache = /* @__PURE__ */ new Map();
70
72
  const once = (key, load) => {
71
73
  if (!cache.has(key)) cache.set(key, load());
72
74
  return cache.get(key);
73
75
  };
74
- const components = () => once("components-package", () => locatePackage("@dbm-system/components", startDir));
75
- const tokens = () => once("tokens-package", () => locatePackage("@dbm-system/tokens", startDir));
76
+ const components = () => once("components-package", () => locate("@dbm-system/components", folders2));
77
+ const tokens = () => once("tokens-package", () => locate("@dbm-system/tokens", folders2));
76
78
  const index = () => once("index", () => {
77
79
  const pkg = components();
78
80
  const found = readJson(pkg.resolveExport("manifest/index.json"));
@@ -86,8 +88,19 @@ function openData(startDir) {
86
88
  return {
87
89
  info: () => ({
88
90
  components: { name: components().name, version: components().version, origin: components().origin },
89
- tokens: { name: tokens().name, version: tokens().version, origin: tokens().origin }
91
+ tokens: { name: tokens().name, version: tokens().version, origin: tokens().origin },
92
+ searched: folders2
90
93
  }),
94
+ note() {
95
+ const bundled = [components(), tokens()].filter((pkg) => pkg.origin === "bundled");
96
+ if (bundled.length === 0) return void 0;
97
+ const described = bundled.map((pkg) => `${pkg.name}@${pkg.version}`).join(" and ");
98
+ return [
99
+ `These answers come from the copy bundled with @dbm-system/mcp (${described}), not from your project: no ${bundled.map((pkg) => pkg.name).join(" or ")} was found from ${folders2.join(" or ")}.`,
100
+ ...warnings2,
101
+ "Start the server from your project's root, or set DBM_SYSTEM_PROJECT_DIR (or pass --project <folder>) to it."
102
+ ].join(" ");
103
+ },
91
104
  index,
92
105
  component(name) {
93
106
  const wanted = name.toLowerCase();
@@ -116,6 +129,42 @@ function openData(startDir) {
116
129
  };
117
130
  }
118
131
 
132
+ // src/project.ts
133
+ import { statSync } from "fs";
134
+ import { resolve } from "path";
135
+ var PROJECT_ENV = "DBM_SYSTEM_PROJECT_DIR";
136
+ var PROJECT_ARG = "--project";
137
+ function argumentValue(argv) {
138
+ const index = argv.findIndex((entry2) => entry2 === PROJECT_ARG || entry2.startsWith(`${PROJECT_ARG}=`));
139
+ if (index === -1) return void 0;
140
+ const entry = argv[index];
141
+ return entry.includes("=") ? entry.slice(PROJECT_ARG.length + 1) : argv[index + 1] ?? "";
142
+ }
143
+ function isFolder(path) {
144
+ try {
145
+ return statSync(path).isDirectory();
146
+ } catch {
147
+ return false;
148
+ }
149
+ }
150
+ function projectFolders(argv, env, cwd) {
151
+ const warnings2 = [];
152
+ const candidates = [];
153
+ const fromArgument = argumentValue(argv);
154
+ const [source, value] = fromArgument !== void 0 ? [PROJECT_ARG, fromArgument] : [PROJECT_ENV, env[PROJECT_ENV]];
155
+ if (value === "") {
156
+ warnings2.push(`${source} is empty.`);
157
+ } else if (value !== void 0) {
158
+ const folder = resolve(cwd, value);
159
+ if (isFolder(folder)) candidates.push(folder);
160
+ else warnings2.push(`${source} is "${value}", which is not a folder.`);
161
+ }
162
+ candidates.push(cwd);
163
+ const claude = env.CLAUDE_PROJECT_DIR;
164
+ if (claude) candidates.push(resolve(cwd, claude));
165
+ return { folders: [...new Set(candidates)], warnings: warnings2 };
166
+ }
167
+
119
168
  // src/server.ts
120
169
  import { readFileSync as readFileSync3 } from "fs";
121
170
  import { McpServer } from "@modelcontextprotocol/server";
@@ -143,6 +192,11 @@ var sourceShape = z.object({
143
192
  version: z.string(),
144
193
  origin: z.enum(["project", "bundled"]).describe("`project` is the copy installed where the server was started; `bundled` is the copy this server depends on.")
145
194
  });
195
+ var noteShape = z.string().optional().describe("Present when the answers come from the copy bundled with the server and not from your project, or, for a search, when no result contained every word. It says why and what to do.");
196
+ function sourceNote(data2, ...more) {
197
+ const note = [...more, data2.note()].filter((entry) => Boolean(entry)).join(" ");
198
+ return note ? { note } : {};
199
+ }
146
200
  function jsonResult(data2) {
147
201
  return { content: [{ type: "text", text: JSON.stringify(data2) }], structuredContent: data2 };
148
202
  }
@@ -190,6 +244,7 @@ Examples:
190
244
  }),
191
245
  outputSchema: z2.object({
192
246
  source: sourceShape,
247
+ note: noteShape,
193
248
  ...pageShape,
194
249
  components: z2.array(z2.object({ name: z2.string(), kind: z2.enum(["component", "helper"]), tier: z2.string().optional(), category: z2.string().optional(), helper_of: z2.string().optional(), summary: z2.string() }))
195
250
  }),
@@ -201,7 +256,7 @@ Examples:
201
256
  ...index.components.filter((row) => (!tier || row.tier === tier) && (!category || row.category?.toLowerCase() === category.toLowerCase())).map((row) => ({ name: row.name, kind: "component", tier: row.tier, category: row.category, summary: row.summary })),
202
257
  ...include_helpers && !tier && !category ? index.helpers.map((row) => ({ name: row.name, kind: "helper", helper_of: row.helperOf, summary: row.summary })) : []
203
258
  ];
204
- return pagedResult(rows, offset, limit, (components, page) => ({ source: sourceOf(data2), ...page, components }));
259
+ return pagedResult(rows, offset, limit, (components, page) => ({ source: sourceOf(data2), ...sourceNote(data2), ...page, components }));
205
260
  }
206
261
  );
207
262
  server.registerTool(
@@ -243,7 +298,7 @@ Use dbm_list_components or dbm_search when you do not know the exact name.`,
243
298
  parts.length === 0 ? `${entry.name} has no parts. Call dbm_get_component with name='${entry.name}' for its props.` : `${entry.name} has no part '${part}'.${close.length ? ` Did you mean ${close.map((n) => `'${n}'`).join(", ")}?` : ""} Its parts are: ${parts.map((candidate) => candidate.name).join(", ")}.`
244
299
  );
245
300
  }
246
- return jsonResult({ source, component: entry.name, part: match });
301
+ return jsonResult({ source, ...sourceNote(data2), component: entry.name, part: match });
247
302
  }
248
303
  const core = Object.fromEntries(Object.entries(entry).filter(([key]) => !SECTIONS.includes(key)));
249
304
  const omitted = [];
@@ -262,7 +317,7 @@ Use dbm_list_components or dbm_search when you do not know the exact name.`,
262
317
  omitted.push({ section, characters: JSON.stringify(value).length, fetch: `dbm_get_component with name='${entry.name}' and include=['${section}']` });
263
318
  }
264
319
  }
265
- return jsonResult({ source, component: core, ...omitted.length ? { omitted } : {}, ...outlined ? { note: "parts lists each part's name and summary only." } : {} });
320
+ return jsonResult({ source, component: core, ...omitted.length ? { omitted } : {}, ...sourceNote(data2, outlined ? "parts lists each part's name and summary only." : void 0) });
266
321
  }
267
322
  );
268
323
  }
@@ -319,7 +374,7 @@ Examples:
319
374
  }),
320
375
  outputSchema: z4.object({
321
376
  ...pageShape,
322
- note: z4.string().optional().describe("Present when no result contained every word and the results hold only some of them."),
377
+ note: noteShape,
323
378
  results: z4.array(z4.object({ kind: z4.enum(KINDS), name: z4.string(), summary: z4.string() }))
324
379
  }),
325
380
  annotations: READ_ONLY
@@ -343,7 +398,7 @@ Examples:
343
398
  const results = (partial ? scored.sort((a, b) => a.missing - b.missing || rank(a, b)) : exact).map(({ candidate }) => candidate);
344
399
  return pagedResult(results, offset, limit, (items, page) => ({
345
400
  ...page,
346
- ...partial && results.length > 0 ? { note: "No result contains every word of the query, so these contain some of the words." } : {},
401
+ ...sourceNote(data2, partial && results.length > 0 ? "No result contains every word of the query, so these contain some of the words." : void 0),
347
402
  results: items
348
403
  }));
349
404
  }
@@ -382,6 +437,7 @@ Examples:
382
437
  version: z5.string().describe("The version of the tokens package."),
383
438
  origin: z5.enum(["project", "bundled"]),
384
439
  themes: z5.array(z5.string()),
440
+ note: noteShape,
385
441
  ...pageShape,
386
442
  tokens: z5.array(z5.record(z5.string(), z5.unknown()))
387
443
  }),
@@ -398,7 +454,7 @@ Examples:
398
454
  (token) => (!text || token.name.toLowerCase().includes(text)) && (!layer || token.layer === layer) && (!group || token.group === group) && (!user || token.usedBy?.some((component) => component.toLowerCase() === user))
399
455
  );
400
456
  const { tokens: info } = data2.info();
401
- return pagedResult(matches, offset, limit, (tokens, page) => ({ version: info.version, origin: info.origin, themes: index.themes, ...page, tokens: tokens.map((token) => forTheme(token, theme)) }));
457
+ return pagedResult(matches, offset, limit, (tokens, page) => ({ version: info.version, origin: info.origin, themes: index.themes, ...sourceNote(data2), ...page, tokens: tokens.map((token) => forTheme(token, theme)) }));
402
458
  }
403
459
  );
404
460
  }
@@ -423,6 +479,7 @@ Example: "Is there a hook for toasts?" -> kind="hook"`,
423
479
  }),
424
480
  outputSchema: z6.object({
425
481
  source: sourceShape,
482
+ note: noteShape,
426
483
  ...pageShape,
427
484
  utilities: z6.array(z6.object({ name: z6.string(), kind: z6.string(), summary: z6.string() }))
428
485
  }),
@@ -430,7 +487,7 @@ Example: "Is there a hook for toasts?" -> kind="hook"`,
430
487
  },
431
488
  async ({ kind, limit, offset }) => {
432
489
  const rows = data2.index().utilities.filter((row) => !kind || row.kind === kind);
433
- return pagedResult(rows, offset, limit, (utilities, page) => ({ source: source(), ...page, utilities }));
490
+ return pagedResult(rows, offset, limit, (utilities, page) => ({ source: source(), ...sourceNote(data2), ...page, utilities }));
434
491
  }
435
492
  );
436
493
  server.registerTool(
@@ -454,7 +511,7 @@ Use dbm_list_utilities or dbm_search when you do not know the exact name.`,
454
511
  const close = data2.suggest(name, [...file.utilities, ...file.constants].map((entry) => entry.name));
455
512
  return errorResult(`No hook, function or constant named '${name}'.${close.length ? ` Did you mean ${close.map((n) => `'${n}'`).join(", ")}?` : ""} Use dbm_list_utilities or dbm_search to find the name.`);
456
513
  }
457
- return jsonResult({ source: source(), utility: found });
514
+ return jsonResult({ source: source(), ...sourceNote(data2), utility: found });
458
515
  }
459
516
  );
460
517
  }
@@ -472,7 +529,8 @@ function createServer(data2) {
472
529
  }
473
530
 
474
531
  // src/index.ts
475
- var data = openData(process.cwd());
532
+ var { folders, warnings } = projectFolders(process.argv.slice(2), process.env, process.cwd());
533
+ var data = openData(folders, warnings);
476
534
  serveStdio(() => createServer(data));
477
535
  console.error("dbm-system-mcp running on stdio");
478
536
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/data.ts","../src/sources.ts","../src/server.ts","../src/tools/components.ts","../src/tools/shared.ts","../src/tools/guide.ts","../src/tools/search.ts","../src/tools/tokens.ts","../src/tools/utilities.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { serveStdio } from \"@modelcontextprotocol/server/stdio\";\nimport { openData } from \"./data\";\nimport { createServer } from \"./server\";\n\n// stdout carries the protocol, so anything this program says goes to stderr.\nconst data = openData(process.cwd());\nserveStdio(() => createServer(data));\nconsole.error(\"dbm-system-mcp running on stdio\");\n","import { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { locatePackage, SourceError, type LocatedPackage } from \"./sources\";\n\n/** One component or helper row of `manifest/index.json`. */\nexport interface IndexRow {\n name: string;\n summary: string;\n /** The component's file, relative to the `manifest` folder. */\n file: string;\n tier?: string;\n category?: string;\n /** For a helper, the component it supports. */\n helperOf?: string;\n}\n\n/** One hook or function row of `manifest/index.json`. */\nexport interface UtilityRow {\n name: string;\n kind: string;\n summary: string;\n}\n\n/** `manifest/index.json`. */\nexport interface ManifestIndex {\n schemaVersion: number;\n package: string;\n version: string;\n components: IndexRow[];\n helpers: IndexRow[];\n utilities: UtilityRow[];\n}\n\n/** `manifest/utilities.json`: every hook, function and constant, in full. */\nexport interface UtilitiesFile {\n schemaVersion: number;\n utilities: Array<{ name: string; kind?: string; summary?: string } & Record<string, unknown>>;\n constants: Array<{ name: string } & Record<string, unknown>>;\n}\n\n/** One token of `tokens.json`. */\nexport interface TokenEntry {\n name: string;\n layer: string;\n group: string;\n type: string;\n values?: Record<string, string>;\n value?: string;\n aliases?: Record<string, string>;\n usedBy?: string[];\n purpose?: string;\n}\n\n/** `tokens.json`. */\nexport interface TokenIndex {\n version: string;\n themes: string[];\n tokens: TokenEntry[];\n}\n\n/** The manifest schema version this server reads. A different version is refused rather than read wrongly. */\nexport const SUPPORTED_SCHEMA_VERSION = 1;\n\n/** Which packages the data came from, for a tool to say what version it is describing. */\nexport interface SourceInfo {\n components: Pick<LocatedPackage, \"name\" | \"version\" | \"origin\">;\n tokens: Pick<LocatedPackage, \"name\" | \"version\" | \"origin\">;\n}\n\n/** Everything the server reads, each file loaded on first use and kept for the life of the process. */\nexport interface DbmData {\n info(): SourceInfo;\n index(): ManifestIndex;\n /** One component's or helper's manifest entry, found by name without regard to case, or `undefined` when there is none. */\n component(name: string): { row: IndexRow; entry: unknown } | undefined;\n utilities(): UtilitiesFile;\n tokens(): TokenIndex;\n /** The consumer guide that ships with the components package. */\n agentsGuide(): string;\n /** Up to `limit` names from `candidates` that are close to `name`, for \"did you mean\" messages. */\n suggest(name: string, candidates: readonly string[], limit?: number): string[];\n}\n\nfunction readJson<T>(path: string): T {\n return JSON.parse(readFileSync(path, \"utf8\")) as T;\n}\n\n/** The number of single-character edits between two strings, compared without regard to case. */\nfunction editDistance(a: string, b: string): number {\n const x = a.toLowerCase();\n const y = b.toLowerCase();\n let previous = Array.from({ length: y.length + 1 }, (_, index) => index);\n for (let i = 1; i <= x.length; i += 1) {\n const row = [i];\n for (let j = 1; j <= y.length; j += 1) {\n const cost = x[i - 1] === y[j - 1] ? 0 : 1;\n row[j] = Math.min((previous[j] ?? 0) + 1, (row[j - 1] ?? 0) + 1, (previous[j - 1] ?? 0) + cost);\n }\n previous = row;\n }\n return previous[y.length] ?? 0;\n}\n\n/** Opens the installed packages, looking in `startDir` first, and returns the readers. Nothing is read until a reader is called. */\nexport function openData(startDir: string): DbmData {\n const cache = new Map<string, unknown>();\n const once = <T>(key: string, load: () => T): T => {\n if (!cache.has(key)) cache.set(key, load());\n return cache.get(key) as T;\n };\n const components = () => once(\"components-package\", () => locatePackage(\"@dbm-system/components\", startDir));\n const tokens = () => once(\"tokens-package\", () => locatePackage(\"@dbm-system/tokens\", startDir));\n\n const index = () =>\n once(\"index\", () => {\n const pkg = components();\n const found = readJson<ManifestIndex>(pkg.resolveExport(\"manifest/index.json\"));\n if (found.schemaVersion !== SUPPORTED_SCHEMA_VERSION) {\n throw new SourceError(\n `${pkg.name}@${pkg.version} has manifest schema version ${found.schemaVersion}, and this server reads version ${SUPPORTED_SCHEMA_VERSION}. Update @dbm-system/mcp.`,\n );\n }\n return found;\n });\n\n return {\n info: () => ({\n components: { name: components().name, version: components().version, origin: components().origin },\n tokens: { name: tokens().name, version: tokens().version, origin: tokens().origin },\n }),\n index,\n component(name) {\n const wanted = name.toLowerCase();\n const { components: rows, helpers } = index();\n // The file to open comes from the index row, never from the caller's text, so a name cannot reach another path.\n const row = [...rows, ...helpers].find((candidate) => candidate.name.toLowerCase() === wanted);\n if (!row) return undefined;\n const manifestFolder = join(components().resolveExport(\"manifest/index.json\"), \"..\");\n return { row, entry: readJson<unknown>(join(manifestFolder, row.file)) };\n },\n utilities: () =>\n once(\"utilities\", () => {\n const found = readJson<UtilitiesFile>(components().resolveExport(\"manifest/utilities.json\"));\n if (found.schemaVersion !== SUPPORTED_SCHEMA_VERSION) {\n throw new SourceError(`The installed utilities file has schema version ${found.schemaVersion}, and this server reads version ${SUPPORTED_SCHEMA_VERSION}. Update @dbm-system/mcp.`);\n }\n return found;\n }),\n tokens: () => once(\"tokens\", () => readJson<TokenIndex>(tokens().resolveExport(\"tokens.json\"))),\n agentsGuide: () => once(\"agents\", () => readFileSync(join(components().root, \"AGENTS.md\"), \"utf8\")),\n suggest(name, candidates, limit = 3) {\n const wanted = name.toLowerCase();\n return candidates\n .map((candidate) => ({\n candidate,\n score: candidate.toLowerCase().includes(wanted) || wanted.includes(candidate.toLowerCase()) ? 0 : editDistance(name, candidate),\n }))\n .filter(({ score }) => score <= Math.max(2, Math.floor(name.length / 3)))\n .sort((a, b) => a.score - b.score || a.candidate.localeCompare(b.candidate))\n .slice(0, limit)\n .map(({ candidate }) => candidate);\n },\n };\n}\n","import { readFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join } from \"node:path\";\n\n/** Where a package was found: in the project the server was started from, or among the copies this server depends on. */\nexport type Origin = \"project\" | \"bundled\";\n\n/** One installed package the server reads files from. */\nexport interface LocatedPackage {\n /** The package's name, such as `@dbm-system/components`. */\n name: string;\n /** The version in its `package.json`. */\n version: string;\n /** The folder holding its `package.json`. */\n root: string;\n /** Whether the project or this server's own dependencies supplied it. */\n origin: Origin;\n /** Resolves a file the package's `exports` names, such as `@dbm-system/components/manifest/index.json`, to an absolute path. */\n resolveExport: (subpath: string) => string;\n}\n\n/** A reason the server cannot read what it needs, written to say what to do about it. */\nexport class SourceError extends Error {}\n\nfunction tryResolve(require: NodeJS.Require, specifier: string): string | undefined {\n try {\n return require.resolve(specifier);\n } catch {\n return undefined;\n }\n}\n\n/**\n * Finds an installed package, looking from `startDir` first so the server describes the version the project has, then from\n * this server's own dependencies.\n */\nexport function locatePackage(name: string, startDir: string): LocatedPackage {\n const candidates: Array<[NodeJS.Require, Origin]> = [\n [createRequire(join(startDir, \"dbm-system-mcp.js\")), \"project\"],\n [createRequire(import.meta.url), \"bundled\"],\n ];\n for (const [require, origin] of candidates) {\n const manifestPath = tryResolve(require, `${name}/package.json`);\n if (!manifestPath) continue;\n const { version } = JSON.parse(readFileSync(manifestPath, \"utf8\")) as { version: string };\n return {\n name,\n version,\n root: dirname(manifestPath),\n origin,\n resolveExport(subpath) {\n const resolved = tryResolve(require, `${name}/${subpath}`);\n if (!resolved) {\n throw new SourceError(`${name}@${version} has no ${subpath}. Update ${name} to a version that ships it.`);\n }\n return resolved;\n },\n };\n }\n throw new SourceError(`${name} is not installed in ${startDir}. Install it there with \\`npm install ${name}\\`.`);\n}\n","import { readFileSync } from \"node:fs\";\nimport { McpServer } from \"@modelcontextprotocol/server\";\nimport type { DbmData } from \"./data\";\nimport { registerComponentTools } from \"./tools/components\";\nimport { registerGuideTool } from \"./tools/guide\";\nimport { registerSearchTool } from \"./tools/search\";\nimport { registerTokenTools } from \"./tools/tokens\";\nimport { registerUtilityTools } from \"./tools/utilities\";\n\n/** This package's own version, which the fixed release group keeps equal to the packages it reads. */\nconst { version } = JSON.parse(readFileSync(new URL(\"../package.json\", import.meta.url), \"utf8\")) as { version: string };\n\n/**\n * Builds a new server on every call, as the SDK requires: the transport calls this once per connection. `data` is the module-scope\n * reader every tool shares.\n */\nexport function createServer(data: DbmData): McpServer {\n const server = new McpServer({ name: \"dbm-system-mcp\", version });\n registerComponentTools(server, data);\n registerUtilityTools(server, data);\n registerTokenTools(server, data);\n registerSearchTool(server, data);\n registerGuideTool(server, data);\n return server;\n}\n","import type { McpServer } from \"@modelcontextprotocol/server\";\nimport * as z from \"zod/v4\";\nimport type { DbmData } from \"../data\";\nimport { CHARACTER_LIMIT, errorResult, jsonResult, pageShape, pagedResult, pagingInput, READ_ONLY, sourceShape } from \"./shared\";\n\nfunction sourceOf(data: DbmData) {\n const { components } = data.info();\n return { package: components.name, version: components.version, origin: components.origin };\n}\n\nconst SECTIONS = [\"props\", \"parts\", \"examples\"] as const;\n\n/** Registers the tools that list and describe components. */\nexport function registerComponentTools(server: McpServer, data: DbmData): void {\n server.registerTool(\n \"dbm_list_components\",\n {\n title: \"List DBM System components\",\n description: `List the DBM System components, one row each: name, tier, category and a one-sentence summary. Read this first to see what exists before building anything, instead of guessing a name.\n\nTiers are atom, molecule, organism and template. Helpers (small components that support another and have no page of their own, such as TooltipProvider) are listed with kind \"helper\" and the component they support. Use dbm_get_component for one component's props, parts and examples, dbm_search to find one by what it does, and dbm_list_utilities for hooks and functions.\n\nExamples:\n - \"What form inputs are there?\" -> category=\"Inputs\"\n - \"List the page-level building blocks\" -> tier=\"template\"`,\n inputSchema: z.strictObject({\n tier: z.enum([\"atom\", \"molecule\", \"organism\", \"template\"]).optional().describe(\"Only components in this tier.\"),\n category: z.string().optional().describe(\"Only components in this category, such as 'Inputs', 'Navigation' or 'Overlay' (matched without regard to case).\"),\n include_helpers: z.boolean().default(true).describe(\"Whether to include helpers. Helpers have no tier or category, so any tier or category filter leaves them out.\"),\n ...pagingInput,\n }),\n outputSchema: z.object({\n source: sourceShape,\n ...pageShape,\n components: z.array(z.object({ name: z.string(), kind: z.enum([\"component\", \"helper\"]), tier: z.string().optional(), category: z.string().optional(), helper_of: z.string().optional(), summary: z.string() })),\n }),\n annotations: READ_ONLY,\n },\n async ({ tier, category, include_helpers, limit, offset }) => {\n const index = data.index();\n const rows = [\n ...index.components\n .filter((row) => (!tier || row.tier === tier) && (!category || row.category?.toLowerCase() === category.toLowerCase()))\n .map((row) => ({ name: row.name, kind: \"component\" as const, tier: row.tier, category: row.category, summary: row.summary })),\n ...(include_helpers && !tier && !category ? index.helpers.map((row) => ({ name: row.name, kind: \"helper\" as const, helper_of: row.helperOf, summary: row.summary })) : []),\n ];\n return pagedResult(rows, offset, limit, (components, page) => ({ source: sourceOf(data), ...page, components }));\n },\n );\n\n server.registerTool(\n \"dbm_get_component\",\n {\n title: \"Get a DBM System component\",\n description: `Get one component's manifest entry: what it is for, its import name, whether its ref reaches an element, its props (type, default, whether required, description), its parts (the pieces of a compound component, such as Navbar.Link) and examples. The entry is exactly what the package's manifest says, so use it instead of guessing a prop.\n\nA large component can exceed one result: then props come first, then parts, then examples, and what does not fit is named in \"omitted\" with the call that fetches it. Ask for a single part with \"part\", or for one section with \"include\".\n\nExamples:\n - \"What props does Button take?\" -> name=\"Button\"\n - \"How do I use Navbar.Link?\" -> name=\"Navbar\", part=\"Link\"\n - \"Just the props of DataTable\" -> name=\"DataTable\", include=[\"props\"]\nUse dbm_list_components or dbm_search when you do not know the exact name.`,\n inputSchema: z.strictObject({\n name: z.string().min(1).max(100).describe(\"The component or helper name, such as 'Button' or 'TooltipProvider'. Case does not matter.\"),\n include: z.array(z.enum(SECTIONS)).default([...SECTIONS]).describe(\"Which sections to include besides the summary fields: props, parts and examples.\"),\n part: z.string().min(1).max(100).optional().describe(\"Return only this part, such as 'Navbar.Link' or just 'Link'. Overrides include.\"),\n }),\n annotations: READ_ONLY,\n },\n async ({ name, include, part }) => {\n const found = data.component(name);\n if (!found) {\n const names = [...data.index().components, ...data.index().helpers].map((row) => row.name);\n const close = data.suggest(name, names);\n return errorResult(`No component named '${name}'.${close.length ? ` Did you mean ${close.map((n) => `'${n}'`).join(\", \")}?` : \"\"} Use dbm_list_components or dbm_search to find the name.`);\n }\n const entry = found.entry as Record<string, unknown> & { name: string; parts?: Array<{ name: string; summary?: string }> };\n const source = sourceOf(data);\n\n if (part) {\n const wanted = part.toLowerCase();\n const parts = entry.parts ?? [];\n const match = parts.find((candidate) => candidate.name.toLowerCase() === wanted || candidate.name.toLowerCase().endsWith(`.${wanted}`));\n if (!match) {\n const close = data.suggest(part, parts.map((candidate) => candidate.name));\n return errorResult(\n parts.length === 0\n ? `${entry.name} has no parts. Call dbm_get_component with name='${entry.name}' for its props.`\n : `${entry.name} has no part '${part}'.${close.length ? ` Did you mean ${close.map((n) => `'${n}'`).join(\", \")}?` : \"\"} Its parts are: ${parts.map((candidate) => candidate.name).join(\", \")}.`,\n );\n }\n return jsonResult({ source, component: entry.name, part: match });\n }\n\n const core: Record<string, unknown> = Object.fromEntries(Object.entries(entry).filter(([key]) => !(SECTIONS as readonly string[]).includes(key)));\n const omitted: Array<{ section: string; characters: number; fetch: string }> = [];\n const fits = (candidate: Record<string, unknown>) => JSON.stringify({ source, component: candidate, omitted: [] }).length <= CHARACTER_LIMIT;\n let outlined = false;\n for (const section of SECTIONS.filter((s) => include.includes(s))) {\n const value = entry[section];\n if (value === undefined) continue;\n if (fits({ ...core, [section]: value })) {\n core[section] = value;\n } else if (section === \"parts\" && Array.isArray(entry.parts) && fits({ ...core, parts: entry.parts.map(({ name: partName, summary }) => ({ name: partName, summary })) })) {\n core.parts = entry.parts.map(({ name: partName, summary }) => ({ name: partName, summary }));\n outlined = true;\n omitted.push({ section: \"parts (props of each part)\", characters: JSON.stringify(value).length, fetch: `dbm_get_component with name='${entry.name}' and part set to one of the part names` });\n } else {\n omitted.push({ section, characters: JSON.stringify(value).length, fetch: `dbm_get_component with name='${entry.name}' and include=['${section}']` });\n }\n }\n return jsonResult({ source, component: core, ...(omitted.length ? { omitted } : {}), ...(outlined ? { note: \"parts lists each part's name and summary only.\" } : {}) });\n },\n );\n}\n","import type { CallToolResult } from \"@modelcontextprotocol/server\";\nimport * as z from \"zod/v4\";\n\n/** The most characters of text one result may carry. A page stays under it by holding fewer items, never by cutting text. */\nexport const CHARACTER_LIMIT = 25_000;\n\n/** Every tool reads files that ship in the packages and changes nothing, so a client may run them without asking. */\nexport const READ_ONLY = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false } as const;\n\n/** The `limit` and `offset` arguments every list tool takes. */\nexport const pagingInput = {\n limit: z.number().int().min(1).max(200).default(50).describe(\"The most items to return in one page.\"),\n offset: z.number().int().min(0).default(0).describe(\"How many items to skip, to read the next page. Use `next_offset` from the previous page.\"),\n};\n\n/** The fields that say where a page sits in the whole list. */\nexport const pageShape = {\n total: z.number().describe(\"How many items match in all.\"),\n count: z.number().describe(\"How many are in this page.\"),\n offset: z.number().describe(\"How many were skipped.\"),\n has_more: z.boolean().describe(\"Whether more items follow this page.\"),\n next_offset: z.number().optional().describe(\"The `offset` that reads the next page. Present only when `has_more` is true.\"),\n};\n\n/** Where the answer came from: the package, its version, and whether the project or this server supplied it. */\nexport const sourceShape = z.object({\n package: z.string(),\n version: z.string(),\n origin: z.enum([\"project\", \"bundled\"]).describe(\"`project` is the copy installed where the server was started; `bundled` is the copy this server depends on.\"),\n});\n\n/** A result carrying `data` as structured content and, as the protocol asks, the same data as JSON text. Compact, because an agent reads it. */\nexport function jsonResult(data: Record<string, unknown>): CallToolResult {\n return { content: [{ type: \"text\", text: JSON.stringify(data) }], structuredContent: data };\n}\n\n/** A result the model reads as an error, written to say what to try next. */\nexport function errorResult(message: string): CallToolResult {\n return { isError: true, content: [{ type: \"text\", text: message }] };\n}\n\n/**\n * Reads one page of `all` and returns the result for it. The page is halved until its text fits `CHARACTER_LIMIT`, so\n * `next_offset` points at the first item left out and nothing is cut mid-item.\n */\nexport function pagedResult<T>(all: readonly T[], offset: number, limit: number, build: (items: T[], page: Record<string, unknown>) => Record<string, unknown>): CallToolResult {\n let items = all.slice(offset, offset + limit);\n const render = (): Record<string, unknown> => {\n const next = offset + items.length;\n const has_more = next < all.length;\n return build(items, { total: all.length, count: items.length, offset, has_more, ...(has_more ? { next_offset: next } : {}) });\n };\n let data = render();\n while (items.length > 1 && JSON.stringify(data).length > CHARACTER_LIMIT) {\n items = items.slice(0, Math.ceil(items.length / 2));\n data = render();\n }\n return jsonResult(data);\n}\n","import type { McpServer } from \"@modelcontextprotocol/server\";\nimport * as z from \"zod/v4\";\nimport type { DbmData } from \"../data\";\nimport { READ_ONLY } from \"./shared\";\n\n/** Registers the tool that returns the consumer guide. */\nexport function registerGuideTool(server: McpServer, data: DbmData): void {\n server.registerTool(\n \"dbm_get_agent_guide\",\n {\n title: \"Get the DBM System guide for agents\",\n description: `Get the guide that ships with the components package for AI coding agents: how to install and set up the package, the conventions every component follows (sizes, field states, spacing, tokens), and where to look things up. Read it once at the start of a task that builds with DBM System. It returns Markdown.`,\n inputSchema: z.strictObject({}),\n annotations: READ_ONLY,\n },\n async () => ({ content: [{ type: \"text\", text: data.agentsGuide() }] }),\n );\n}\n","import type { McpServer } from \"@modelcontextprotocol/server\";\nimport * as z from \"zod/v4\";\nimport type { DbmData } from \"../data\";\nimport { pageShape, pagedResult, pagingInput, READ_ONLY } from \"./shared\";\n\nconst KINDS = [\"component\", \"helper\", \"hook\", \"function\", \"constant\", \"token\"] as const;\n\ninterface Candidate {\n kind: (typeof KINDS)[number];\n name: string;\n summary: string;\n}\n\n/**\n * How well a candidate matches the query: the points its words earn, and how many of the words it lacks. A name match counts far\n * more than a summary match, and an exact or leading name match more still.\n */\nfunction score(candidate: Candidate, words: string[], phrase: string): { points: number; missing: number } {\n const name = candidate.name.toLowerCase();\n const summary = candidate.summary.toLowerCase();\n let points = 0;\n let missing = 0;\n for (const word of words) {\n if (name.includes(word)) points += 20;\n else if (summary.includes(word)) points += 3;\n else missing += 1;\n }\n if (points > 0 && name === phrase) points += 100;\n else if (points > 0 && name.startsWith(phrase)) points += 40;\n return { points, missing };\n}\n\n/** Registers the tool that searches across everything the server knows. */\nexport function registerSearchTool(server: McpServer, data: DbmData): void {\n server.registerTool(\n \"dbm_search\",\n {\n title: \"Search DBM System\",\n description: `Search components, helpers, hooks, functions, constants and design tokens by name and by what they do. Results that contain every word of the query come first, best match first. When nothing contains them all, the results that contain some of the words are returned, and \"note\" says so.\n\nUse it when you know what you need but not the name. Then call dbm_get_component, dbm_get_utility or dbm_get_tokens with the name it returns.\n\nExamples:\n - \"date range\" -> finds DateRangePicker\n - \"toast\" -> finds Toast, useToast, createToaster\n - \"focus ring\" -> finds the focus tokens`,\n inputSchema: z.strictObject({\n query: z.string().min(2).max(200).describe(\"Words to look for, such as 'date range' or 'toast'.\"),\n kinds: z.array(z.enum(KINDS)).optional().describe(\"Only these kinds of result. Leave out to search them all.\"),\n ...pagingInput,\n }),\n outputSchema: z.object({\n ...pageShape,\n note: z.string().optional().describe(\"Present when no result contained every word and the results hold only some of them.\"),\n results: z.array(z.object({ kind: z.enum(KINDS), name: z.string(), summary: z.string() })),\n }),\n annotations: READ_ONLY,\n },\n async ({ query, kinds, limit, offset }) => {\n const index = data.index();\n const utilities = data.utilities();\n const candidates: Candidate[] = [\n ...index.components.map((row) => ({ kind: \"component\" as const, name: row.name, summary: row.summary })),\n ...index.helpers.map((row) => ({ kind: \"helper\" as const, name: row.name, summary: row.summary })),\n ...index.utilities.map((row) => ({ kind: row.kind === \"hook\" ? (\"hook\" as const) : (\"function\" as const), name: row.name, summary: row.summary })),\n ...utilities.constants.map((row) => ({ kind: \"constant\" as const, name: row.name, summary: typeof row.summary === \"string\" ? row.summary : \"\" })),\n ...data.tokens().tokens.map((token) => ({ kind: \"token\" as const, name: token.name, summary: token.purpose ?? `${token.layer} ${token.group} ${token.type} token` })),\n ];\n const phrase = query.trim().toLowerCase();\n const words = phrase.split(/\\s+/).filter(Boolean);\n const scored = candidates\n .filter((candidate) => !kinds || kinds.includes(candidate.kind))\n .map((candidate) => ({ candidate, ...score(candidate, words, phrase) }))\n .filter(({ points }) => points > 0);\n const rank = (a: (typeof scored)[number], b: (typeof scored)[number]) => b.points - a.points || a.candidate.name.localeCompare(b.candidate.name);\n const exact = scored.filter(({ missing }) => missing === 0).sort(rank);\n const partial = exact.length === 0 && words.length > 1;\n const results = (partial ? scored.sort((a, b) => a.missing - b.missing || rank(a, b)) : exact).map(({ candidate }) => candidate);\n return pagedResult(results, offset, limit, (items, page) => ({\n ...page,\n ...(partial && results.length > 0 ? { note: \"No result contains every word of the query, so these contain some of the words.\" } : {}),\n results: items,\n }));\n },\n );\n}\n","import type { McpServer } from \"@modelcontextprotocol/server\";\nimport * as z from \"zod/v4\";\nimport type { DbmData, TokenEntry } from \"../data\";\nimport { errorResult, pageShape, pagedResult, pagingInput, READ_ONLY } from \"./shared\";\n\n/** One token as the tool returns it: the index's own fields, with the per-theme maps reduced to one value when a theme is asked for. */\nfunction forTheme(token: TokenEntry, theme: string | undefined): Record<string, unknown> {\n if (!theme) return { ...token };\n const { values, aliases, ...rest } = token;\n return { ...rest, ...(values ? { value: values[theme] } : {}), ...(aliases && aliases[theme] ? { alias: aliases[theme] } : {}) };\n}\n\n/** Registers the tool that looks up design tokens. */\nexport function registerTokenTools(server: McpServer, data: DbmData): void {\n server.registerTool(\n \"dbm_get_tokens\",\n {\n title: \"Look up DBM System design tokens\",\n description: `Look up design tokens: each one's CSS custom property name, layer, group, type, resolved value, the token it aliases, what it is for (when the source says) and which components use it. Components take their colors, spacing and so on from semantic tokens (layer \"semantic\", such as --dbm-bg-brand), never from primitives or hard-coded values, so find the right semantic token here.\n\nSemantic tokens have a value per theme (purple-light, purple-dark, emerald-light, emerald-dark); pass \"theme\" to get one value instead of all four. Filters combine.\n\nExamples:\n - \"What color is the brand background in dark mode?\" -> name_contains=\"bg-brand\", theme=\"purple-dark\"\n - \"Which tokens does Button use?\" -> used_by=\"Button\"\n - \"List the border tokens\" -> layer=\"semantic\", group=\"border\"`,\n inputSchema: z.strictObject({\n name_contains: z.string().min(1).max(100).optional().describe(\"Only tokens whose name contains this text, such as 'bg-brand' (without regard to case).\"),\n layer: z.enum([\"primitive\", \"semantic\", \"component\"]).optional().describe(\"Only tokens in this layer.\"),\n group: z.string().optional().describe(\"Only tokens in this group, such as 'bg', 'border', 'text', 'space' or 'button'.\"),\n used_by: z.string().optional().describe(\"Only tokens that this component's own stylesheet uses, such as 'Button'.\"),\n theme: z.string().optional().describe(\"Return one value for this theme instead of every theme's, such as 'purple-light'.\"),\n ...pagingInput,\n }),\n outputSchema: z.object({\n version: z.string().describe(\"The version of the tokens package.\"),\n origin: z.enum([\"project\", \"bundled\"]),\n themes: z.array(z.string()),\n ...pageShape,\n tokens: z.array(z.record(z.string(), z.unknown())),\n }),\n annotations: READ_ONLY,\n },\n async ({ name_contains, layer, group, used_by, theme, limit, offset }) => {\n const index = data.tokens();\n if (theme && !index.themes.includes(theme)) {\n return errorResult(`No theme named '${theme}'. The themes are ${index.themes.map((t) => `'${t}'`).join(\", \")}.`);\n }\n const text = name_contains?.toLowerCase();\n const user = used_by?.toLowerCase();\n const matches = index.tokens.filter(\n (token) =>\n (!text || token.name.toLowerCase().includes(text)) &&\n (!layer || token.layer === layer) &&\n (!group || token.group === group) &&\n (!user || token.usedBy?.some((component) => component.toLowerCase() === user)),\n );\n const { tokens: info } = data.info();\n return pagedResult(matches, offset, limit, (tokens, page) => ({ version: info.version, origin: info.origin, themes: index.themes, ...page, tokens: tokens.map((token) => forTheme(token, theme)) }));\n },\n );\n}\n","import type { McpServer } from \"@modelcontextprotocol/server\";\nimport * as z from \"zod/v4\";\nimport type { DbmData } from \"../data\";\nimport { errorResult, jsonResult, pageShape, pagedResult, pagingInput, READ_ONLY, sourceShape } from \"./shared\";\n\n/** Registers the tools that list and describe hooks, functions and constants. */\nexport function registerUtilityTools(server: McpServer, data: DbmData): void {\n const source = () => {\n const { components } = data.info();\n return { package: components.name, version: components.version, origin: components.origin };\n };\n\n server.registerTool(\n \"dbm_list_utilities\",\n {\n title: \"List DBM System hooks and functions\",\n description: `List the hooks and functions the components package exports besides its components (for example useToast, useTheme, createToaster, formatRelativeTime), one row each with a one-sentence summary. Use dbm_get_utility for the signature, parameters and examples of one.\n\nExample: \"Is there a hook for toasts?\" -> kind=\"hook\"`,\n inputSchema: z.strictObject({\n kind: z.enum([\"hook\", \"function\"]).optional().describe(\"Only hooks, or only functions.\"),\n ...pagingInput,\n }),\n outputSchema: z.object({\n source: sourceShape,\n ...pageShape,\n utilities: z.array(z.object({ name: z.string(), kind: z.string(), summary: z.string() })),\n }),\n annotations: READ_ONLY,\n },\n async ({ kind, limit, offset }) => {\n const rows = data.index().utilities.filter((row) => !kind || row.kind === kind);\n return pagedResult(rows, offset, limit, (utilities, page) => ({ source: source(), ...page, utilities }));\n },\n );\n\n server.registerTool(\n \"dbm_get_utility\",\n {\n title: \"Get a DBM System hook, function or constant\",\n description: `Get one hook, function or constant in full: its signature, parameters, return type and examples, exactly as the package's manifest records it.\n\nExample: \"How do I call useToast?\" -> name=\"useToast\"\nUse dbm_list_utilities or dbm_search when you do not know the exact name.`,\n inputSchema: z.strictObject({\n name: z.string().min(1).max(100).describe(\"The hook, function or constant name, such as 'useToast'. Case does not matter.\"),\n }),\n annotations: READ_ONLY,\n },\n async ({ name }) => {\n const file = data.utilities();\n const wanted = name.toLowerCase();\n const found = [...file.utilities, ...file.constants].find((entry) => entry.name.toLowerCase() === wanted);\n if (!found) {\n const close = data.suggest(name, [...file.utilities, ...file.constants].map((entry) => entry.name));\n return errorResult(`No hook, function or constant named '${name}'.${close.length ? ` Did you mean ${close.map((n) => `'${n}'`).join(\", \")}?` : \"\"} Use dbm_list_utilities or dbm_search to find the name.`);\n }\n return jsonResult({ source: source(), utility: found });\n },\n );\n}\n"],"mappings":";;;AACA,SAAS,kBAAkB;;;ACD3B,SAAS,gBAAAA,qBAAoB;AAC7B,SAAS,QAAAC,aAAY;;;ACDrB,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,SAAS,YAAY;AAoBvB,IAAM,cAAN,cAA0B,MAAM;AAAC;AAExC,SAAS,WAAWC,UAAyB,WAAuC;AAClF,MAAI;AACF,WAAOA,SAAQ,QAAQ,SAAS;AAAA,EAClC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAMO,SAAS,cAAc,MAAc,UAAkC;AAC5E,QAAM,aAA8C;AAAA,IAClD,CAAC,cAAc,KAAK,UAAU,mBAAmB,CAAC,GAAG,SAAS;AAAA,IAC9D,CAAC,cAAc,YAAY,GAAG,GAAG,SAAS;AAAA,EAC5C;AACA,aAAW,CAACA,UAAS,MAAM,KAAK,YAAY;AAC1C,UAAM,eAAe,WAAWA,UAAS,GAAG,IAAI,eAAe;AAC/D,QAAI,CAAC,aAAc;AACnB,UAAM,EAAE,SAAAC,SAAQ,IAAI,KAAK,MAAM,aAAa,cAAc,MAAM,CAAC;AACjE,WAAO;AAAA,MACL;AAAA,MACA,SAAAA;AAAA,MACA,MAAM,QAAQ,YAAY;AAAA,MAC1B;AAAA,MACA,cAAc,SAAS;AACrB,cAAM,WAAW,WAAWD,UAAS,GAAG,IAAI,IAAI,OAAO,EAAE;AACzD,YAAI,CAAC,UAAU;AACb,gBAAM,IAAI,YAAY,GAAG,IAAI,IAAIC,QAAO,WAAW,OAAO,YAAY,IAAI,8BAA8B;AAAA,QAC1G;AACA,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACA,QAAM,IAAI,YAAY,GAAG,IAAI,wBAAwB,QAAQ,yCAAyC,IAAI,KAAK;AACjH;;;ADCO,IAAM,2BAA2B;AAsBxC,SAAS,SAAY,MAAiB;AACpC,SAAO,K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I,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,KAAK,IAAI,CAAC,MAAM,EAAE,yDAAyD;AAAA,MAC5M;AACA,aAAO,WAAW,EAAE,QAAQ,OAAO,GAAG,SAAS,MAAM,CAAC;AAAA,IACxD;AAAA,EACF;AACF;;;ANlDA,IAAM,EAAE,QAAQ,IAAI,KAAK,MAAMC,cAAa,IAAI,IAAI,mBAAmB,YAAY,GAAG,GAAG,MAAM,CAAC;AAMzF,SAAS,aAAaC,OAA0B;AACrD,QAAM,SAAS,IAAI,UAAU,EAAE,MAAM,kBAAkB,QAAQ,CAAC;AAChE,yBAAuB,QAAQA,KAAI;AACnC,uBAAqB,QAAQA,KAAI;AACjC,qBAAmB,QAAQA,KAAI;AAC/B,qBAAmB,QAAQA,KAAI;AAC/B,oBAAkB,QAAQA,KAAI;AAC9B,SAAO;AACT;;;AHlBA,IAAM,OAAO,SAAS,QAAQ,IAAI,CAAC;AACnC,WAAW,MAAM,aAAa,IAAI,CAAC;AACnC,QAAQ,MAAM,iCAAiC;","names":["readFileSync","join","require","version","readFileSync","join","score","readFileSync","z","data","data","z","data","z","data","z","data","z","data","readFileSync","data"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/data.ts","../src/sources.ts","../src/project.ts","../src/server.ts","../src/tools/components.ts","../src/tools/shared.ts","../src/tools/guide.ts","../src/tools/search.ts","../src/tools/tokens.ts","../src/tools/utilities.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { serveStdio } from \"@modelcontextprotocol/server/stdio\";\nimport { openData } from \"./data\";\nimport { projectFolders } from \"./project\";\nimport { createServer } from \"./server\";\n\n// stdout carries the protocol, so anything this program says goes to stderr.\nconst { folders, warnings } = projectFolders(process.argv.slice(2), process.env, process.cwd());\nconst data = openData(folders, warnings);\nserveStdio(() => createServer(data));\nconsole.error(\"dbm-system-mcp running on stdio\");\n","import { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { locatePackage, SourceError, type Locate, type LocatedPackage } from \"./sources\";\n\n/** One component or helper row of `manifest/index.json`. */\nexport interface IndexRow {\n name: string;\n summary: string;\n /** The component's file, relative to the `manifest` folder. */\n file: string;\n tier?: string;\n category?: string;\n /** For a helper, the component it supports. */\n helperOf?: string;\n}\n\n/** One hook or function row of `manifest/index.json`. */\nexport interface UtilityRow {\n name: string;\n kind: string;\n summary: string;\n}\n\n/** `manifest/index.json`. */\nexport interface ManifestIndex {\n schemaVersion: number;\n package: string;\n version: string;\n components: IndexRow[];\n helpers: IndexRow[];\n utilities: UtilityRow[];\n}\n\n/** `manifest/utilities.json`: every hook, function and constant, in full. */\nexport interface UtilitiesFile {\n schemaVersion: number;\n utilities: Array<{ name: string; kind?: string; summary?: string } & Record<string, unknown>>;\n constants: Array<{ name: string } & Record<string, unknown>>;\n}\n\n/** One token of `tokens.json`. */\nexport interface TokenEntry {\n name: string;\n layer: string;\n group: string;\n type: string;\n values?: Record<string, string>;\n value?: string;\n aliases?: Record<string, string>;\n usedBy?: string[];\n purpose?: string;\n}\n\n/** `tokens.json`. */\nexport interface TokenIndex {\n version: string;\n themes: string[];\n tokens: TokenEntry[];\n}\n\n/** The manifest schema version this server reads. A different version is refused rather than read wrongly. */\nexport const SUPPORTED_SCHEMA_VERSION = 1;\n\n/** Which packages the data came from, for a tool to say what version it is describing. */\nexport interface SourceInfo {\n components: Pick<LocatedPackage, \"name\" | \"version\" | \"origin\">;\n tokens: Pick<LocatedPackage, \"name\" | \"version\" | \"origin\">;\n /** The folders searched for the project's packages, in order. */\n searched: readonly string[];\n}\n\n/** Everything the server reads, each file loaded on first use and kept for the life of the process. */\nexport interface DbmData {\n info(): SourceInfo;\n /**\n * When the components or the tokens came from the copy bundled with this server and not from the project, a message that says so\n * and how to fix it (ADR-0232); `undefined` when both came from the project.\n */\n note(): string | undefined;\n index(): ManifestIndex;\n /** One component's or helper's manifest entry, found by name without regard to case, or `undefined` when there is none. */\n component(name: string): { row: IndexRow; entry: unknown } | undefined;\n utilities(): UtilitiesFile;\n tokens(): TokenIndex;\n /** The consumer guide that ships with the components package. */\n agentsGuide(): string;\n /** Up to `limit` names from `candidates` that are close to `name`, for \"did you mean\" messages. */\n suggest(name: string, candidates: readonly string[], limit?: number): string[];\n}\n\nfunction readJson<T>(path: string): T {\n return JSON.parse(readFileSync(path, \"utf8\")) as T;\n}\n\n/** The number of single-character edits between two strings, compared without regard to case. */\nfunction editDistance(a: string, b: string): number {\n const x = a.toLowerCase();\n const y = b.toLowerCase();\n let previous = Array.from({ length: y.length + 1 }, (_, index) => index);\n for (let i = 1; i <= x.length; i += 1) {\n const row = [i];\n for (let j = 1; j <= y.length; j += 1) {\n const cost = x[i - 1] === y[j - 1] ? 0 : 1;\n row[j] = Math.min((previous[j] ?? 0) + 1, (row[j - 1] ?? 0) + 1, (previous[j - 1] ?? 0) + cost);\n }\n previous = row;\n }\n return previous[y.length] ?? 0;\n}\n\n/**\n * Opens the installed packages, looking in `startDirs` in order and then at this server's own dependencies, and returns the readers.\n * `warnings` are what was wrong with a setting that named a folder; they go into the note a fallback carries. Nothing is read until\n * a reader is called.\n */\nexport function openData(startDirs: string | readonly string[], warnings: readonly string[] = [], locate: Locate = locatePackage): DbmData {\n const folders = typeof startDirs === \"string\" ? [startDirs] : startDirs;\n const cache = new Map<string, unknown>();\n const once = <T>(key: string, load: () => T): T => {\n if (!cache.has(key)) cache.set(key, load());\n return cache.get(key) as T;\n };\n const components = () => once(\"components-package\", () => locate(\"@dbm-system/components\", folders));\n const tokens = () => once(\"tokens-package\", () => locate(\"@dbm-system/tokens\", folders));\n\n const index = () =>\n once(\"index\", () => {\n const pkg = components();\n const found = readJson<ManifestIndex>(pkg.resolveExport(\"manifest/index.json\"));\n if (found.schemaVersion !== SUPPORTED_SCHEMA_VERSION) {\n throw new SourceError(\n `${pkg.name}@${pkg.version} has manifest schema version ${found.schemaVersion}, and this server reads version ${SUPPORTED_SCHEMA_VERSION}. Update @dbm-system/mcp.`,\n );\n }\n return found;\n });\n\n return {\n info: () => ({\n components: { name: components().name, version: components().version, origin: components().origin },\n tokens: { name: tokens().name, version: tokens().version, origin: tokens().origin },\n searched: folders,\n }),\n note() {\n const bundled = [components(), tokens()].filter((pkg) => pkg.origin === \"bundled\");\n if (bundled.length === 0) return undefined;\n const described = bundled.map((pkg) => `${pkg.name}@${pkg.version}`).join(\" and \");\n return [\n `These answers come from the copy bundled with @dbm-system/mcp (${described}), not from your project: no ${bundled.map((pkg) => pkg.name).join(\" or \")} was found from ${folders.join(\" or \")}.`,\n ...warnings,\n \"Start the server from your project's root, or set DBM_SYSTEM_PROJECT_DIR (or pass --project <folder>) to it.\",\n ].join(\" \");\n },\n index,\n component(name) {\n const wanted = name.toLowerCase();\n const { components: rows, helpers } = index();\n // The file to open comes from the index row, never from the caller's text, so a name cannot reach another path.\n const row = [...rows, ...helpers].find((candidate) => candidate.name.toLowerCase() === wanted);\n if (!row) return undefined;\n const manifestFolder = join(components().resolveExport(\"manifest/index.json\"), \"..\");\n return { row, entry: readJson<unknown>(join(manifestFolder, row.file)) };\n },\n utilities: () =>\n once(\"utilities\", () => {\n const found = readJson<UtilitiesFile>(components().resolveExport(\"manifest/utilities.json\"));\n if (found.schemaVersion !== SUPPORTED_SCHEMA_VERSION) {\n throw new SourceError(`The installed utilities file has schema version ${found.schemaVersion}, and this server reads version ${SUPPORTED_SCHEMA_VERSION}. Update @dbm-system/mcp.`);\n }\n return found;\n }),\n tokens: () => once(\"tokens\", () => readJson<TokenIndex>(tokens().resolveExport(\"tokens.json\"))),\n agentsGuide: () => once(\"agents\", () => readFileSync(join(components().root, \"AGENTS.md\"), \"utf8\")),\n suggest(name, candidates, limit = 3) {\n const wanted = name.toLowerCase();\n return candidates\n .map((candidate) => ({\n candidate,\n score: candidate.toLowerCase().includes(wanted) || wanted.includes(candidate.toLowerCase()) ? 0 : editDistance(name, candidate),\n }))\n .filter(({ score }) => score <= Math.max(2, Math.floor(name.length / 3)))\n .sort((a, b) => a.score - b.score || a.candidate.localeCompare(b.candidate))\n .slice(0, limit)\n .map(({ candidate }) => candidate);\n },\n };\n}\n","import { readFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join } from \"node:path\";\n\n/** Where a package was found: in the project the server was started from, or among the copies this server depends on. */\nexport type Origin = \"project\" | \"bundled\";\n\n/** One installed package the server reads files from. */\nexport interface LocatedPackage {\n /** The package's name, such as `@dbm-system/components`. */\n name: string;\n /** The version in its `package.json`. */\n version: string;\n /** The folder holding its `package.json`. */\n root: string;\n /** Whether the project or this server's own dependencies supplied it. */\n origin: Origin;\n /** For a package found in the project, the folder it was resolved from. */\n foundFrom?: string;\n /** Resolves a file the package's `exports` names, such as `@dbm-system/components/manifest/index.json`, to an absolute path. */\n resolveExport: (subpath: string) => string;\n}\n\n/** A reason the server cannot read what it needs, written to say what to do about it. */\nexport class SourceError extends Error {}\n\nfunction tryResolve(require: NodeJS.Require, specifier: string): string | undefined {\n try {\n return require.resolve(specifier);\n } catch {\n return undefined;\n }\n}\n\n/** Finds an installed package; the tests give the readers a stand-in for this. */\nexport type Locate = (name: string, startDirs: readonly string[]) => LocatedPackage;\n\n/**\n * Finds an installed package, looking from each of `startDirs` in turn so the server describes the version the project has, then\n * from this server's own dependencies.\n */\nexport const locatePackage: Locate = (name, startDirs) => {\n const candidates: Array<[NodeJS.Require, Origin, string | undefined]> = [\n ...startDirs.map((dir): [NodeJS.Require, Origin, string] => [createRequire(join(dir, \"dbm-system-mcp.js\")), \"project\", dir]),\n [createRequire(import.meta.url), \"bundled\", undefined],\n ];\n for (const [require, origin, foundFrom] of candidates) {\n const manifestPath = tryResolve(require, `${name}/package.json`);\n if (!manifestPath) continue;\n const { version } = JSON.parse(readFileSync(manifestPath, \"utf8\")) as { version: string };\n return {\n name,\n version,\n root: dirname(manifestPath),\n origin,\n ...(foundFrom ? { foundFrom } : {}),\n resolveExport(subpath) {\n const resolved = tryResolve(require, `${name}/${subpath}`);\n if (!resolved) {\n throw new SourceError(`${name}@${version} has no ${subpath}. Update ${name} to a version that ships it.`);\n }\n return resolved;\n },\n };\n }\n throw new SourceError(`${name} is not installed in ${startDirs.join(\" or \")}. Install it there with \\`npm install ${name}\\`.`);\n};\n","import { statSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\n/** The environment variable and the argument that name the project's folder explicitly. */\nexport const PROJECT_ENV = \"DBM_SYSTEM_PROJECT_DIR\";\nexport const PROJECT_ARG = \"--project\";\n\n/** The folders to look in for the installed packages, in order, and anything wrong with the setting that named one. */\nexport interface ProjectFolders {\n folders: string[];\n /** Messages about a setting that did not name a folder, for the note a fallback carries. */\n warnings: string[];\n}\n\nfunction argumentValue(argv: readonly string[]): string | undefined {\n const index = argv.findIndex((entry) => entry === PROJECT_ARG || entry.startsWith(`${PROJECT_ARG}=`));\n if (index === -1) return undefined;\n const entry = argv[index] as string;\n return entry.includes(\"=\") ? entry.slice(PROJECT_ARG.length + 1) : (argv[index + 1] ?? \"\");\n}\n\nfunction isFolder(path: string): boolean {\n try {\n return statSync(path).isDirectory();\n } catch {\n return false;\n }\n}\n\n/**\n * Works out where to look for the project's installed packages (ADR-0232): the explicit setting (the `--project` argument, then\n * `DBM_SYSTEM_PROJECT_DIR`), the folder the server was started in, then `CLAUDE_PROJECT_DIR`. The working folder comes before\n * `CLAUDE_PROJECT_DIR` so a monorepo whose packages are installed in a nested folder still works.\n */\nexport function projectFolders(argv: readonly string[], env: NodeJS.ProcessEnv, cwd: string): ProjectFolders {\n const warnings: string[] = [];\n const candidates: string[] = [];\n const fromArgument = argumentValue(argv);\n const [source, value] = fromArgument !== undefined ? [PROJECT_ARG, fromArgument] : [PROJECT_ENV, env[PROJECT_ENV]];\n if (value === \"\") {\n warnings.push(`${source} is empty.`);\n } else if (value !== undefined) {\n const folder = resolve(cwd, value);\n if (isFolder(folder)) candidates.push(folder);\n else warnings.push(`${source} is \"${value}\", which is not a folder.`);\n }\n candidates.push(cwd);\n const claude = env.CLAUDE_PROJECT_DIR;\n if (claude) candidates.push(resolve(cwd, claude));\n return { folders: [...new Set(candidates)], warnings };\n}\n","import { readFileSync } from \"node:fs\";\nimport { McpServer } from \"@modelcontextprotocol/server\";\nimport type { DbmData } from \"./data\";\nimport { registerComponentTools } from \"./tools/components\";\nimport { registerGuideTool } from \"./tools/guide\";\nimport { registerSearchTool } from \"./tools/search\";\nimport { registerTokenTools } from \"./tools/tokens\";\nimport { registerUtilityTools } from \"./tools/utilities\";\n\n/** This package's own version, which the fixed release group keeps equal to the packages it reads. */\nconst { version } = JSON.parse(readFileSync(new URL(\"../package.json\", import.meta.url), \"utf8\")) as { version: string };\n\n/**\n * Builds a new server on every call, as the SDK requires: the transport calls this once per connection. `data` is the module-scope\n * reader every tool shares.\n */\nexport function createServer(data: DbmData): McpServer {\n const server = new McpServer({ name: \"dbm-system-mcp\", version });\n registerComponentTools(server, data);\n registerUtilityTools(server, data);\n registerTokenTools(server, data);\n registerSearchTool(server, data);\n registerGuideTool(server, data);\n return server;\n}\n","import type { McpServer } from \"@modelcontextprotocol/server\";\nimport * as z from \"zod/v4\";\nimport type { DbmData } from \"../data\";\nimport { CHARACTER_LIMIT, errorResult, jsonResult, noteShape, pageShape, pagedResult, pagingInput, READ_ONLY, sourceNote, sourceShape } from \"./shared\";\n\nfunction sourceOf(data: DbmData) {\n const { components } = data.info();\n return { package: components.name, version: components.version, origin: components.origin };\n}\n\nconst SECTIONS = [\"props\", \"parts\", \"examples\"] as const;\n\n/** Registers the tools that list and describe components. */\nexport function registerComponentTools(server: McpServer, data: DbmData): void {\n server.registerTool(\n \"dbm_list_components\",\n {\n title: \"List DBM System components\",\n description: `List the DBM System components, one row each: name, tier, category and a one-sentence summary. Read this first to see what exists before building anything, instead of guessing a name.\n\nTiers are atom, molecule, organism and template. Helpers (small components that support another and have no page of their own, such as TooltipProvider) are listed with kind \"helper\" and the component they support. Use dbm_get_component for one component's props, parts and examples, dbm_search to find one by what it does, and dbm_list_utilities for hooks and functions.\n\nExamples:\n - \"What form inputs are there?\" -> category=\"Inputs\"\n - \"List the page-level building blocks\" -> tier=\"template\"`,\n inputSchema: z.strictObject({\n tier: z.enum([\"atom\", \"molecule\", \"organism\", \"template\"]).optional().describe(\"Only components in this tier.\"),\n category: z.string().optional().describe(\"Only components in this category, such as 'Inputs', 'Navigation' or 'Overlay' (matched without regard to case).\"),\n include_helpers: z.boolean().default(true).describe(\"Whether to include helpers. Helpers have no tier or category, so any tier or category filter leaves them out.\"),\n ...pagingInput,\n }),\n outputSchema: z.object({\n source: sourceShape,\n note: noteShape,\n ...pageShape,\n components: z.array(z.object({ name: z.string(), kind: z.enum([\"component\", \"helper\"]), tier: z.string().optional(), category: z.string().optional(), helper_of: z.string().optional(), summary: z.string() })),\n }),\n annotations: READ_ONLY,\n },\n async ({ tier, category, include_helpers, limit, offset }) => {\n const index = data.index();\n const rows = [\n ...index.components\n .filter((row) => (!tier || row.tier === tier) && (!category || row.category?.toLowerCase() === category.toLowerCase()))\n .map((row) => ({ name: row.name, kind: \"component\" as const, tier: row.tier, category: row.category, summary: row.summary })),\n ...(include_helpers && !tier && !category ? index.helpers.map((row) => ({ name: row.name, kind: \"helper\" as const, helper_of: row.helperOf, summary: row.summary })) : []),\n ];\n return pagedResult(rows, offset, limit, (components, page) => ({ source: sourceOf(data), ...sourceNote(data), ...page, components }));\n },\n );\n\n server.registerTool(\n \"dbm_get_component\",\n {\n title: \"Get a DBM System component\",\n description: `Get one component's manifest entry: what it is for, its import name, whether its ref reaches an element, its props (type, default, whether required, description), its parts (the pieces of a compound component, such as Navbar.Link) and examples. The entry is exactly what the package's manifest says, so use it instead of guessing a prop.\n\nA large component can exceed one result: then props come first, then parts, then examples, and what does not fit is named in \"omitted\" with the call that fetches it. Ask for a single part with \"part\", or for one section with \"include\".\n\nExamples:\n - \"What props does Button take?\" -> name=\"Button\"\n - \"How do I use Navbar.Link?\" -> name=\"Navbar\", part=\"Link\"\n - \"Just the props of DataTable\" -> name=\"DataTable\", include=[\"props\"]\nUse dbm_list_components or dbm_search when you do not know the exact name.`,\n inputSchema: z.strictObject({\n name: z.string().min(1).max(100).describe(\"The component or helper name, such as 'Button' or 'TooltipProvider'. Case does not matter.\"),\n include: z.array(z.enum(SECTIONS)).default([...SECTIONS]).describe(\"Which sections to include besides the summary fields: props, parts and examples.\"),\n part: z.string().min(1).max(100).optional().describe(\"Return only this part, such as 'Navbar.Link' or just 'Link'. Overrides include.\"),\n }),\n annotations: READ_ONLY,\n },\n async ({ name, include, part }) => {\n const found = data.component(name);\n if (!found) {\n const names = [...data.index().components, ...data.index().helpers].map((row) => row.name);\n const close = data.suggest(name, names);\n return errorResult(`No component named '${name}'.${close.length ? ` Did you mean ${close.map((n) => `'${n}'`).join(\", \")}?` : \"\"} Use dbm_list_components or dbm_search to find the name.`);\n }\n const entry = found.entry as Record<string, unknown> & { name: string; parts?: Array<{ name: string; summary?: string }> };\n const source = sourceOf(data);\n\n if (part) {\n const wanted = part.toLowerCase();\n const parts = entry.parts ?? [];\n const match = parts.find((candidate) => candidate.name.toLowerCase() === wanted || candidate.name.toLowerCase().endsWith(`.${wanted}`));\n if (!match) {\n const close = data.suggest(part, parts.map((candidate) => candidate.name));\n return errorResult(\n parts.length === 0\n ? `${entry.name} has no parts. Call dbm_get_component with name='${entry.name}' for its props.`\n : `${entry.name} has no part '${part}'.${close.length ? ` Did you mean ${close.map((n) => `'${n}'`).join(\", \")}?` : \"\"} Its parts are: ${parts.map((candidate) => candidate.name).join(\", \")}.`,\n );\n }\n return jsonResult({ source, ...sourceNote(data), component: entry.name, part: match });\n }\n\n const core: Record<string, unknown> = Object.fromEntries(Object.entries(entry).filter(([key]) => !(SECTIONS as readonly string[]).includes(key)));\n const omitted: Array<{ section: string; characters: number; fetch: string }> = [];\n const fits = (candidate: Record<string, unknown>) => JSON.stringify({ source, component: candidate, omitted: [] }).length <= CHARACTER_LIMIT;\n let outlined = false;\n for (const section of SECTIONS.filter((s) => include.includes(s))) {\n const value = entry[section];\n if (value === undefined) continue;\n if (fits({ ...core, [section]: value })) {\n core[section] = value;\n } else if (section === \"parts\" && Array.isArray(entry.parts) && fits({ ...core, parts: entry.parts.map(({ name: partName, summary }) => ({ name: partName, summary })) })) {\n core.parts = entry.parts.map(({ name: partName, summary }) => ({ name: partName, summary }));\n outlined = true;\n omitted.push({ section: \"parts (props of each part)\", characters: JSON.stringify(value).length, fetch: `dbm_get_component with name='${entry.name}' and part set to one of the part names` });\n } else {\n omitted.push({ section, characters: JSON.stringify(value).length, fetch: `dbm_get_component with name='${entry.name}' and include=['${section}']` });\n }\n }\n return jsonResult({ source, component: core, ...(omitted.length ? { omitted } : {}), ...sourceNote(data, outlined ? \"parts lists each part's name and summary only.\" : undefined) });\n },\n );\n}\n","import type { CallToolResult } from \"@modelcontextprotocol/server\";\nimport * as z from \"zod/v4\";\nimport type { DbmData } from \"../data\";\n\n/** The most characters of text one result may carry. A page stays under it by holding fewer items, never by cutting text. */\nexport const CHARACTER_LIMIT = 25_000;\n\n/** Every tool reads files that ship in the packages and changes nothing, so a client may run them without asking. */\nexport const READ_ONLY = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false } as const;\n\n/** The `limit` and `offset` arguments every list tool takes. */\nexport const pagingInput = {\n limit: z.number().int().min(1).max(200).default(50).describe(\"The most items to return in one page.\"),\n offset: z.number().int().min(0).default(0).describe(\"How many items to skip, to read the next page. Use `next_offset` from the previous page.\"),\n};\n\n/** The fields that say where a page sits in the whole list. */\nexport const pageShape = {\n total: z.number().describe(\"How many items match in all.\"),\n count: z.number().describe(\"How many are in this page.\"),\n offset: z.number().describe(\"How many were skipped.\"),\n has_more: z.boolean().describe(\"Whether more items follow this page.\"),\n next_offset: z.number().optional().describe(\"The `offset` that reads the next page. Present only when `has_more` is true.\"),\n};\n\n/** Where the answer came from: the package, its version, and whether the project or this server supplied it. */\nexport const sourceShape = z.object({\n package: z.string(),\n version: z.string(),\n origin: z.enum([\"project\", \"bundled\"]).describe(\"`project` is the copy installed where the server was started; `bundled` is the copy this server depends on.\"),\n});\n\n/** The `note` field a result carries when its answers come from the bundled copy and not the project's (ADR-0232). */\nexport const noteShape = z.string().optional().describe(\"Present when the answers come from the copy bundled with the server and not from your project, or, for a search, when no result contained every word. It says why and what to do.\");\n\n/** `{ note }` when the data came from the bundled copy, and nothing otherwise, for spreading into a result. */\nexport function sourceNote(data: DbmData, ...more: Array<string | undefined>): { note?: string } {\n const note = [...more, data.note()].filter((entry): entry is string => Boolean(entry)).join(\" \");\n return note ? { note } : {};\n}\n\n/** A result carrying `data` as structured content and, as the protocol asks, the same data as JSON text. Compact, because an agent reads it. */\nexport function jsonResult(data: Record<string, unknown>): CallToolResult {\n return { content: [{ type: \"text\", text: JSON.stringify(data) }], structuredContent: data };\n}\n\n/** A result the model reads as an error, written to say what to try next. */\nexport function errorResult(message: string): CallToolResult {\n return { isError: true, content: [{ type: \"text\", text: message }] };\n}\n\n/**\n * Reads one page of `all` and returns the result for it. The page is halved until its text fits `CHARACTER_LIMIT`, so\n * `next_offset` points at the first item left out and nothing is cut mid-item.\n */\nexport function pagedResult<T>(all: readonly T[], offset: number, limit: number, build: (items: T[], page: Record<string, unknown>) => Record<string, unknown>): CallToolResult {\n let items = all.slice(offset, offset + limit);\n const render = (): Record<string, unknown> => {\n const next = offset + items.length;\n const has_more = next < all.length;\n return build(items, { total: all.length, count: items.length, offset, has_more, ...(has_more ? { next_offset: next } : {}) });\n };\n let data = render();\n while (items.length > 1 && JSON.stringify(data).length > CHARACTER_LIMIT) {\n items = items.slice(0, Math.ceil(items.length / 2));\n data = render();\n }\n return jsonResult(data);\n}\n","import type { McpServer } from \"@modelcontextprotocol/server\";\nimport * as z from \"zod/v4\";\nimport type { DbmData } from \"../data\";\nimport { READ_ONLY } from \"./shared\";\n\n/** Registers the tool that returns the consumer guide. */\nexport function registerGuideTool(server: McpServer, data: DbmData): void {\n server.registerTool(\n \"dbm_get_agent_guide\",\n {\n title: \"Get the DBM System guide for agents\",\n description: `Get the guide that ships with the components package for AI coding agents: how to install and set up the package, the conventions every component follows (sizes, field states, spacing, tokens), and where to look things up. Read it once at the start of a task that builds with DBM System. It returns Markdown.`,\n inputSchema: z.strictObject({}),\n annotations: READ_ONLY,\n },\n async () => ({ content: [{ type: \"text\", text: data.agentsGuide() }] }),\n );\n}\n","import type { McpServer } from \"@modelcontextprotocol/server\";\nimport * as z from \"zod/v4\";\nimport type { DbmData } from \"../data\";\nimport { noteShape, pageShape, pagedResult, pagingInput, READ_ONLY, sourceNote } from \"./shared\";\n\nconst KINDS = [\"component\", \"helper\", \"hook\", \"function\", \"constant\", \"token\"] as const;\n\ninterface Candidate {\n kind: (typeof KINDS)[number];\n name: string;\n summary: string;\n}\n\n/**\n * How well a candidate matches the query: the points its words earn, and how many of the words it lacks. A name match counts far\n * more than a summary match, and an exact or leading name match more still.\n */\nfunction score(candidate: Candidate, words: string[], phrase: string): { points: number; missing: number } {\n const name = candidate.name.toLowerCase();\n const summary = candidate.summary.toLowerCase();\n let points = 0;\n let missing = 0;\n for (const word of words) {\n if (name.includes(word)) points += 20;\n else if (summary.includes(word)) points += 3;\n else missing += 1;\n }\n if (points > 0 && name === phrase) points += 100;\n else if (points > 0 && name.startsWith(phrase)) points += 40;\n return { points, missing };\n}\n\n/** Registers the tool that searches across everything the server knows. */\nexport function registerSearchTool(server: McpServer, data: DbmData): void {\n server.registerTool(\n \"dbm_search\",\n {\n title: \"Search DBM System\",\n description: `Search components, helpers, hooks, functions, constants and design tokens by name and by what they do. Results that contain every word of the query come first, best match first. When nothing contains them all, the results that contain some of the words are returned, and \"note\" says so.\n\nUse it when you know what you need but not the name. Then call dbm_get_component, dbm_get_utility or dbm_get_tokens with the name it returns.\n\nExamples:\n - \"date range\" -> finds DateRangePicker\n - \"toast\" -> finds Toast, useToast, createToaster\n - \"focus ring\" -> finds the focus tokens`,\n inputSchema: z.strictObject({\n query: z.string().min(2).max(200).describe(\"Words to look for, such as 'date range' or 'toast'.\"),\n kinds: z.array(z.enum(KINDS)).optional().describe(\"Only these kinds of result. Leave out to search them all.\"),\n ...pagingInput,\n }),\n outputSchema: z.object({\n ...pageShape,\n note: noteShape,\n results: z.array(z.object({ kind: z.enum(KINDS), name: z.string(), summary: z.string() })),\n }),\n annotations: READ_ONLY,\n },\n async ({ query, kinds, limit, offset }) => {\n const index = data.index();\n const utilities = data.utilities();\n const candidates: Candidate[] = [\n ...index.components.map((row) => ({ kind: \"component\" as const, name: row.name, summary: row.summary })),\n ...index.helpers.map((row) => ({ kind: \"helper\" as const, name: row.name, summary: row.summary })),\n ...index.utilities.map((row) => ({ kind: row.kind === \"hook\" ? (\"hook\" as const) : (\"function\" as const), name: row.name, summary: row.summary })),\n ...utilities.constants.map((row) => ({ kind: \"constant\" as const, name: row.name, summary: typeof row.summary === \"string\" ? row.summary : \"\" })),\n ...data.tokens().tokens.map((token) => ({ kind: \"token\" as const, name: token.name, summary: token.purpose ?? `${token.layer} ${token.group} ${token.type} token` })),\n ];\n const phrase = query.trim().toLowerCase();\n const words = phrase.split(/\\s+/).filter(Boolean);\n const scored = candidates\n .filter((candidate) => !kinds || kinds.includes(candidate.kind))\n .map((candidate) => ({ candidate, ...score(candidate, words, phrase) }))\n .filter(({ points }) => points > 0);\n const rank = (a: (typeof scored)[number], b: (typeof scored)[number]) => b.points - a.points || a.candidate.name.localeCompare(b.candidate.name);\n const exact = scored.filter(({ missing }) => missing === 0).sort(rank);\n const partial = exact.length === 0 && words.length > 1;\n const results = (partial ? scored.sort((a, b) => a.missing - b.missing || rank(a, b)) : exact).map(({ candidate }) => candidate);\n return pagedResult(results, offset, limit, (items, page) => ({\n ...page,\n ...sourceNote(data, partial && results.length > 0 ? \"No result contains every word of the query, so these contain some of the words.\" : undefined),\n results: items,\n }));\n },\n );\n}\n","import type { McpServer } from \"@modelcontextprotocol/server\";\nimport * as z from \"zod/v4\";\nimport type { DbmData, TokenEntry } from \"../data\";\nimport { errorResult, noteShape, pageShape, pagedResult, pagingInput, READ_ONLY, sourceNote } from \"./shared\";\n\n/** One token as the tool returns it: the index's own fields, with the per-theme maps reduced to one value when a theme is asked for. */\nfunction forTheme(token: TokenEntry, theme: string | undefined): Record<string, unknown> {\n if (!theme) return { ...token };\n const { values, aliases, ...rest } = token;\n return { ...rest, ...(values ? { value: values[theme] } : {}), ...(aliases && aliases[theme] ? { alias: aliases[theme] } : {}) };\n}\n\n/** Registers the tool that looks up design tokens. */\nexport function registerTokenTools(server: McpServer, data: DbmData): void {\n server.registerTool(\n \"dbm_get_tokens\",\n {\n title: \"Look up DBM System design tokens\",\n description: `Look up design tokens: each one's CSS custom property name, layer, group, type, resolved value, the token it aliases, what it is for (when the source says) and which components use it. Components take their colors, spacing and so on from semantic tokens (layer \"semantic\", such as --dbm-bg-brand), never from primitives or hard-coded values, so find the right semantic token here.\n\nSemantic tokens have a value per theme (purple-light, purple-dark, emerald-light, emerald-dark); pass \"theme\" to get one value instead of all four. Filters combine.\n\nExamples:\n - \"What color is the brand background in dark mode?\" -> name_contains=\"bg-brand\", theme=\"purple-dark\"\n - \"Which tokens does Button use?\" -> used_by=\"Button\"\n - \"List the border tokens\" -> layer=\"semantic\", group=\"border\"`,\n inputSchema: z.strictObject({\n name_contains: z.string().min(1).max(100).optional().describe(\"Only tokens whose name contains this text, such as 'bg-brand' (without regard to case).\"),\n layer: z.enum([\"primitive\", \"semantic\", \"component\"]).optional().describe(\"Only tokens in this layer.\"),\n group: z.string().optional().describe(\"Only tokens in this group, such as 'bg', 'border', 'text', 'space' or 'button'.\"),\n used_by: z.string().optional().describe(\"Only tokens that this component's own stylesheet uses, such as 'Button'.\"),\n theme: z.string().optional().describe(\"Return one value for this theme instead of every theme's, such as 'purple-light'.\"),\n ...pagingInput,\n }),\n outputSchema: z.object({\n version: z.string().describe(\"The version of the tokens package.\"),\n origin: z.enum([\"project\", \"bundled\"]),\n themes: z.array(z.string()),\n note: noteShape,\n ...pageShape,\n tokens: z.array(z.record(z.string(), z.unknown())),\n }),\n annotations: READ_ONLY,\n },\n async ({ name_contains, layer, group, used_by, theme, limit, offset }) => {\n const index = data.tokens();\n if (theme && !index.themes.includes(theme)) {\n return errorResult(`No theme named '${theme}'. The themes are ${index.themes.map((t) => `'${t}'`).join(\", \")}.`);\n }\n const text = name_contains?.toLowerCase();\n const user = used_by?.toLowerCase();\n const matches = index.tokens.filter(\n (token) =>\n (!text || token.name.toLowerCase().includes(text)) &&\n (!layer || token.layer === layer) &&\n (!group || token.group === group) &&\n (!user || token.usedBy?.some((component) => component.toLowerCase() === user)),\n );\n const { tokens: info } = data.info();\n return pagedResult(matches, offset, limit, (tokens, page) => ({ version: info.version, origin: info.origin, themes: index.themes, ...sourceNote(data), ...page, tokens: tokens.map((token) => forTheme(token, theme)) }));\n },\n );\n}\n","import type { McpServer } from \"@modelcontextprotocol/server\";\nimport * as z from \"zod/v4\";\nimport type { DbmData } from \"../data\";\nimport { errorResult, jsonResult, noteShape, pageShape, pagedResult, pagingInput, READ_ONLY, sourceNote, sourceShape } from \"./shared\";\n\n/** Registers the tools that list and describe hooks, functions and constants. */\nexport function registerUtilityTools(server: McpServer, data: DbmData): void {\n const source = () => {\n const { components } = data.info();\n return { package: components.name, version: components.version, origin: components.origin };\n };\n\n server.registerTool(\n \"dbm_list_utilities\",\n {\n title: \"List DBM System hooks and functions\",\n description: `List the hooks and functions the components package exports besides its components (for example useToast, useTheme, createToaster, formatRelativeTime), one row each with a one-sentence summary. Use dbm_get_utility for the signature, parameters and examples of one.\n\nExample: \"Is there a hook for toasts?\" -> kind=\"hook\"`,\n inputSchema: z.strictObject({\n kind: z.enum([\"hook\", \"function\"]).optional().describe(\"Only hooks, or only functions.\"),\n ...pagingInput,\n }),\n outputSchema: z.object({\n source: sourceShape,\n note: noteShape,\n ...pageShape,\n utilities: z.array(z.object({ name: z.string(), kind: z.string(), summary: z.string() })),\n }),\n annotations: READ_ONLY,\n },\n async ({ kind, limit, offset }) => {\n const rows = data.index().utilities.filter((row) => !kind || row.kind === kind);\n return pagedResult(rows, offset, limit, (utilities, page) => ({ source: source(), ...sourceNote(data), ...page, utilities }));\n },\n );\n\n server.registerTool(\n \"dbm_get_utility\",\n {\n title: \"Get a DBM System hook, function or constant\",\n description: `Get one hook, function or constant in full: its signature, parameters, return type and examples, exactly as the package's manifest records it.\n\nExample: \"How do I call useToast?\" -> name=\"useToast\"\nUse dbm_list_utilities or dbm_search when you do not know the exact name.`,\n inputSchema: z.strictObject({\n name: z.string().min(1).max(100).describe(\"The hook, function or constant name, such as 'useToast'. Case does not matter.\"),\n }),\n annotations: READ_ONLY,\n },\n async ({ name }) => {\n const file = data.utilities();\n const wanted = name.toLowerCase();\n const found = [...file.utilities, ...file.constants].find((entry) => entry.name.toLowerCase() === wanted);\n if (!found) {\n const close = data.suggest(name, [...file.utilities, ...file.constants].map((entry) => entry.name));\n return errorResult(`No hook, function or constant named '${name}'.${close.length ? ` Did you mean ${close.map((n) => `'${n}'`).join(\", \")}?` : \"\"} Use dbm_list_utilities or dbm_search to find the name.`);\n }\n return jsonResult({ source: source(), ...sourceNote(data), utility: found });\n },\n );\n}\n"],"mappings":";;;AACA,SAAS,kBAAkB;;;ACD3B,SAAS,gBAAAA,qBAAoB;AAC7B,SAAS,QAAAC,aAAY;;;ACDrB,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,SAAS,YAAY;AAsBvB,IAAM,cAAN,cAA0B,MAAM;AAAC;AAExC,SAAS,WAAWC,UAAyB,WAAuC;AAClF,MAAI;AACF,WAAOA,SAAQ,QAAQ,SAAS;AAAA,EAClC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AASO,IAAM,gBAAwB,CAAC,MAAM,cAAc;AACxD,QAAM,aAAkE;AAAA,IACtE,GAAG,UAAU,IAAI,CAAC,QAA0C,CAAC,cAAc,KAAK,KAAK,mBAAmB,CAAC,GAAG,WAAW,GAAG,CAAC;AAAA,IAC3H,CAAC,cAAc,YAAY,GAAG,GAAG,WAAW,MAAS;AAAA,EACvD;AACA,aAAW,CAACA,UAAS,QAAQ,SAAS,KAAK,YAAY;AACrD,UAAM,eAA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AAC,GAAG,KAAK,WAAW,GAAG,KAAK,SAAS,EAAE,KAAK,CAAC,UAAU,MAAM,KAAK,YAAY,MAAM,MAAM;AACxG,UAAI,CAAC,OAAO;AACV,cAAM,QAAQA,MAAK,QAAQ,MAAM,CAAC,GAAG,KAAK,WAAW,GAAG,KAAK,SAAS,EAAE,IAAI,CAAC,UAAU,MAAM,IAAI,CAAC;AAClG,eAAO,YAAY,wCAAwC,IAAI,KAAK,MAAM,SAAS,iBAAiB,MAAM,IAAI,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,KAAK,IAAI,CAAC,MAAM,EAAE,yDAAyD;AAAA,MAC5M;AACA,aAAO,WAAW,EAAE,QAAQ,OAAO,GAAG,GAAG,WAAWA,KAAI,GAAG,SAAS,MAAM,CAAC;AAAA,IAC7E;AAAA,EACF;AACF;;;ANnDA,IAAM,EAAE,QAAQ,IAAI,KAAK,MAAMC,cAAa,IAAI,IAAI,mBAAmB,YAAY,GAAG,GAAG,MAAM,CAAC;AAMzF,SAAS,aAAaC,OAA0B;AACrD,QAAM,SAAS,IAAI,UAAU,EAAE,MAAM,kBAAkB,QAAQ,CAAC;AAChE,yBAAuB,QAAQA,KAAI;AACnC,uBAAqB,QAAQA,KAAI;AACjC,qBAAmB,QAAQA,KAAI;AAC/B,qBAAmB,QAAQA,KAAI;AAC/B,oBAAkB,QAAQA,KAAI;AAC9B,SAAO;AACT;;;AJjBA,IAAM,EAAE,SAAS,SAAS,IAAI,eAAe,QAAQ,KAAK,MAAM,CAAC,GAAG,QAAQ,KAAK,QAAQ,IAAI,CAAC;AAC9F,IAAM,OAAO,SAAS,SAAS,QAAQ;AACvC,WAAW,MAAM,aAAa,IAAI,CAAC;AACnC,QAAQ,MAAM,iCAAiC;","names":["readFileSync","join","require","version","readFileSync","warnings","folders","join","score","entry","warnings","readFileSync","z","data","data","z","data","z","data","z","data","z","data","readFileSync","data"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbm-system/mcp",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "A read-only MCP server, run over stdio, that answers an AI agent's questions about the DBM System components, hooks, functions and tokens from the files the packages ship.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -28,8 +28,8 @@
28
28
  "dependencies": {
29
29
  "@modelcontextprotocol/server": "^2.4.0",
30
30
  "zod": "^4.6.7",
31
- "@dbm-system/components": "0.2.1",
32
- "@dbm-system/tokens": "0.2.1"
31
+ "@dbm-system/components": "0.2.2",
32
+ "@dbm-system/tokens": "0.2.2"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@modelcontextprotocol/client": "^2.4.0",
@@ -38,8 +38,8 @@
38
38
  "tsup": "^8.5.1",
39
39
  "typescript": "5.9.3",
40
40
  "vitest": "^4.1.12",
41
- "@dbm-system/tsconfig": "0.0.0",
42
- "@dbm-system/eslint-config": "0.0.0"
41
+ "@dbm-system/eslint-config": "0.0.0",
42
+ "@dbm-system/tsconfig": "0.0.0"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "tsup",