@cobwds/mcp-server 1.19.4 → 1.23.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/README.md +6 -15
- package/data/cem/custom-elements.json +10058 -6738
- package/data/frameworks.json +14 -0
- package/data/guides/form-validation.md +1 -1
- package/data/guides/frameworks/angular.md +184 -26
- package/data/guides/frameworks/react-additions.md +69 -0
- package/data/guides/frameworks/react.md +209 -27
- package/data/guides/frameworks/vue.md +356 -0
- package/data/tokens/tokens.css +2 -2
- package/data/tokens/tokens.json +3 -3
- package/dist/lib/cem-parser.d.ts +12 -0
- package/dist/lib/cem-parser.d.ts.map +1 -1
- package/dist/lib/framework-snippets.d.ts +36 -0
- package/dist/lib/framework-snippets.d.ts.map +1 -0
- package/dist/lib/framework-snippets.js +55 -0
- package/dist/lib/framework-usage.d.ts +20 -0
- package/dist/lib/framework-usage.d.ts.map +1 -0
- package/dist/lib/framework-usage.js +50 -0
- package/dist/lib/frameworks-data.d.ts +19 -0
- package/dist/lib/frameworks-data.d.ts.map +1 -0
- package/dist/lib/frameworks-data.js +40 -0
- package/dist/resources/frameworks.d.ts +15 -0
- package/dist/resources/frameworks.d.ts.map +1 -0
- package/dist/resources/frameworks.js +104 -0
- package/dist/resources/guides.d.ts.map +1 -1
- package/dist/resources/guides.js +12 -1
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js +2 -0
- package/dist/tools/component-tools.d.ts.map +1 -1
- package/dist/tools/component-tools.js +20 -5
- package/dist/tools/guide-tools.js +1 -1
- package/dist/tools/utility-tools.d.ts +48 -0
- package/dist/tools/utility-tools.d.ts.map +1 -1
- package/dist/tools/utility-tools.js +236 -71
- package/package.json +6 -4
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework Resources
|
|
3
|
+
*
|
|
4
|
+
* MCP resources for COBWDS framework packages (@cobwds/react, @cobwds/vue,
|
|
5
|
+
* @cobwds/angular).
|
|
6
|
+
*
|
|
7
|
+
* Resources:
|
|
8
|
+
* - cobwds://frameworks - Index of framework packages with version and guide URI
|
|
9
|
+
* - cobwds://frameworks/react - @cobwds/react guide (synced from its README)
|
|
10
|
+
* - cobwds://frameworks/vue - @cobwds/vue guide (synced from its README)
|
|
11
|
+
* - cobwds://frameworks/angular - @cobwds/angular guide (synced from its README)
|
|
12
|
+
*/
|
|
13
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
14
|
+
export declare function registerFrameworkResources(server: McpServer): void;
|
|
15
|
+
//# sourceMappingURL=frameworks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frameworks.d.ts","sourceRoot":"","sources":["../../src/resources/frameworks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAezE,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAwGlE"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework Resources
|
|
3
|
+
*
|
|
4
|
+
* MCP resources for COBWDS framework packages (@cobwds/react, @cobwds/vue,
|
|
5
|
+
* @cobwds/angular).
|
|
6
|
+
*
|
|
7
|
+
* Resources:
|
|
8
|
+
* - cobwds://frameworks - Index of framework packages with version and guide URI
|
|
9
|
+
* - cobwds://frameworks/react - @cobwds/react guide (synced from its README)
|
|
10
|
+
* - cobwds://frameworks/vue - @cobwds/vue guide (synced from its README)
|
|
11
|
+
* - cobwds://frameworks/angular - @cobwds/angular guide (synced from its README)
|
|
12
|
+
*/
|
|
13
|
+
import { readFileSync } from "node:fs";
|
|
14
|
+
import { join, dirname } from "node:path";
|
|
15
|
+
import { fileURLToPath } from "node:url";
|
|
16
|
+
import { getFrameworksIndex } from "../lib/frameworks-data.js";
|
|
17
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
18
|
+
const __dirname = dirname(__filename);
|
|
19
|
+
const GUIDES_DIR = join(__dirname, "../../data/guides/frameworks");
|
|
20
|
+
function loadFrameworkGuide(framework) {
|
|
21
|
+
try {
|
|
22
|
+
return readFileSync(join(GUIDES_DIR, `${framework}.md`), "utf-8");
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return `Framework guide not found: ${framework}. Run "npm run sync:guides -w @cobwds/mcp-server".`;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export function registerFrameworkResources(server) {
|
|
29
|
+
// cobwds://frameworks - Index of framework packages
|
|
30
|
+
server.resource("frameworks", "cobwds://frameworks", {
|
|
31
|
+
description: "Index of COBWDS framework packages (@cobwds/react, @cobwds/vue, @cobwds/angular) with their published version and guide resource URI",
|
|
32
|
+
mimeType: "application/json",
|
|
33
|
+
}, async () => {
|
|
34
|
+
const index = getFrameworksIndex();
|
|
35
|
+
const list = [
|
|
36
|
+
{
|
|
37
|
+
id: "react",
|
|
38
|
+
packageName: index.react.packageName,
|
|
39
|
+
version: index.react.version,
|
|
40
|
+
guideUri: "cobwds://frameworks/react",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: "vue",
|
|
44
|
+
packageName: index.vue.packageName,
|
|
45
|
+
version: index.vue.version,
|
|
46
|
+
guideUri: "cobwds://frameworks/vue",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: "angular",
|
|
50
|
+
packageName: index.angular.packageName,
|
|
51
|
+
version: index.angular.version,
|
|
52
|
+
guideUri: "cobwds://frameworks/angular",
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
return {
|
|
56
|
+
contents: [
|
|
57
|
+
{
|
|
58
|
+
uri: "cobwds://frameworks",
|
|
59
|
+
mimeType: "application/json",
|
|
60
|
+
text: JSON.stringify(list, null, 2),
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
// cobwds://frameworks/react - @cobwds/react guide
|
|
66
|
+
server.resource("frameworks-react", "cobwds://frameworks/react", {
|
|
67
|
+
description: "@cobwds/react install, usage, forms, SSR, and troubleshooting guide",
|
|
68
|
+
mimeType: "text/markdown",
|
|
69
|
+
}, async () => ({
|
|
70
|
+
contents: [
|
|
71
|
+
{
|
|
72
|
+
uri: "cobwds://frameworks/react",
|
|
73
|
+
mimeType: "text/markdown",
|
|
74
|
+
text: loadFrameworkGuide("react"),
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
}));
|
|
78
|
+
// cobwds://frameworks/vue - @cobwds/vue guide
|
|
79
|
+
server.resource("frameworks-vue", "cobwds://frameworks/vue", {
|
|
80
|
+
description: "@cobwds/vue install, usage, v-model forms, SSR, and troubleshooting guide",
|
|
81
|
+
mimeType: "text/markdown",
|
|
82
|
+
}, async () => ({
|
|
83
|
+
contents: [
|
|
84
|
+
{
|
|
85
|
+
uri: "cobwds://frameworks/vue",
|
|
86
|
+
mimeType: "text/markdown",
|
|
87
|
+
text: loadFrameworkGuide("vue"),
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
}));
|
|
91
|
+
// cobwds://frameworks/angular - @cobwds/angular guide
|
|
92
|
+
server.resource("frameworks-angular", "cobwds://frameworks/angular", {
|
|
93
|
+
description: "@cobwds/angular install, usage, forms, SSR, and troubleshooting guide",
|
|
94
|
+
mimeType: "text/markdown",
|
|
95
|
+
}, async () => ({
|
|
96
|
+
contents: [
|
|
97
|
+
{
|
|
98
|
+
uri: "cobwds://frameworks/angular",
|
|
99
|
+
mimeType: "text/markdown",
|
|
100
|
+
text: loadFrameworkGuide("angular"),
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guides.d.ts","sourceRoot":"","sources":["../../src/resources/guides.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"guides.d.ts","sourceRoot":"","sources":["../../src/resources/guides.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAoF9D"}
|
package/dist/resources/guides.js
CHANGED
|
@@ -56,7 +56,18 @@ Then use them in HTML:
|
|
|
56
56
|
|
|
57
57
|
## Framework Integration
|
|
58
58
|
|
|
59
|
-
For framework-specific setup, use the \`get_guide\` tool with \`topic
|
|
59
|
+
For framework-specific setup, use the \`get_guide\` tool with a \`topic\` and a \`framework\` parameter (angular, react, vue, dotnet, drupal, or vanilla).
|
|
60
|
+
|
|
61
|
+
React, Vue, and Angular are first-class packages, not wrapper snippets:
|
|
62
|
+
\`@cobwds/react\` (\`npm install @cobwds/react\`), \`@cobwds/vue\`
|
|
63
|
+
(\`npm install @cobwds/vue\`), and \`@cobwds/angular\`
|
|
64
|
+
(\`npm install @cobwds/angular @cobwds/components\`) generate typed
|
|
65
|
+
components, props, and events directly from this design system's
|
|
66
|
+
manifest. See the \`cobwds://frameworks\` resource for their current
|
|
67
|
+
published versions, \`cobwds://frameworks/react\`, \`cobwds://frameworks/vue\`, and
|
|
68
|
+
\`cobwds://frameworks/angular\` for their full guides, and pass
|
|
69
|
+
\`framework: "react"\` or \`"angular"\` to \`get_component\` for
|
|
70
|
+
per-component import lines and framework-specific code examples.
|
|
60
71
|
|
|
61
72
|
## Resources
|
|
62
73
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMzE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAKzD"}
|
package/dist/resources/index.js
CHANGED
|
@@ -6,8 +6,10 @@
|
|
|
6
6
|
import { registerComponentResources } from "./components.js";
|
|
7
7
|
import { registerTokenResources } from "./tokens.js";
|
|
8
8
|
import { registerGuideResources } from "./guides.js";
|
|
9
|
+
import { registerFrameworkResources } from "./frameworks.js";
|
|
9
10
|
export function registerResources(server) {
|
|
10
11
|
registerComponentResources(server);
|
|
11
12
|
registerTokenResources(server);
|
|
12
13
|
registerGuideResources(server);
|
|
14
|
+
registerFrameworkResources(server);
|
|
13
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-tools.d.ts","sourceRoot":"","sources":["../../src/tools/component-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"component-tools.d.ts","sourceRoot":"","sources":["../../src/tools/component-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAYzE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA2I9D"}
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
import { z } from "zod";
|
|
11
11
|
import { getComponent, getAllComponents } from "../lib/cem-parser.js";
|
|
12
12
|
import { searchComponents } from "../lib/search.js";
|
|
13
|
+
import { buildExampleSnippets, } from "../lib/framework-snippets.js";
|
|
14
|
+
import { buildAngularUsageNotes, buildReactUsageNotes, } from "../lib/framework-usage.js";
|
|
13
15
|
export function registerComponentTools(server) {
|
|
14
16
|
// find_components - Search or list all components
|
|
15
17
|
server.tool("find_components", "Search for COBWDS components by name or description. Omit query to list all components.", {
|
|
@@ -51,15 +53,19 @@ export function registerComponentTools(server) {
|
|
|
51
53
|
};
|
|
52
54
|
});
|
|
53
55
|
// get_component - Full documentation for a specific component
|
|
54
|
-
server.tool("get_component", "Get full documentation for a specific COBWDS component including properties, events, slots, and CSS custom properties", {
|
|
56
|
+
server.tool("get_component", "Get full documentation for a specific COBWDS component including properties, events, slots, and CSS custom properties. Set framework to 'react' or 'angular' to get that framework's import line, event-prop naming, and forms guidance alongside HTML/React/Angular code examples.", {
|
|
55
57
|
tagName: z
|
|
56
58
|
.string()
|
|
57
59
|
.describe("The tag name of the component (e.g., 'cob-button')"),
|
|
58
60
|
includeExamples: z
|
|
59
61
|
.boolean()
|
|
60
62
|
.default(false)
|
|
61
|
-
.describe("Include
|
|
62
|
-
|
|
63
|
+
.describe("Include code examples from component JSDoc. Set to true when you need usage patterns. Each example carries html, react, and angular snippets."),
|
|
64
|
+
framework: z
|
|
65
|
+
.enum(["html", "react", "angular"])
|
|
66
|
+
.default("html")
|
|
67
|
+
.describe("Which framework to optimize the response for. 'html' (default) returns plain custom-element usage. 'react' and 'angular' add framework-specific usage notes (import line, event-prop naming, forms binding) and, for a form-control component, transform that framework's example snippets into its idiomatic controlled/reactive-forms pattern."),
|
|
68
|
+
}, async ({ tagName, includeExamples, framework }) => {
|
|
63
69
|
const component = getComponent(tagName);
|
|
64
70
|
if (!component) {
|
|
65
71
|
return {
|
|
@@ -76,16 +82,25 @@ export function registerComponentTools(server) {
|
|
|
76
82
|
// Attributes contains the HTML API, members duplicates this plus private methods
|
|
77
83
|
const {
|
|
78
84
|
// members: _members,
|
|
79
|
-
examples, ...componentWithoutMembers } = component;
|
|
85
|
+
examples, formControl, ...componentWithoutMembers } = component;
|
|
86
|
+
const usage = {};
|
|
87
|
+
if (framework === "react") {
|
|
88
|
+
usage.react = buildReactUsageNotes(tagName, component.name, formControl);
|
|
89
|
+
}
|
|
90
|
+
else if (framework === "angular") {
|
|
91
|
+
usage.angular = buildAngularUsageNotes(tagName, component.name, formControl);
|
|
92
|
+
}
|
|
80
93
|
return {
|
|
81
94
|
content: [
|
|
82
95
|
{
|
|
83
96
|
type: "text",
|
|
84
97
|
text: JSON.stringify({
|
|
85
98
|
...componentWithoutMembers,
|
|
99
|
+
formControl,
|
|
86
100
|
examples: includeExamples && examples && examples.length > 0
|
|
87
|
-
? examples
|
|
101
|
+
? buildExampleSnippets(examples, framework, formControl)
|
|
88
102
|
: undefined,
|
|
103
|
+
usage: Object.keys(usage).length > 0 ? usage : undefined,
|
|
89
104
|
resourceUri: `cobwds://component/${tagName}`,
|
|
90
105
|
}, null, 2),
|
|
91
106
|
},
|
|
@@ -56,7 +56,7 @@ export function registerGuideTools(server) {
|
|
|
56
56
|
])
|
|
57
57
|
.describe("The guide topic to retrieve"),
|
|
58
58
|
framework: z
|
|
59
|
-
.enum(["angular", "react", "dotnet", "drupal", "vanilla"])
|
|
59
|
+
.enum(["angular", "react", "vue", "dotnet", "drupal", "vanilla"])
|
|
60
60
|
.optional()
|
|
61
61
|
.describe("When provided, returns framework-specific setup guide instead of the topic guide. Use with topic 'installation' to get framework install instructions."),
|
|
62
62
|
}, async ({ topic, framework }) => {
|
|
@@ -2,7 +2,55 @@
|
|
|
2
2
|
* Utility Tools
|
|
3
3
|
*
|
|
4
4
|
* MCP tools for COBWDS utility classes.
|
|
5
|
+
*
|
|
6
|
+
* The class lists this tool returns are RENDERED from the scale constants
|
|
7
|
+
* below. Those constants mirror the Sass sources that actually generate the
|
|
8
|
+
* stylesheet:
|
|
9
|
+
*
|
|
10
|
+
* - packages/styles/src/utilities/_config.scss ($spacing, $opacity-values,
|
|
11
|
+
* $zindex-values, $display-values,
|
|
12
|
+
* $breakpoints, $flex-columns)
|
|
13
|
+
* - packages/styles/src/utilities/_layout-grid.scss ($responsive-gap-suffixes)
|
|
14
|
+
* - packages/styles/src/core/typography.scss ($body-sizes, $ui-sizes,
|
|
15
|
+
* $ui-underline-styles, $display-sizes)
|
|
16
|
+
*
|
|
17
|
+
* Do not hand-write a class name into the markdown. Add it to a scale and let
|
|
18
|
+
* the renderer emit it, so a name can never appear here without a scale entry
|
|
19
|
+
* behind it.
|
|
20
|
+
*
|
|
21
|
+
* `npm run verify:utility-docs` compiles the stylesheet and asserts that every
|
|
22
|
+
* class this tool names exists in it. Run it after touching any scale.
|
|
5
23
|
*/
|
|
6
24
|
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
25
|
+
declare const UTILITY_DOCS: {
|
|
26
|
+
grid: string;
|
|
27
|
+
flex: string;
|
|
28
|
+
spacing: string;
|
|
29
|
+
display: string;
|
|
30
|
+
opacity: string;
|
|
31
|
+
zindex: string;
|
|
32
|
+
typography: string;
|
|
33
|
+
responsive: string;
|
|
34
|
+
componentSpacing: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Classes the reference deliberately names in order to say they do NOT exist.
|
|
38
|
+
*
|
|
39
|
+
* These are the names people reach for out of habit from other frameworks.
|
|
40
|
+
* Saying so explicitly is more useful than silence, but it means the docs
|
|
41
|
+
* mention class names the stylesheet does not define, which would otherwise
|
|
42
|
+
* trip the verifier.
|
|
43
|
+
*
|
|
44
|
+
* `verify-utility-docs.mjs` asserts each of these is genuinely absent, so if
|
|
45
|
+
* COBWDS ever adds one, the stale warning fails the check instead of quietly
|
|
46
|
+
* misinforming people.
|
|
47
|
+
*/
|
|
48
|
+
declare const KNOWN_ABSENT: readonly string[];
|
|
49
|
+
/**
|
|
50
|
+
* Exported so `src/scripts/verify-utility-docs.mjs` can assert that every class
|
|
51
|
+
* named in this reference exists in the compiled stylesheet — and that every
|
|
52
|
+
* class named in KNOWN_ABSENT still does not.
|
|
53
|
+
*/
|
|
54
|
+
export { UTILITY_DOCS, KNOWN_ABSENT };
|
|
7
55
|
export declare function registerUtilityTools(server: McpServer): void;
|
|
8
56
|
//# sourceMappingURL=utility-tools.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utility-tools.d.ts","sourceRoot":"","sources":["../../src/tools/utility-tools.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"utility-tools.d.ts","sourceRoot":"","sources":["../../src/tools/utility-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAiLzE,QAAA,MAAM,YAAY;;;;;;;;;;CAyOjB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,YAAY,EAAE,SAAS,MAAM,EAUlC,CAAC;AAEF;;;;GAIG;AACH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC;AAEtC,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA8D5D"}
|