@adobe/spectrum-design-data-mcp 1.1.8 → 1.1.10
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/CHANGELOG.md +15 -1
- package/package.json +3 -3
- package/src/data/schemas.js +24 -53
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
# [**@adobe/spectrum-design-data-mcp**](https://github.com/adobe/spectrum-design-data-mcp)
|
|
2
2
|
|
|
3
|
+
## 1.1.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`c9002db`](https://github.com/adobe/spectrum-design-data/commit/c9002db2da1d1bb40446b4991648dc7809a55f33)]:
|
|
8
|
+
- @adobe/spectrum-component-api-schemas@6.1.0
|
|
9
|
+
|
|
10
|
+
## 1.1.9
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`c28702f`](https://github.com/adobe/spectrum-design-data/commit/c28702f19ad408d3dc1461bb059a1c7125f7d32f)]:
|
|
15
|
+
- @adobe/spectrum-tokens@14.7.0
|
|
16
|
+
|
|
3
17
|
## 1.1.8
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
6
20
|
|
|
7
|
-
- Updated dependencies [[`
|
|
21
|
+
- Updated dependencies [[`b11942c`](https://github.com/adobe/spectrum-design-data/commit/b11942cf52ec0077cfd53d8cb70ca722dc88c2e0)]:
|
|
8
22
|
- @adobe/spectrum-tokens@14.6.0
|
|
9
23
|
|
|
10
24
|
## 1.1.7
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/spectrum-design-data-mcp",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.10",
|
|
4
4
|
"description": "Model Context Protocol server for Spectrum design data including tokens, schemas, and component anatomy",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
50
50
|
"commander": "^13.1.0",
|
|
51
|
-
"@adobe/spectrum-tokens": "14.
|
|
52
|
-
"@adobe/spectrum-component-api-schemas": "6.
|
|
51
|
+
"@adobe/spectrum-tokens": "14.7.0",
|
|
52
|
+
"@adobe/spectrum-component-api-schemas": "6.1.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"ava": "^6.0.1"
|
package/src/data/schemas.js
CHANGED
|
@@ -10,7 +10,7 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { readFileSync, readdirSync
|
|
13
|
+
import { readFileSync, readdirSync } from "fs";
|
|
14
14
|
import { join, dirname } from "path";
|
|
15
15
|
import { fileURLToPath } from "url";
|
|
16
16
|
|
|
@@ -23,83 +23,54 @@ const __dirname = dirname(__filename);
|
|
|
23
23
|
*/
|
|
24
24
|
export async function getSchemaData() {
|
|
25
25
|
try {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
const { getAllSchemas } =
|
|
27
|
+
await import("@adobe/spectrum-component-api-schemas");
|
|
28
|
+
const schemas = await getAllSchemas();
|
|
29
|
+
const components = {};
|
|
30
|
+
for (const schema of schemas) {
|
|
31
|
+
if (schema.name) {
|
|
32
|
+
components[`${schema.name}.json`] = schema;
|
|
33
|
+
}
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
// Otherwise, read the schema files directly from the package
|
|
37
|
-
return await loadSchemaFilesDirectly();
|
|
35
|
+
return { components, types: {} };
|
|
38
36
|
} catch (error) {
|
|
39
37
|
console.error(
|
|
40
38
|
"Failed to load schema data from package, trying direct file access:",
|
|
41
39
|
error,
|
|
42
40
|
);
|
|
43
|
-
return
|
|
41
|
+
return loadSchemaFilesDirectly();
|
|
44
42
|
}
|
|
45
43
|
}
|
|
46
44
|
|
|
47
45
|
/**
|
|
48
|
-
* Load schema files directly from the repository structure
|
|
49
|
-
* @returns {
|
|
46
|
+
* Load schema files directly from the repository structure (fallback)
|
|
47
|
+
* @returns {Object} Schema data
|
|
50
48
|
*/
|
|
51
|
-
|
|
52
|
-
const schemaData = {
|
|
53
|
-
components: {},
|
|
54
|
-
types: {},
|
|
55
|
-
};
|
|
49
|
+
function loadSchemaFilesDirectly() {
|
|
50
|
+
const schemaData = { components: {}, types: {} };
|
|
56
51
|
|
|
57
|
-
|
|
58
|
-
const schemasPath = join(
|
|
52
|
+
const componentsPath = join(
|
|
59
53
|
__dirname,
|
|
60
|
-
"../../../../packages/
|
|
54
|
+
"../../../../packages/design-data-spec/components",
|
|
61
55
|
);
|
|
62
56
|
|
|
63
|
-
// Load component schemas
|
|
64
|
-
const componentsPath = join(schemasPath, "components");
|
|
65
57
|
try {
|
|
66
|
-
const componentFiles = readdirSync(componentsPath).filter((
|
|
67
|
-
|
|
58
|
+
const componentFiles = readdirSync(componentsPath).filter((f) =>
|
|
59
|
+
f.endsWith(".json"),
|
|
68
60
|
);
|
|
69
|
-
|
|
70
61
|
for (const fileName of componentFiles) {
|
|
71
62
|
try {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
} catch (
|
|
76
|
-
console.error(`Failed to load component schema ${fileName}:`,
|
|
63
|
+
schemaData.components[fileName] = JSON.parse(
|
|
64
|
+
readFileSync(join(componentsPath, fileName), "utf8"),
|
|
65
|
+
);
|
|
66
|
+
} catch (err) {
|
|
67
|
+
console.error(`Failed to load component schema ${fileName}:`, err);
|
|
77
68
|
}
|
|
78
69
|
}
|
|
79
70
|
} catch (error) {
|
|
80
71
|
console.error("Failed to read components directory:", error);
|
|
81
72
|
}
|
|
82
73
|
|
|
83
|
-
// Load type schemas
|
|
84
|
-
const typesPath = join(schemasPath, "types");
|
|
85
|
-
try {
|
|
86
|
-
const typeFiles = readdirSync(typesPath).filter((file) =>
|
|
87
|
-
file.endsWith(".json"),
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
for (const fileName of typeFiles) {
|
|
91
|
-
try {
|
|
92
|
-
const filePath = join(typesPath, fileName);
|
|
93
|
-
const fileContent = readFileSync(filePath, "utf8");
|
|
94
|
-
schemaData.types[fileName] = JSON.parse(fileContent);
|
|
95
|
-
} catch (error) {
|
|
96
|
-
console.error(`Failed to load type schema ${fileName}:`, error);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
} catch (error) {
|
|
100
|
-
console.error("Failed to read types directory:", error);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
74
|
return schemaData;
|
|
104
75
|
}
|
|
105
76
|
|