@sebgroup/green-core 2.21.0-rc.20260112150926042 → 2.21.0-rc.20260113130744922
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/bin/mcp-server/resources.js +23 -0
- package/bin/mcp-server/tools.js +38 -0
- package/bin/mcp-server/types.d.ts +1 -0
- package/custom-elements.json +13324 -13333
- package/gds-element.js +1 -1
- package/generated/mcp/INSTRUCTIONS.md +64 -0
- package/generated/mcp/components.json +1 -1
- package/generated/mcp/icons.json +1 -1
- package/generated/mcp/index.json +2 -1
- package/generated/react/index.d.ts +8 -8
- package/generated/react/index.js +8 -8
- package/package.json +1 -1
- package/utils/helpers/custom-element-scoping.js +1 -1
|
@@ -61,6 +61,14 @@ function setupResourceHandlers(server) {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
if (globalIndex) {
|
|
64
|
+
if (globalIndex.instructions) {
|
|
65
|
+
resources.push({
|
|
66
|
+
uri: "green://instructions",
|
|
67
|
+
name: "Green Design System Instructions",
|
|
68
|
+
description: "General instructions and guidelines for agents using the Green Design System MCP",
|
|
69
|
+
mimeType: "text/markdown"
|
|
70
|
+
});
|
|
71
|
+
}
|
|
64
72
|
for (const guide of globalIndex.guides) {
|
|
65
73
|
const name = guide.path.replace(/^(guides|concepts)\//, "").replace(/\.md$/, "");
|
|
66
74
|
const category = guide.path.startsWith("guides/") ? "guides" : "concepts";
|
|
@@ -82,6 +90,21 @@ function setupResourceHandlers(server) {
|
|
|
82
90
|
server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
83
91
|
const { uri } = request.params;
|
|
84
92
|
try {
|
|
93
|
+
if (uri === "green://instructions") {
|
|
94
|
+
const content2 = await readMcpFile("INSTRUCTIONS.md");
|
|
95
|
+
if (!content2) {
|
|
96
|
+
throw new Error("Instructions file not found");
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
contents: [
|
|
100
|
+
{
|
|
101
|
+
uri,
|
|
102
|
+
mimeType: "text/markdown",
|
|
103
|
+
text: content2
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
};
|
|
107
|
+
}
|
|
85
108
|
const parsed = parseResourceUri(uri);
|
|
86
109
|
if (!parsed) {
|
|
87
110
|
throw new Error(`Invalid resource URI: ${uri}`);
|
package/bin/mcp-server/tools.js
CHANGED
|
@@ -106,6 +106,15 @@ function setupToolHandlers(server) {
|
|
|
106
106
|
},
|
|
107
107
|
required: ["name"]
|
|
108
108
|
}
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: "get_instructions",
|
|
112
|
+
description: "Get the base instructions for using the Green Design System MCP. These instructions contain critical rules, typography guidelines, layout system requirements, and general best practices that should be read before implementing any Green components.",
|
|
113
|
+
inputSchema: {
|
|
114
|
+
type: "object",
|
|
115
|
+
properties: {},
|
|
116
|
+
required: []
|
|
117
|
+
}
|
|
109
118
|
}
|
|
110
119
|
]
|
|
111
120
|
};
|
|
@@ -126,6 +135,8 @@ function setupToolHandlers(server) {
|
|
|
126
135
|
return await handleListGuides(args);
|
|
127
136
|
case "get_guide":
|
|
128
137
|
return await handleGetGuide(args);
|
|
138
|
+
case "get_instructions":
|
|
139
|
+
return await handleGetInstructions();
|
|
129
140
|
default:
|
|
130
141
|
throw new Error(`Unknown tool: ${name}`);
|
|
131
142
|
}
|
|
@@ -408,6 +419,33 @@ ${content}`
|
|
|
408
419
|
throw new Error(`Failed to get guide: ${error}`);
|
|
409
420
|
}
|
|
410
421
|
}
|
|
422
|
+
async function handleGetInstructions() {
|
|
423
|
+
try {
|
|
424
|
+
const globalIndex = await loadGlobalIndex();
|
|
425
|
+
if (!globalIndex) {
|
|
426
|
+
throw new Error("Failed to load global index");
|
|
427
|
+
}
|
|
428
|
+
if (!globalIndex.instructions) {
|
|
429
|
+
throw new Error(
|
|
430
|
+
"Instructions not available. The MCP may not have been generated with instructions support."
|
|
431
|
+
);
|
|
432
|
+
}
|
|
433
|
+
const content = await readMcpFile("INSTRUCTIONS.md");
|
|
434
|
+
if (!content) {
|
|
435
|
+
throw new Error("Instructions file not found");
|
|
436
|
+
}
|
|
437
|
+
return {
|
|
438
|
+
content: [
|
|
439
|
+
{
|
|
440
|
+
type: "text",
|
|
441
|
+
text: content
|
|
442
|
+
}
|
|
443
|
+
]
|
|
444
|
+
};
|
|
445
|
+
} catch (error) {
|
|
446
|
+
throw new Error(`Failed to get instructions: ${error}`);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
411
449
|
export {
|
|
412
450
|
setupToolHandlers
|
|
413
451
|
};
|