@adobe/design-data-agent-mcp 1.9.14-beta.0 → 1.10.0-beta.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 +8 -5
- package/package.json +3 -3
- package/skills/design-data/SKILL.md +1 -1
- package/src/config.js +4 -0
- package/src/tools/read.js +78 -11
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `@adobe/design-data-agent-mcp`
|
|
2
2
|
|
|
3
|
-
MCP server and Claude Code skill for the [Spectrum Design Data](../../packages/design-data/) agent surface. Read tools (`primer`, `resolve_token`, `query_tokens`, `describe_component`) run fully in-process via `@adobe/design-data-wasm` — no CLI binary required for those. Only `authoring_session_step_intent` still invokes the native binary (for NLP suggest ranking, not yet on the wasm surface).
|
|
3
|
+
MCP server and Claude Code skill for the [Spectrum Design Data](../../packages/design-data/) agent surface. Read tools (`primer`, `resolve_token`, `query_tokens`, `describe_component`, `describe_guideline`) run fully in-process via `@adobe/design-data-wasm` — no CLI binary required for those. Only `authoring_session_step_intent` still invokes the native binary (for NLP suggest ranking, not yet on the wasm surface).
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -66,6 +66,7 @@ node tools/design-data-agent-mcp/src/index.js
|
|
|
66
66
|
| `DESIGN_DATA_ROOT` | — | Absolute root that relative paths are anchored to |
|
|
67
67
|
| `DESIGN_DATA_PATH` | `.` | Dataset root path |
|
|
68
68
|
| `DESIGN_DATA_COMPONENTS` | — | Override components directory |
|
|
69
|
+
| `DESIGN_DATA_GUIDELINES` | — | Override guidelines directory |
|
|
69
70
|
| `DESIGN_DATA_FIELDS` | — | Override fields directory |
|
|
70
71
|
| `DESIGN_DATA_SCHEMAS` | — | Override schema path (for `validate`) |
|
|
71
72
|
| `DESIGN_DATA_EXCEPTIONS` | — | Override exceptions path (for `validate`) |
|
|
@@ -77,8 +78,9 @@ node tools/design-data-agent-mcp/src/index.js
|
|
|
77
78
|
> source (path/npm/github/git) and any top-level `manifest` cascade, then
|
|
78
79
|
> materializes the result to a temp dir and points `primer` / `resolve_token` /
|
|
79
80
|
> `query_tokens` / `validate_usage` at it instead of the embedded Spectrum
|
|
80
|
-
> snapshot. `describe_component`
|
|
81
|
-
> `@adobe/spectrum-design-data` regardless of
|
|
81
|
+
> snapshot. `describe_component` / `describe_guideline` are unaffected — they always
|
|
82
|
+
> read components/guidelines from `@adobe/spectrum-design-data` regardless of
|
|
83
|
+
> cascade state. If resolution fails
|
|
82
84
|
> (e.g. no network for a github source), the server logs a warning and falls
|
|
83
85
|
> back to the embedded/local dataset rather than crashing.
|
|
84
86
|
|
|
@@ -100,8 +102,8 @@ node tools/design-data-agent-mcp/src/index.js
|
|
|
100
102
|
> is independent of the working directory.
|
|
101
103
|
> 3. **Fallback.** `dataPath` falls back to the (anchored) current directory; the
|
|
102
104
|
> component/field overrides fall back to `null` (not supplied), which means
|
|
103
|
-
> `describe_component` will throw an error if
|
|
104
|
-
> not resolvable.
|
|
105
|
+
> `describe_component` / `describe_guideline` will throw an error if
|
|
106
|
+
> `@adobe/spectrum-design-data` is not resolvable.
|
|
105
107
|
>
|
|
106
108
|
> In a monorepo checkout you typically need no `DESIGN_DATA_*` env vars at all —
|
|
107
109
|
> resolution via the workspace package handles it.
|
|
@@ -150,6 +152,7 @@ node tools/design-data-agent-mcp/src/index.js
|
|
|
150
152
|
| `resolve_token` | Resolve a token property to its literal value |
|
|
151
153
|
| `query_tokens` | Filter tokens by expression |
|
|
152
154
|
| `describe_component` | Fetch component schema and token bindings |
|
|
155
|
+
| `describe_guideline` | Fetch guideline documentBlocks content and metadata |
|
|
153
156
|
| `validate_usage` | Validate token usage and return a diagnostic report |
|
|
154
157
|
| `diff_datasets` | Compare two datasets and return a semantic diff |
|
|
155
158
|
| `write` | Write agent-generated product context to the dataset |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/design-data-agent-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0-beta.2",
|
|
4
4
|
"description": "MCP server and Claude Code skill for the design-data agent surface — read tools run in-process via wasm",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
33
|
-
"@adobe/design-data": "3.0.9",
|
|
34
33
|
"@adobe/design-data-wasm": "0.9.0",
|
|
35
|
-
"@adobe/
|
|
34
|
+
"@adobe/design-data": "3.1.0-beta.0",
|
|
35
|
+
"@adobe/spectrum-design-data": "3.3.0-beta.2"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"ava": "^6.0.1"
|
|
@@ -6,7 +6,7 @@ description: >
|
|
|
6
6
|
system, token lookup, spec-conformance, drift detection, or token authoring on custom data.
|
|
7
7
|
metadata:
|
|
8
8
|
author: adobe
|
|
9
|
-
version: "1.
|
|
9
|
+
version: "1.10.0-beta.2"
|
|
10
10
|
when_to_use: >
|
|
11
11
|
Trigger on: design system, design tokens, spec-conformant, drift, validate tokens, token
|
|
12
12
|
authoring, custom dataset, DESIGN_DATA_PATH, design-data validate, design-data diff,
|
package/src/config.js
CHANGED
|
@@ -74,6 +74,10 @@ export const config = {
|
|
|
74
74
|
anchorPath(process.env.DESIGN_DATA_RELATIONSHIPS) ??
|
|
75
75
|
resolveDataPackageDir("relationships") ??
|
|
76
76
|
null,
|
|
77
|
+
guidelinesDir:
|
|
78
|
+
anchorPath(process.env.DESIGN_DATA_GUIDELINES) ??
|
|
79
|
+
resolveDataPackageDir("guidelines") ??
|
|
80
|
+
null,
|
|
77
81
|
fieldsDir:
|
|
78
82
|
anchorPath(process.env.DESIGN_DATA_FIELDS) ??
|
|
79
83
|
resolveDataPackageDir("fields") ??
|
package/src/tools/read.js
CHANGED
|
@@ -13,6 +13,12 @@
|
|
|
13
13
|
*
|
|
14
14
|
* All read tools run fully in-process via @adobe/design-data-wasm — no CLI binary
|
|
15
15
|
* required. primer and describe_component were migrated in issue m1r.
|
|
16
|
+
* describe_guideline (spectrum-design-data-9fe.7) is the read-back counterpart to
|
|
17
|
+
* data_create/data_edit's "guidelines" category, closing the same read/write
|
|
18
|
+
* asymmetry describe_component already closes for components. Its guideline-loading
|
|
19
|
+
* logic (including the path-traversal guard) is shared with the sibling
|
|
20
|
+
* @adobe/design-data-mcp package's `design-data-guideline` tool via the
|
|
21
|
+
* `@adobe/design-data/guideline` module, rather than duplicated here.
|
|
16
22
|
*
|
|
17
23
|
* Note: authoring_session_step_intent in authoring.js still uses the CLI because
|
|
18
24
|
* the NLP suggest ranking is not yet on the wasm surface.
|
|
@@ -20,17 +26,19 @@
|
|
|
20
26
|
* Cascade scope (see cascade-bootstrap.js / spectrum-design-data-h890.14): once a
|
|
21
27
|
* `.design-data.toml` cascade is resolved, primer/resolve_token/query_tokens/
|
|
22
28
|
* validate_usage all reflect it (they read config.cascadeDataPath instead of
|
|
23
|
-
* config.dataPath when config.cascadeActive). describe_component
|
|
24
|
-
*
|
|
25
|
-
* config.relationshipsDir, which resolve from the embedded
|
|
26
|
-
* package regardless of cascade state. A platform source
|
|
27
|
-
* token cascade only, not its own component
|
|
28
|
-
* rather than guessed at; revisit if a platform
|
|
29
|
+
* config.dataPath when config.cascadeActive). describe_component/describe_guideline
|
|
30
|
+
* do not — components/relationships/guidelines still come from config.componentsDir /
|
|
31
|
+
* config.relationshipsDir / config.guidelinesDir, which resolve from the embedded
|
|
32
|
+
* @adobe/spectrum-design-data package regardless of cascade state. A platform source
|
|
33
|
+
* repo generally carries a token cascade only, not its own component/guideline
|
|
34
|
+
* schemas, so this is left out of scope rather than guessed at; revisit if a platform
|
|
35
|
+
* manifest starts declaring components or guidelines.
|
|
29
36
|
*/
|
|
30
37
|
|
|
31
38
|
import { readFileSync, existsSync, readdirSync } from "fs";
|
|
32
39
|
import { join } from "path";
|
|
33
40
|
import { loadDataset } from "@adobe/design-data/load";
|
|
41
|
+
import { loadGuideline } from "@adobe/design-data/guideline";
|
|
34
42
|
import { config } from "../config.js";
|
|
35
43
|
import { checkDatasetFreshness } from "../dataset-freshness.js";
|
|
36
44
|
|
|
@@ -71,19 +79,27 @@ async function getDataset() {
|
|
|
71
79
|
}
|
|
72
80
|
|
|
73
81
|
/**
|
|
74
|
-
* Validate a
|
|
82
|
+
* Validate a kebab-case ID against the same rule as the Rust SDK.
|
|
75
83
|
* See sdk/core/src/component.rs:validate_id — prevents path traversal.
|
|
76
84
|
*/
|
|
77
|
-
const
|
|
78
|
-
function
|
|
79
|
-
if (!
|
|
85
|
+
const KEBAB_ID_RE = /^[a-z][a-z0-9-]*$/;
|
|
86
|
+
function validateKebabId(id, kind) {
|
|
87
|
+
if (!KEBAB_ID_RE.test(id)) {
|
|
80
88
|
throw new Error(
|
|
81
|
-
`Invalid
|
|
89
|
+
`Invalid ${kind} ID "${id}". IDs must be kebab-case: start with a lowercase ` +
|
|
82
90
|
`letter and contain only lowercase letters, digits, and hyphens.`,
|
|
83
91
|
);
|
|
84
92
|
}
|
|
85
93
|
}
|
|
86
94
|
|
|
95
|
+
function validateComponentId(id) {
|
|
96
|
+
validateKebabId(id, "component");
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function validateGuidelineId(id) {
|
|
100
|
+
validateKebabId(id, "guideline");
|
|
101
|
+
}
|
|
102
|
+
|
|
87
103
|
export function createReadTools() {
|
|
88
104
|
return [
|
|
89
105
|
{
|
|
@@ -265,5 +281,56 @@ export function createReadTools() {
|
|
|
265
281
|
return component;
|
|
266
282
|
},
|
|
267
283
|
},
|
|
284
|
+
|
|
285
|
+
{
|
|
286
|
+
name: "describe_guideline",
|
|
287
|
+
description:
|
|
288
|
+
"Return the full documentBlocks content and metadata for a Spectrum design " +
|
|
289
|
+
"guideline by its slug ID — the read-back counterpart to data_create/data_edit " +
|
|
290
|
+
"for the guidelines category. Guideline IDs are kebab-case, e.g. colors, motion, " +
|
|
291
|
+
"typography-fundamentals.",
|
|
292
|
+
inputSchema: {
|
|
293
|
+
type: "object",
|
|
294
|
+
required: ["id"],
|
|
295
|
+
properties: {
|
|
296
|
+
id: {
|
|
297
|
+
type: "string",
|
|
298
|
+
description: "Guideline ID (kebab-case slug), e.g. colors, motion",
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
additionalProperties: false,
|
|
302
|
+
},
|
|
303
|
+
async handler({ id }) {
|
|
304
|
+
validateGuidelineId(id);
|
|
305
|
+
const guidelinesDir = config.guidelinesDir;
|
|
306
|
+
if (!guidelinesDir) {
|
|
307
|
+
throw new Error(
|
|
308
|
+
`@adobe/spectrum-design-data is not installed — cannot load guideline "${id}". ` +
|
|
309
|
+
`Install it with: pnpm add @adobe/spectrum-design-data`,
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
try {
|
|
313
|
+
return loadGuideline(guidelinesDir, id);
|
|
314
|
+
} catch (err) {
|
|
315
|
+
if (err.message.startsWith("Not found:")) {
|
|
316
|
+
let available;
|
|
317
|
+
try {
|
|
318
|
+
available = readdirSync(guidelinesDir)
|
|
319
|
+
.filter((f) => f.endsWith(".json") && f !== "manifest.json")
|
|
320
|
+
.map((f) => f.replace(/\.json$/, ""))
|
|
321
|
+
.sort()
|
|
322
|
+
.join(", ");
|
|
323
|
+
} catch {
|
|
324
|
+
available = null;
|
|
325
|
+
}
|
|
326
|
+
const hint = available
|
|
327
|
+
? `Available guidelines: ${available}`
|
|
328
|
+
: `Check packages/design-data/guidelines/manifest.json for available IDs.`;
|
|
329
|
+
throw new Error(`Guideline not found: "${id}". ${hint}`);
|
|
330
|
+
}
|
|
331
|
+
throw err;
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
},
|
|
268
335
|
];
|
|
269
336
|
}
|