@wordpress/design-system-mcp 0.1.2-next.v.202604201441.0

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.
Files changed (46) hide show
  1. package/LICENSE.md +788 -0
  2. package/README.md +47 -0
  3. package/bin/design-system-mcp.mjs +9 -0
  4. package/build-module/data.mjs +61 -0
  5. package/build-module/data.mjs.map +7 -0
  6. package/build-module/format.mjs +60 -0
  7. package/build-module/format.mjs.map +7 -0
  8. package/build-module/index.mjs +15 -0
  9. package/build-module/index.mjs.map +7 -0
  10. package/build-module/parse-components.mjs +96 -0
  11. package/build-module/parse-components.mjs.map +7 -0
  12. package/build-module/tools/get-component-details.mjs +45 -0
  13. package/build-module/tools/get-component-details.mjs.map +7 -0
  14. package/build-module/tools/get-components.mjs +30 -0
  15. package/build-module/tools/get-components.mjs.map +7 -0
  16. package/build-module/tools/get-design-tokens.mjs +29 -0
  17. package/build-module/tools/get-design-tokens.mjs.map +7 -0
  18. package/build-module/tools/index.mjs +13 -0
  19. package/build-module/tools/index.mjs.map +7 -0
  20. package/build-module/types.mjs +1 -0
  21. package/build-module/types.mjs.map +7 -0
  22. package/build-types/data.d.ts +27 -0
  23. package/build-types/data.d.ts.map +1 -0
  24. package/build-types/format.d.ts +16 -0
  25. package/build-types/format.d.ts.map +1 -0
  26. package/build-types/index.d.ts +3 -0
  27. package/build-types/index.d.ts.map +1 -0
  28. package/build-types/parse-components.d.ts +55 -0
  29. package/build-types/parse-components.d.ts.map +1 -0
  30. package/build-types/test/data.d.ts +2 -0
  31. package/build-types/test/data.d.ts.map +1 -0
  32. package/build-types/test/format.d.ts +2 -0
  33. package/build-types/test/format.d.ts.map +1 -0
  34. package/build-types/test/parse-components.d.ts +2 -0
  35. package/build-types/test/parse-components.d.ts.map +1 -0
  36. package/build-types/tools/get-component-details.d.ts +8 -0
  37. package/build-types/tools/get-component-details.d.ts.map +1 -0
  38. package/build-types/tools/get-components.d.ts +8 -0
  39. package/build-types/tools/get-components.d.ts.map +1 -0
  40. package/build-types/tools/get-design-tokens.d.ts +8 -0
  41. package/build-types/tools/get-design-tokens.d.ts.map +1 -0
  42. package/build-types/tools/index.d.ts +8 -0
  43. package/build-types/tools/index.d.ts.map +1 -0
  44. package/build-types/types.d.ts +51 -0
  45. package/build-types/types.d.ts.map +1 -0
  46. package/package.json +55 -0
