@dbm-system/mcp 0.0.0-stage → 0.2.1
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/LICENSE +21 -0
- package/README.md +51 -2
- package/dist/index.js +478 -0
- package/dist/index.js.map +1 -0
- package/package.json +47 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Designs by Mason
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,52 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @dbm-system/mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A read-only [Model Context Protocol](https://modelcontextprotocol.io) server for the DBM System. An AI coding agent starts it over stdio and asks about components, hooks, functions and design tokens, and gets answers read from the files the packages already ship: the component manifest, the token index and `AGENTS.md`.
|
|
4
|
+
|
|
5
|
+
It writes nothing, calls no network service and runs no project code.
|
|
6
|
+
|
|
7
|
+
It reads the copies of `@dbm-system/components` and `@dbm-system/tokens` installed in the folder it is started from, so the props an agent sees are those of the version the project has. When the project has neither installed, it falls back to the copies it depends on.
|
|
8
|
+
|
|
9
|
+
## Tools
|
|
10
|
+
|
|
11
|
+
All are read-only. Lists take `limit` and `offset` and say where the next page starts; a result never exceeds 25,000 characters, so a long list or a large component is returned in parts, with what was left out named.
|
|
12
|
+
|
|
13
|
+
| Tool | Answers |
|
|
14
|
+
|---|---|
|
|
15
|
+
| `dbm_list_components` | What components exist: name, tier, category and a one-sentence summary, filterable by tier and category |
|
|
16
|
+
| `dbm_get_component` | One component's manifest entry: props, parts and examples, or a single part |
|
|
17
|
+
| `dbm_list_utilities` | The hooks and functions the components package exports |
|
|
18
|
+
| `dbm_get_utility` | One hook, function or constant in full |
|
|
19
|
+
| `dbm_get_tokens` | Design tokens by name, layer, group or the component that uses them, with one theme's value on request |
|
|
20
|
+
| `dbm_search` | Components, hooks, functions, constants and tokens by name and by what they do |
|
|
21
|
+
| `dbm_get_agent_guide` | The consumer guide (`AGENTS.md`) that ships with the components package |
|
|
22
|
+
|
|
23
|
+
## Use it
|
|
24
|
+
|
|
25
|
+
Add it to an agent from the root of the project that uses DBM System, so it reads the versions that project has installed:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
claude mcp add dbm-system -- npx -y @dbm-system/mcp
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
or, for a client that takes a JSON configuration:
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"mcpServers": {
|
|
36
|
+
"dbm-system": { "command": "npx", "args": ["-y", "@dbm-system/mcp"] }
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
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`).
|
|
42
|
+
|
|
43
|
+
The repository's `packages/mcp/evaluation/` holds ten questions with verified answers for measuring how well an agent uses the tools.
|
|
44
|
+
|
|
45
|
+
## Links
|
|
46
|
+
|
|
47
|
+
- Documentation: https://dbm-system.com
|
|
48
|
+
- Issues: https://github.com/designsbymason/dbm-system/issues
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
MIT
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
5
|
+
|
|
6
|
+
// src/data.ts
|
|
7
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
8
|
+
import { join as join2 } from "path";
|
|
9
|
+
|
|
10
|
+
// src/sources.ts
|
|
11
|
+
import { readFileSync } from "fs";
|
|
12
|
+
import { createRequire } from "module";
|
|
13
|
+
import { dirname, join } from "path";
|
|
14
|
+
var SourceError = class extends Error {
|
|
15
|
+
};
|
|
16
|
+
function tryResolve(require2, specifier) {
|
|
17
|
+
try {
|
|
18
|
+
return require2.resolve(specifier);
|
|
19
|
+
} catch {
|
|
20
|
+
return void 0;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function locatePackage(name, startDir) {
|
|
24
|
+
const candidates = [
|
|
25
|
+
[createRequire(join(startDir, "dbm-system-mcp.js")), "project"],
|
|
26
|
+
[createRequire(import.meta.url), "bundled"]
|
|
27
|
+
];
|
|
28
|
+
for (const [require2, origin] of candidates) {
|
|
29
|
+
const manifestPath = tryResolve(require2, `${name}/package.json`);
|
|
30
|
+
if (!manifestPath) continue;
|
|
31
|
+
const { version: version2 } = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
32
|
+
return {
|
|
33
|
+
name,
|
|
34
|
+
version: version2,
|
|
35
|
+
root: dirname(manifestPath),
|
|
36
|
+
origin,
|
|
37
|
+
resolveExport(subpath) {
|
|
38
|
+
const resolved = tryResolve(require2, `${name}/${subpath}`);
|
|
39
|
+
if (!resolved) {
|
|
40
|
+
throw new SourceError(`${name}@${version2} has no ${subpath}. Update ${name} to a version that ships it.`);
|
|
41
|
+
}
|
|
42
|
+
return resolved;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
throw new SourceError(`${name} is not installed in ${startDir}. Install it there with \`npm install ${name}\`.`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// src/data.ts
|
|
50
|
+
var SUPPORTED_SCHEMA_VERSION = 1;
|
|
51
|
+
function readJson(path) {
|
|
52
|
+
return JSON.parse(readFileSync2(path, "utf8"));
|
|
53
|
+
}
|
|
54
|
+
function editDistance(a, b) {
|
|
55
|
+
const x = a.toLowerCase();
|
|
56
|
+
const y = b.toLowerCase();
|
|
57
|
+
let previous = Array.from({ length: y.length + 1 }, (_, index) => index);
|
|
58
|
+
for (let i = 1; i <= x.length; i += 1) {
|
|
59
|
+
const row = [i];
|
|
60
|
+
for (let j = 1; j <= y.length; j += 1) {
|
|
61
|
+
const cost = x[i - 1] === y[j - 1] ? 0 : 1;
|
|
62
|
+
row[j] = Math.min((previous[j] ?? 0) + 1, (row[j - 1] ?? 0) + 1, (previous[j - 1] ?? 0) + cost);
|
|
63
|
+
}
|
|
64
|
+
previous = row;
|
|
65
|
+
}
|
|
66
|
+
return previous[y.length] ?? 0;
|
|
67
|
+
}
|
|
68
|
+
function openData(startDir) {
|
|
69
|
+
const cache = /* @__PURE__ */ new Map();
|
|
70
|
+
const once = (key, load) => {
|
|
71
|
+
if (!cache.has(key)) cache.set(key, load());
|
|
72
|
+
return cache.get(key);
|
|
73
|
+
};
|
|
74
|
+
const components = () => once("components-package", () => locatePackage("@dbm-system/components", startDir));
|
|
75
|
+
const tokens = () => once("tokens-package", () => locatePackage("@dbm-system/tokens", startDir));
|
|
76
|
+
const index = () => once("index", () => {
|
|
77
|
+
const pkg = components();
|
|
78
|
+
const found = readJson(pkg.resolveExport("manifest/index.json"));
|
|
79
|
+
if (found.schemaVersion !== SUPPORTED_SCHEMA_VERSION) {
|
|
80
|
+
throw new SourceError(
|
|
81
|
+
`${pkg.name}@${pkg.version} has manifest schema version ${found.schemaVersion}, and this server reads version ${SUPPORTED_SCHEMA_VERSION}. Update @dbm-system/mcp.`
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
return found;
|
|
85
|
+
});
|
|
86
|
+
return {
|
|
87
|
+
info: () => ({
|
|
88
|
+
components: { name: components().name, version: components().version, origin: components().origin },
|
|
89
|
+
tokens: { name: tokens().name, version: tokens().version, origin: tokens().origin }
|
|
90
|
+
}),
|
|
91
|
+
index,
|
|
92
|
+
component(name) {
|
|
93
|
+
const wanted = name.toLowerCase();
|
|
94
|
+
const { components: rows, helpers } = index();
|
|
95
|
+
const row = [...rows, ...helpers].find((candidate) => candidate.name.toLowerCase() === wanted);
|
|
96
|
+
if (!row) return void 0;
|
|
97
|
+
const manifestFolder = join2(components().resolveExport("manifest/index.json"), "..");
|
|
98
|
+
return { row, entry: readJson(join2(manifestFolder, row.file)) };
|
|
99
|
+
},
|
|
100
|
+
utilities: () => once("utilities", () => {
|
|
101
|
+
const found = readJson(components().resolveExport("manifest/utilities.json"));
|
|
102
|
+
if (found.schemaVersion !== SUPPORTED_SCHEMA_VERSION) {
|
|
103
|
+
throw new SourceError(`The installed utilities file has schema version ${found.schemaVersion}, and this server reads version ${SUPPORTED_SCHEMA_VERSION}. Update @dbm-system/mcp.`);
|
|
104
|
+
}
|
|
105
|
+
return found;
|
|
106
|
+
}),
|
|
107
|
+
tokens: () => once("tokens", () => readJson(tokens().resolveExport("tokens.json"))),
|
|
108
|
+
agentsGuide: () => once("agents", () => readFileSync2(join2(components().root, "AGENTS.md"), "utf8")),
|
|
109
|
+
suggest(name, candidates, limit = 3) {
|
|
110
|
+
const wanted = name.toLowerCase();
|
|
111
|
+
return candidates.map((candidate) => ({
|
|
112
|
+
candidate,
|
|
113
|
+
score: candidate.toLowerCase().includes(wanted) || wanted.includes(candidate.toLowerCase()) ? 0 : editDistance(name, candidate)
|
|
114
|
+
})).filter(({ score: score2 }) => score2 <= Math.max(2, Math.floor(name.length / 3))).sort((a, b) => a.score - b.score || a.candidate.localeCompare(b.candidate)).slice(0, limit).map(({ candidate }) => candidate);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// src/server.ts
|
|
120
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
121
|
+
import { McpServer } from "@modelcontextprotocol/server";
|
|
122
|
+
|
|
123
|
+
// src/tools/components.ts
|
|
124
|
+
import * as z2 from "zod/v4";
|
|
125
|
+
|
|
126
|
+
// src/tools/shared.ts
|
|
127
|
+
import * as z from "zod/v4";
|
|
128
|
+
var CHARACTER_LIMIT = 25e3;
|
|
129
|
+
var READ_ONLY = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
130
|
+
var pagingInput = {
|
|
131
|
+
limit: z.number().int().min(1).max(200).default(50).describe("The most items to return in one page."),
|
|
132
|
+
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.")
|
|
133
|
+
};
|
|
134
|
+
var pageShape = {
|
|
135
|
+
total: z.number().describe("How many items match in all."),
|
|
136
|
+
count: z.number().describe("How many are in this page."),
|
|
137
|
+
offset: z.number().describe("How many were skipped."),
|
|
138
|
+
has_more: z.boolean().describe("Whether more items follow this page."),
|
|
139
|
+
next_offset: z.number().optional().describe("The `offset` that reads the next page. Present only when `has_more` is true.")
|
|
140
|
+
};
|
|
141
|
+
var sourceShape = z.object({
|
|
142
|
+
package: z.string(),
|
|
143
|
+
version: z.string(),
|
|
144
|
+
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
|
+
});
|
|
146
|
+
function jsonResult(data2) {
|
|
147
|
+
return { content: [{ type: "text", text: JSON.stringify(data2) }], structuredContent: data2 };
|
|
148
|
+
}
|
|
149
|
+
function errorResult(message) {
|
|
150
|
+
return { isError: true, content: [{ type: "text", text: message }] };
|
|
151
|
+
}
|
|
152
|
+
function pagedResult(all, offset, limit, build) {
|
|
153
|
+
let items = all.slice(offset, offset + limit);
|
|
154
|
+
const render = () => {
|
|
155
|
+
const next = offset + items.length;
|
|
156
|
+
const has_more = next < all.length;
|
|
157
|
+
return build(items, { total: all.length, count: items.length, offset, has_more, ...has_more ? { next_offset: next } : {} });
|
|
158
|
+
};
|
|
159
|
+
let data2 = render();
|
|
160
|
+
while (items.length > 1 && JSON.stringify(data2).length > CHARACTER_LIMIT) {
|
|
161
|
+
items = items.slice(0, Math.ceil(items.length / 2));
|
|
162
|
+
data2 = render();
|
|
163
|
+
}
|
|
164
|
+
return jsonResult(data2);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// src/tools/components.ts
|
|
168
|
+
function sourceOf(data2) {
|
|
169
|
+
const { components } = data2.info();
|
|
170
|
+
return { package: components.name, version: components.version, origin: components.origin };
|
|
171
|
+
}
|
|
172
|
+
var SECTIONS = ["props", "parts", "examples"];
|
|
173
|
+
function registerComponentTools(server, data2) {
|
|
174
|
+
server.registerTool(
|
|
175
|
+
"dbm_list_components",
|
|
176
|
+
{
|
|
177
|
+
title: "List DBM System components",
|
|
178
|
+
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.
|
|
179
|
+
|
|
180
|
+
Tiers 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.
|
|
181
|
+
|
|
182
|
+
Examples:
|
|
183
|
+
- "What form inputs are there?" -> category="Inputs"
|
|
184
|
+
- "List the page-level building blocks" -> tier="template"`,
|
|
185
|
+
inputSchema: z2.strictObject({
|
|
186
|
+
tier: z2.enum(["atom", "molecule", "organism", "template"]).optional().describe("Only components in this tier."),
|
|
187
|
+
category: z2.string().optional().describe("Only components in this category, such as 'Inputs', 'Navigation' or 'Overlay' (matched without regard to case)."),
|
|
188
|
+
include_helpers: z2.boolean().default(true).describe("Whether to include helpers. Helpers have no tier or category, so any tier or category filter leaves them out."),
|
|
189
|
+
...pagingInput
|
|
190
|
+
}),
|
|
191
|
+
outputSchema: z2.object({
|
|
192
|
+
source: sourceShape,
|
|
193
|
+
...pageShape,
|
|
194
|
+
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
|
+
}),
|
|
196
|
+
annotations: READ_ONLY
|
|
197
|
+
},
|
|
198
|
+
async ({ tier, category, include_helpers, limit, offset }) => {
|
|
199
|
+
const index = data2.index();
|
|
200
|
+
const rows = [
|
|
201
|
+
...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
|
+
...include_helpers && !tier && !category ? index.helpers.map((row) => ({ name: row.name, kind: "helper", helper_of: row.helperOf, summary: row.summary })) : []
|
|
203
|
+
];
|
|
204
|
+
return pagedResult(rows, offset, limit, (components, page) => ({ source: sourceOf(data2), ...page, components }));
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
server.registerTool(
|
|
208
|
+
"dbm_get_component",
|
|
209
|
+
{
|
|
210
|
+
title: "Get a DBM System component",
|
|
211
|
+
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.
|
|
212
|
+
|
|
213
|
+
A 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".
|
|
214
|
+
|
|
215
|
+
Examples:
|
|
216
|
+
- "What props does Button take?" -> name="Button"
|
|
217
|
+
- "How do I use Navbar.Link?" -> name="Navbar", part="Link"
|
|
218
|
+
- "Just the props of DataTable" -> name="DataTable", include=["props"]
|
|
219
|
+
Use dbm_list_components or dbm_search when you do not know the exact name.`,
|
|
220
|
+
inputSchema: z2.strictObject({
|
|
221
|
+
name: z2.string().min(1).max(100).describe("The component or helper name, such as 'Button' or 'TooltipProvider'. Case does not matter."),
|
|
222
|
+
include: z2.array(z2.enum(SECTIONS)).default([...SECTIONS]).describe("Which sections to include besides the summary fields: props, parts and examples."),
|
|
223
|
+
part: z2.string().min(1).max(100).optional().describe("Return only this part, such as 'Navbar.Link' or just 'Link'. Overrides include.")
|
|
224
|
+
}),
|
|
225
|
+
annotations: READ_ONLY
|
|
226
|
+
},
|
|
227
|
+
async ({ name, include, part }) => {
|
|
228
|
+
const found = data2.component(name);
|
|
229
|
+
if (!found) {
|
|
230
|
+
const names = [...data2.index().components, ...data2.index().helpers].map((row) => row.name);
|
|
231
|
+
const close = data2.suggest(name, names);
|
|
232
|
+
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.`);
|
|
233
|
+
}
|
|
234
|
+
const entry = found.entry;
|
|
235
|
+
const source = sourceOf(data2);
|
|
236
|
+
if (part) {
|
|
237
|
+
const wanted = part.toLowerCase();
|
|
238
|
+
const parts = entry.parts ?? [];
|
|
239
|
+
const match = parts.find((candidate) => candidate.name.toLowerCase() === wanted || candidate.name.toLowerCase().endsWith(`.${wanted}`));
|
|
240
|
+
if (!match) {
|
|
241
|
+
const close = data2.suggest(part, parts.map((candidate) => candidate.name));
|
|
242
|
+
return errorResult(
|
|
243
|
+
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
|
+
);
|
|
245
|
+
}
|
|
246
|
+
return jsonResult({ source, component: entry.name, part: match });
|
|
247
|
+
}
|
|
248
|
+
const core = Object.fromEntries(Object.entries(entry).filter(([key]) => !SECTIONS.includes(key)));
|
|
249
|
+
const omitted = [];
|
|
250
|
+
const fits = (candidate) => JSON.stringify({ source, component: candidate, omitted: [] }).length <= CHARACTER_LIMIT;
|
|
251
|
+
let outlined = false;
|
|
252
|
+
for (const section of SECTIONS.filter((s) => include.includes(s))) {
|
|
253
|
+
const value = entry[section];
|
|
254
|
+
if (value === void 0) continue;
|
|
255
|
+
if (fits({ ...core, [section]: value })) {
|
|
256
|
+
core[section] = value;
|
|
257
|
+
} else if (section === "parts" && Array.isArray(entry.parts) && fits({ ...core, parts: entry.parts.map(({ name: partName, summary }) => ({ name: partName, summary })) })) {
|
|
258
|
+
core.parts = entry.parts.map(({ name: partName, summary }) => ({ name: partName, summary }));
|
|
259
|
+
outlined = true;
|
|
260
|
+
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` });
|
|
261
|
+
} else {
|
|
262
|
+
omitted.push({ section, characters: JSON.stringify(value).length, fetch: `dbm_get_component with name='${entry.name}' and include=['${section}']` });
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return jsonResult({ source, component: core, ...omitted.length ? { omitted } : {}, ...outlined ? { note: "parts lists each part's name and summary only." } : {} });
|
|
266
|
+
}
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// src/tools/guide.ts
|
|
271
|
+
import * as z3 from "zod/v4";
|
|
272
|
+
function registerGuideTool(server, data2) {
|
|
273
|
+
server.registerTool(
|
|
274
|
+
"dbm_get_agent_guide",
|
|
275
|
+
{
|
|
276
|
+
title: "Get the DBM System guide for agents",
|
|
277
|
+
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.`,
|
|
278
|
+
inputSchema: z3.strictObject({}),
|
|
279
|
+
annotations: READ_ONLY
|
|
280
|
+
},
|
|
281
|
+
async () => ({ content: [{ type: "text", text: data2.agentsGuide() }] })
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// src/tools/search.ts
|
|
286
|
+
import * as z4 from "zod/v4";
|
|
287
|
+
var KINDS = ["component", "helper", "hook", "function", "constant", "token"];
|
|
288
|
+
function score(candidate, words, phrase) {
|
|
289
|
+
const name = candidate.name.toLowerCase();
|
|
290
|
+
const summary = candidate.summary.toLowerCase();
|
|
291
|
+
let points = 0;
|
|
292
|
+
let missing = 0;
|
|
293
|
+
for (const word of words) {
|
|
294
|
+
if (name.includes(word)) points += 20;
|
|
295
|
+
else if (summary.includes(word)) points += 3;
|
|
296
|
+
else missing += 1;
|
|
297
|
+
}
|
|
298
|
+
if (points > 0 && name === phrase) points += 100;
|
|
299
|
+
else if (points > 0 && name.startsWith(phrase)) points += 40;
|
|
300
|
+
return { points, missing };
|
|
301
|
+
}
|
|
302
|
+
function registerSearchTool(server, data2) {
|
|
303
|
+
server.registerTool(
|
|
304
|
+
"dbm_search",
|
|
305
|
+
{
|
|
306
|
+
title: "Search DBM System",
|
|
307
|
+
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.
|
|
308
|
+
|
|
309
|
+
Use 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.
|
|
310
|
+
|
|
311
|
+
Examples:
|
|
312
|
+
- "date range" -> finds DateRangePicker
|
|
313
|
+
- "toast" -> finds Toast, useToast, createToaster
|
|
314
|
+
- "focus ring" -> finds the focus tokens`,
|
|
315
|
+
inputSchema: z4.strictObject({
|
|
316
|
+
query: z4.string().min(2).max(200).describe("Words to look for, such as 'date range' or 'toast'."),
|
|
317
|
+
kinds: z4.array(z4.enum(KINDS)).optional().describe("Only these kinds of result. Leave out to search them all."),
|
|
318
|
+
...pagingInput
|
|
319
|
+
}),
|
|
320
|
+
outputSchema: z4.object({
|
|
321
|
+
...pageShape,
|
|
322
|
+
note: z4.string().optional().describe("Present when no result contained every word and the results hold only some of them."),
|
|
323
|
+
results: z4.array(z4.object({ kind: z4.enum(KINDS), name: z4.string(), summary: z4.string() }))
|
|
324
|
+
}),
|
|
325
|
+
annotations: READ_ONLY
|
|
326
|
+
},
|
|
327
|
+
async ({ query, kinds, limit, offset }) => {
|
|
328
|
+
const index = data2.index();
|
|
329
|
+
const utilities = data2.utilities();
|
|
330
|
+
const candidates = [
|
|
331
|
+
...index.components.map((row) => ({ kind: "component", name: row.name, summary: row.summary })),
|
|
332
|
+
...index.helpers.map((row) => ({ kind: "helper", name: row.name, summary: row.summary })),
|
|
333
|
+
...index.utilities.map((row) => ({ kind: row.kind === "hook" ? "hook" : "function", name: row.name, summary: row.summary })),
|
|
334
|
+
...utilities.constants.map((row) => ({ kind: "constant", name: row.name, summary: typeof row.summary === "string" ? row.summary : "" })),
|
|
335
|
+
...data2.tokens().tokens.map((token) => ({ kind: "token", name: token.name, summary: token.purpose ?? `${token.layer} ${token.group} ${token.type} token` }))
|
|
336
|
+
];
|
|
337
|
+
const phrase = query.trim().toLowerCase();
|
|
338
|
+
const words = phrase.split(/\s+/).filter(Boolean);
|
|
339
|
+
const scored = candidates.filter((candidate) => !kinds || kinds.includes(candidate.kind)).map((candidate) => ({ candidate, ...score(candidate, words, phrase) })).filter(({ points }) => points > 0);
|
|
340
|
+
const rank = (a, b) => b.points - a.points || a.candidate.name.localeCompare(b.candidate.name);
|
|
341
|
+
const exact = scored.filter(({ missing }) => missing === 0).sort(rank);
|
|
342
|
+
const partial = exact.length === 0 && words.length > 1;
|
|
343
|
+
const results = (partial ? scored.sort((a, b) => a.missing - b.missing || rank(a, b)) : exact).map(({ candidate }) => candidate);
|
|
344
|
+
return pagedResult(results, offset, limit, (items, page) => ({
|
|
345
|
+
...page,
|
|
346
|
+
...partial && results.length > 0 ? { note: "No result contains every word of the query, so these contain some of the words." } : {},
|
|
347
|
+
results: items
|
|
348
|
+
}));
|
|
349
|
+
}
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// src/tools/tokens.ts
|
|
354
|
+
import * as z5 from "zod/v4";
|
|
355
|
+
function forTheme(token, theme) {
|
|
356
|
+
if (!theme) return { ...token };
|
|
357
|
+
const { values, aliases, ...rest } = token;
|
|
358
|
+
return { ...rest, ...values ? { value: values[theme] } : {}, ...aliases && aliases[theme] ? { alias: aliases[theme] } : {} };
|
|
359
|
+
}
|
|
360
|
+
function registerTokenTools(server, data2) {
|
|
361
|
+
server.registerTool(
|
|
362
|
+
"dbm_get_tokens",
|
|
363
|
+
{
|
|
364
|
+
title: "Look up DBM System design tokens",
|
|
365
|
+
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.
|
|
366
|
+
|
|
367
|
+
Semantic 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.
|
|
368
|
+
|
|
369
|
+
Examples:
|
|
370
|
+
- "What color is the brand background in dark mode?" -> name_contains="bg-brand", theme="purple-dark"
|
|
371
|
+
- "Which tokens does Button use?" -> used_by="Button"
|
|
372
|
+
- "List the border tokens" -> layer="semantic", group="border"`,
|
|
373
|
+
inputSchema: z5.strictObject({
|
|
374
|
+
name_contains: z5.string().min(1).max(100).optional().describe("Only tokens whose name contains this text, such as 'bg-brand' (without regard to case)."),
|
|
375
|
+
layer: z5.enum(["primitive", "semantic", "component"]).optional().describe("Only tokens in this layer."),
|
|
376
|
+
group: z5.string().optional().describe("Only tokens in this group, such as 'bg', 'border', 'text', 'space' or 'button'."),
|
|
377
|
+
used_by: z5.string().optional().describe("Only tokens that this component's own stylesheet uses, such as 'Button'."),
|
|
378
|
+
theme: z5.string().optional().describe("Return one value for this theme instead of every theme's, such as 'purple-light'."),
|
|
379
|
+
...pagingInput
|
|
380
|
+
}),
|
|
381
|
+
outputSchema: z5.object({
|
|
382
|
+
version: z5.string().describe("The version of the tokens package."),
|
|
383
|
+
origin: z5.enum(["project", "bundled"]),
|
|
384
|
+
themes: z5.array(z5.string()),
|
|
385
|
+
...pageShape,
|
|
386
|
+
tokens: z5.array(z5.record(z5.string(), z5.unknown()))
|
|
387
|
+
}),
|
|
388
|
+
annotations: READ_ONLY
|
|
389
|
+
},
|
|
390
|
+
async ({ name_contains, layer, group, used_by, theme, limit, offset }) => {
|
|
391
|
+
const index = data2.tokens();
|
|
392
|
+
if (theme && !index.themes.includes(theme)) {
|
|
393
|
+
return errorResult(`No theme named '${theme}'. The themes are ${index.themes.map((t) => `'${t}'`).join(", ")}.`);
|
|
394
|
+
}
|
|
395
|
+
const text = name_contains?.toLowerCase();
|
|
396
|
+
const user = used_by?.toLowerCase();
|
|
397
|
+
const matches = index.tokens.filter(
|
|
398
|
+
(token) => (!text || token.name.toLowerCase().includes(text)) && (!layer || token.layer === layer) && (!group || token.group === group) && (!user || token.usedBy?.some((component) => component.toLowerCase() === user))
|
|
399
|
+
);
|
|
400
|
+
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)) }));
|
|
402
|
+
}
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
// src/tools/utilities.ts
|
|
407
|
+
import * as z6 from "zod/v4";
|
|
408
|
+
function registerUtilityTools(server, data2) {
|
|
409
|
+
const source = () => {
|
|
410
|
+
const { components } = data2.info();
|
|
411
|
+
return { package: components.name, version: components.version, origin: components.origin };
|
|
412
|
+
};
|
|
413
|
+
server.registerTool(
|
|
414
|
+
"dbm_list_utilities",
|
|
415
|
+
{
|
|
416
|
+
title: "List DBM System hooks and functions",
|
|
417
|
+
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.
|
|
418
|
+
|
|
419
|
+
Example: "Is there a hook for toasts?" -> kind="hook"`,
|
|
420
|
+
inputSchema: z6.strictObject({
|
|
421
|
+
kind: z6.enum(["hook", "function"]).optional().describe("Only hooks, or only functions."),
|
|
422
|
+
...pagingInput
|
|
423
|
+
}),
|
|
424
|
+
outputSchema: z6.object({
|
|
425
|
+
source: sourceShape,
|
|
426
|
+
...pageShape,
|
|
427
|
+
utilities: z6.array(z6.object({ name: z6.string(), kind: z6.string(), summary: z6.string() }))
|
|
428
|
+
}),
|
|
429
|
+
annotations: READ_ONLY
|
|
430
|
+
},
|
|
431
|
+
async ({ kind, limit, offset }) => {
|
|
432
|
+
const rows = data2.index().utilities.filter((row) => !kind || row.kind === kind);
|
|
433
|
+
return pagedResult(rows, offset, limit, (utilities, page) => ({ source: source(), ...page, utilities }));
|
|
434
|
+
}
|
|
435
|
+
);
|
|
436
|
+
server.registerTool(
|
|
437
|
+
"dbm_get_utility",
|
|
438
|
+
{
|
|
439
|
+
title: "Get a DBM System hook, function or constant",
|
|
440
|
+
description: `Get one hook, function or constant in full: its signature, parameters, return type and examples, exactly as the package's manifest records it.
|
|
441
|
+
|
|
442
|
+
Example: "How do I call useToast?" -> name="useToast"
|
|
443
|
+
Use dbm_list_utilities or dbm_search when you do not know the exact name.`,
|
|
444
|
+
inputSchema: z6.strictObject({
|
|
445
|
+
name: z6.string().min(1).max(100).describe("The hook, function or constant name, such as 'useToast'. Case does not matter.")
|
|
446
|
+
}),
|
|
447
|
+
annotations: READ_ONLY
|
|
448
|
+
},
|
|
449
|
+
async ({ name }) => {
|
|
450
|
+
const file = data2.utilities();
|
|
451
|
+
const wanted = name.toLowerCase();
|
|
452
|
+
const found = [...file.utilities, ...file.constants].find((entry) => entry.name.toLowerCase() === wanted);
|
|
453
|
+
if (!found) {
|
|
454
|
+
const close = data2.suggest(name, [...file.utilities, ...file.constants].map((entry) => entry.name));
|
|
455
|
+
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
|
+
}
|
|
457
|
+
return jsonResult({ source: source(), utility: found });
|
|
458
|
+
}
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// src/server.ts
|
|
463
|
+
var { version } = JSON.parse(readFileSync3(new URL("../package.json", import.meta.url), "utf8"));
|
|
464
|
+
function createServer(data2) {
|
|
465
|
+
const server = new McpServer({ name: "dbm-system-mcp", version });
|
|
466
|
+
registerComponentTools(server, data2);
|
|
467
|
+
registerUtilityTools(server, data2);
|
|
468
|
+
registerTokenTools(server, data2);
|
|
469
|
+
registerSearchTool(server, data2);
|
|
470
|
+
registerGuideTool(server, data2);
|
|
471
|
+
return server;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// src/index.ts
|
|
475
|
+
var data = openData(process.cwd());
|
|
476
|
+
serveStdio(() => createServer(data));
|
|
477
|
+
console.error("dbm-system-mcp running on stdio");
|
|
478
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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;AAC5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;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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dbm-system/mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.1",
|
|
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
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/designsbymason/dbm-system.git",
|
|
9
|
+
"directory": "packages/mcp"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://dbm-system.com",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/designsbymason/dbm-system/issues"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"bin": {
|
|
17
|
+
"dbm-system-mcp": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=24"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@modelcontextprotocol/server": "^2.4.0",
|
|
30
|
+
"zod": "^4.6.7",
|
|
31
|
+
"@dbm-system/components": "0.2.1",
|
|
32
|
+
"@dbm-system/tokens": "0.2.1"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@modelcontextprotocol/client": "^2.4.0",
|
|
36
|
+
"@types/node": "^24.13.3",
|
|
37
|
+
"eslint": "^10.14.0",
|
|
38
|
+
"tsup": "^8.5.1",
|
|
39
|
+
"typescript": "5.9.3",
|
|
40
|
+
"vitest": "^4.1.12",
|
|
41
|
+
"@dbm-system/tsconfig": "0.0.0",
|
|
42
|
+
"@dbm-system/eslint-config": "0.0.0"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsup",
|
|
46
|
+
"dev": "tsup --watch",
|
|
47
|
+
"lint": "eslint . && tsc --noEmit",
|
|
48
|
+
"test": "vitest run && node scripts/smoke.mjs"
|
|
49
|
+
}
|
|
6
50
|
}
|