@@ -0,0 +1,55 @@
1
+ import type { Component, ComponentDetail, ComponentProp, ManifestComponent } from './types';
2
+ /**
3
+ * Derive the npm package name from the story file path.
4
+ *
5
+ * Manifest paths look like `../packages/<dir>/src/.../index.story.tsx`. We
6
+ * extract `<dir>` and prepend the `@wordpress/` npm namespace. Curation of
7
+ * which components appear in the manifest is handled upstream via Storybook
8
+ * tags, so this only needs to recognize package-shaped paths.
9
+ *
10
+ * @param storyPath - The story file path from the manifest.
11
+ * @return The npm package name, or null for paths outside `packages/*`.
12
+ */
13
+ export declare function packageNameFromPath(storyPath: string): string | null;
14
+ /**
15
+ * Parse props from a component's reactDocgen data, filtering out
16
+ * deprecated and ignored props.
17
+ *
18
+ * @param rawProps - The reactDocgen props record.
19
+ * @return Parsed props with deprecated entries removed.
20
+ */
21
+ export declare function parseProps(rawProps: Record<string, {
22
+ required?: boolean;
23
+ tsType?: {
24
+ name: string;
25
+ raw?: string;
26
+ };
27
+ description?: string;
28
+ defaultValue?: {
29
+ value: string;
30
+ };
31
+ }>): ComponentProp[];
32
+ /**
33
+ * Parse manifest components into a flat list sorted alphabetically by name.
34
+ * When a component is defined across multiple story files (e.g. a companion
35
+ * file documenting a specific aspect), it is collapsed to a single entry keyed
36
+ * by its canonical name and package.
37
+ *
38
+ * @param components - The manifest components record.
39
+ * @return Flat list of components derived from the manifest.
40
+ */
41
+ export declare function parseComponents(components: Record<string, ManifestComponent>): Component[];
42
+ /**
43
+ * Find a single component by name (case-insensitive) and return its full
44
+ * detail including props and stories. When a component is spread across
45
+ * multiple story files, stories from every contributing file are collected
46
+ * in manifest order. Descriptions and props are also authored on the component
47
+ * itself, so in principle they should be identical across story files; in
48
+ * practice one file may omit them, so we prefer any non-empty value found.
49
+ *
50
+ * @param components - The manifest components record.
51
+ * @param name - The component name to look up.
52
+ * @return The component detail, or null if not found.
53
+ */
54
+ export declare function parseComponentDetail(components: Record<string, ManifestComponent>, name: string): ComponentDetail | null;
55
+ //# sourceMappingURL=parse-components.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-components.d.ts","sourceRoot":"","sources":["../src/parse-components.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,SAAS,EACT,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,MAAM,SAAS,CAAC;AAuCjB;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAE,SAAS,EAAE,MAAM,GAAI,MAAM,GAAG,IAAI,CAGtE;AAiBD;;;;;;GAMG;AACH,wBAAgB,UAAU,CACzB,QAAQ,EAAE,MAAM,CACf,MAAM,EACN;IACC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACjC,CACD,GACC,aAAa,EAAE,CAmBjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC9B,UAAU,EAAE,MAAM,CAAE,MAAM,EAAE,iBAAiB,CAAE,GAC7C,SAAS,EAAE,CA0Bb;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CACnC,UAAU,EAAE,MAAM,CAAE,MAAM,EAAE,iBAAiB,CAAE,EAC/C,IAAI,EAAE,MAAM,GACV,eAAe,GAAG,IAAI,CAqCxB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/test/data.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/test/format.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=parse-components.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-components.d.ts","sourceRoot":"","sources":["../../src/test/parse-components.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import type { McpServer } from '@modelcontextprotocol/server';
2
+ /**
3
+ * Register the get_component_details tool.
4
+ *
5
+ * @param server - The MCP server instance.
6
+ */
7
+ export declare function register(server: McpServer): void;
8
+ //# sourceMappingURL=get-component-details.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-component-details.d.ts","sourceRoot":"","sources":["../../src/tools/get-component-details.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAK9D;;;;GAIG;AACH,wBAAgB,QAAQ,CAAE,MAAM,EAAE,SAAS,GAAI,IAAI,CAwClD"}
@@ -0,0 +1,8 @@
1
+ import type { McpServer } from '@modelcontextprotocol/server';
2
+ /**
3
+ * Register the get_components tool.
4
+ *
5
+ * @param server - The MCP server instance.
6
+ */
7
+ export declare function register(server: McpServer): void;
8
+ //# sourceMappingURL=get-components.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-components.d.ts","sourceRoot":"","sources":["../../src/tools/get-components.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAI9D;;;;GAIG;AACH,wBAAgB,QAAQ,CAAE,MAAM,EAAE,SAAS,GAAI,IAAI,CAuBlD"}
@@ -0,0 +1,8 @@
1
+ import type { McpServer } from '@modelcontextprotocol/server';
2
+ /**
3
+ * Register the get_design_tokens tool.
4
+ *
5
+ * @param server - The MCP server instance.
6
+ */
7
+ export declare function register(server: McpServer): void;
8
+ //# sourceMappingURL=get-design-tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-design-tokens.d.ts","sourceRoot":"","sources":["../../src/tools/get-design-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAG9D;;;;GAIG;AACH,wBAAgB,QAAQ,CAAE,MAAM,EAAE,SAAS,GAAI,IAAI,CAuBlD"}
@@ -0,0 +1,8 @@
1
+ import type { McpServer } from '@modelcontextprotocol/server';
2
+ /**
3
+ * Register all MCP tools on the server.
4
+ *
5
+ * @param server - The MCP server instance.
6
+ */
7
+ export declare function registerTools(server: McpServer): void;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAK9D;;;;GAIG;AACH,wBAAgB,aAAa,CAAE,MAAM,EAAE,SAAS,GAAI,IAAI,CAIvD"}
@@ -0,0 +1,51 @@
1
+ export interface ManifestComponent {
2
+ id: string;
3
+ name: string;
4
+ path: string;
5
+ description?: string;
6
+ stories?: Array<{
7
+ name: string;
8
+ snippet?: string;
9
+ description?: string;
10
+ }>;
11
+ reactDocgen?: {
12
+ description?: string;
13
+ displayName?: string;
14
+ props?: Record<string, {
15
+ required?: boolean;
16
+ tsType?: {
17
+ name: string;
18
+ raw?: string;
19
+ };
20
+ description?: string;
21
+ defaultValue?: {
22
+ value: string;
23
+ };
24
+ }>;
25
+ };
26
+ }
27
+ export interface Component {
28
+ name: string;
29
+ description: string;
30
+ packageName: string;
31
+ }
32
+ export interface ComponentProp {
33
+ name: string;
34
+ type: string;
35
+ required: boolean;
36
+ description: string;
37
+ defaultValue: string | null;
38
+ }
39
+ export interface ComponentDetail {
40
+ name: string;
41
+ description: string;
42
+ packageName: string;
43
+ importStatement: string | null;
44
+ props: ComponentProp[];
45
+ stories: Array<{
46
+ name: string;
47
+ snippet?: string;
48
+ description?: string;
49
+ }>;
50
+ }
51
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,KAAK,CAAE;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;KACrB,CAAE,CAAC;IACJ,WAAW,CAAC,EAAE;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,KAAK,CAAC,EAAE,MAAM,CACb,MAAM,EACN;YACC,QAAQ,CAAC,EAAE,OAAO,CAAC;YACnB,MAAM,CAAC,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAC;gBAAC,GAAG,CAAC,EAAE,MAAM,CAAA;aAAE,CAAC;YACxC,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,YAAY,CAAC,EAAE;gBAAE,KAAK,EAAE,MAAM,CAAA;aAAE,CAAC;SACjC,CACD,CAAC;KACF,CAAC;CACF;AAED,MAAM,WAAW,SAAS;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,OAAO,EAAE,KAAK,CAAE;QACf,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;KACrB,CAAE,CAAC;CACJ"}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@wordpress/design-system-mcp",
3
+ "version": "0.1.2-next.v.202604201441.0+dab6d8c07",
4
+ "description": "MCP server for the WordPress Design System.",
5
+ "author": "The WordPress Contributors",
6
+ "license": "GPL-2.0-or-later",
7
+ "keywords": [
8
+ "wordpress",
9
+ "gutenberg",
10
+ "design-system",
11
+ "mcp"
12
+ ],
13
+ "homepage": "https://github.com/WordPress/gutenberg/tree/HEAD/packages/design-system-mcp/README.md",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/WordPress/gutenberg.git",
17
+ "directory": "packages/design-system-mcp"
18
+ },
19
+ "bugs": {
20
+ "url": "https://github.com/WordPress/gutenberg/issues"
21
+ },
22
+ "engines": {
23
+ "node": ">=20.10.0",
24
+ "npm": ">=10.2.3"
25
+ },
26
+ "files": [
27
+ "bin",
28
+ "build-module",
29
+ "build-types"
30
+ ],
31
+ "type": "module",
32
+ "module": "build-module/index.mjs",
33
+ "exports": {
34
+ ".": {
35
+ "types": "./build-types/index.d.ts",
36
+ "import": "./build-module/index.mjs"
37
+ },
38
+ "./package.json": "./package.json"
39
+ },
40
+ "bin": {
41
+ "design-system-mcp": "./bin/design-system-mcp.mjs"
42
+ },
43
+ "dependencies": {
44
+ "@cfworker/json-schema": "4.1.1",
45
+ "@modelcontextprotocol/server": "2.0.0-alpha.2",
46
+ "zod": "4.3.6"
47
+ },
48
+ "devDependencies": {
49
+ "@types/jest": "^29.5.14"
50
+ },
51
+ "publishConfig": {
52
+ "access": "public"
53
+ },
54
+ "gitHead": "c788005ba4ee2a34851c1217c51602656aa7c3a6"
55
+ }