@wordpress/design-system-mcp 0.10.0 → 0.11.2-next.v.202608281122.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.
package/README.md CHANGED
@@ -6,6 +6,8 @@ This package is still experimental. “Experimental” means this is an early im
6
6
 
7
7
  An [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) server for the WordPress Design System. Provides AI agents with component documentation, usage examples, and design tokens.
8
8
 
9
+ TypeScript consumers that import this package require TypeScript 5 or newer.
10
+
9
11
  By using the MCP server, you can be confident that your AI agents are correctly following the latest design system guidance when asking questions like:
10
12
 
11
13
  - Which components should be used for a given interaction or user interface, like a button or a dropdown
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/data.ts"],
4
- "sourcesContent": ["import {\n\tpackageNameFromPath,\n\tparseComponents,\n\tparseComponentDetail,\n} from './parse-components';\nimport type { Component, ComponentDetail, ManifestComponent } from './types';\n\nconst COMPONENTS_MANIFEST_URL =\n\tprocess.env.COMPONENTS_MANIFEST_URL ||\n\t'https://wordpress.github.io/gutenberg/manifests/components.json';\n\nconst DESIGN_TOKENS_URL =\n\tprocess.env.DESIGN_TOKENS_URL ||\n\t'https://raw.githubusercontent.com/WordPress/gutenberg/refs/heads/trunk/packages/theme/docs/tokens.md';\n\nlet cachedComponents: Record< string, ManifestComponent > | null = null;\nlet cachedTokens: string | null = null;\n\n/**\n * Clear cached data. Intended for testing.\n */\nexport function resetCache(): void {\n\tcachedComponents = null;\n\tcachedTokens = null;\n}\n\n/**\n * Fetch and cache the components from the Storybook manifest, filtered to only\n * components from allowed packages.\n *\n * @return The filtered components record.\n */\nasync function fetchComponents(): Promise<\n\tRecord< string, ManifestComponent >\n> {\n\tif ( cachedComponents ) {\n\t\treturn cachedComponents;\n\t}\n\n\tconst response = await fetch( COMPONENTS_MANIFEST_URL );\n\tif ( ! response.ok ) {\n\t\tthrow new Error(\n\t\t\t`Failed to fetch components manifest: ${ response.status } ${ response.statusText }`\n\t\t);\n\t}\n\n\tconst manifest: {\n\t\tv: number;\n\t\tcomponents: Record< string, ManifestComponent >;\n\t} = await response.json();\n\n\tconst filtered: Record< string, ManifestComponent > = {};\n\tfor ( const [ key, component ] of Object.entries( manifest.components ) ) {\n\t\tif ( packageNameFromPath( component.path ) ) {\n\t\t\tfiltered[ key ] = component;\n\t\t}\n\t}\n\n\tcachedComponents = filtered;\n\treturn cachedComponents;\n}\n\n/**\n * Get all components from allowed packages.\n *\n * @return Parsed component list.\n */\nexport async function getComponents(): Promise< Component[] > {\n\tconst components = await fetchComponents();\n\treturn parseComponents( components );\n}\n\n/**\n * Get detailed documentation for a single component by name.\n *\n * @param name - The component name (case-insensitive).\n * @return The component detail, or null if not found.\n */\nexport async function getComponentDetail(\n\tname: string\n): Promise< ComponentDetail | null > {\n\tconst components = await fetchComponents();\n\treturn parseComponentDetail( components, name );\n}\n\n/**\n * Get the design tokens reference document as markdown.\n *\n * @return The tokens markdown content.\n */\nexport async function getDesignTokens(): Promise< { content: string } > {\n\tif ( ! cachedTokens ) {\n\t\tconst response = await fetch( DESIGN_TOKENS_URL );\n\t\tif ( ! response.ok ) {\n\t\t\tthrow new Error(\n\t\t\t\t`Failed to fetch design tokens: ${ response.status } ${ response.statusText }`\n\t\t\t);\n\t\t}\n\n\t\tcachedTokens = await response.text();\n\t}\n\n\treturn { content: cachedTokens };\n}\n"],
4
+ "sourcesContent": ["import {\n\tpackageNameFromPath,\n\tparseComponents,\n\tparseComponentDetail,\n} from './parse-components.ts';\nimport type { Component, ComponentDetail, ManifestComponent } from './types.ts';\n\nconst COMPONENTS_MANIFEST_URL =\n\tprocess.env.COMPONENTS_MANIFEST_URL ||\n\t'https://wordpress.github.io/gutenberg/manifests/components.json';\n\nconst DESIGN_TOKENS_URL =\n\tprocess.env.DESIGN_TOKENS_URL ||\n\t'https://raw.githubusercontent.com/WordPress/gutenberg/refs/heads/trunk/packages/theme/docs/tokens.md';\n\nlet cachedComponents: Record< string, ManifestComponent > | null = null;\nlet cachedTokens: string | null = null;\n\n/**\n * Clear cached data. Intended for testing.\n */\nexport function resetCache(): void {\n\tcachedComponents = null;\n\tcachedTokens = null;\n}\n\n/**\n * Fetch and cache the components from the Storybook manifest, filtered to only\n * components from allowed packages.\n *\n * @return The filtered components record.\n */\nasync function fetchComponents(): Promise<\n\tRecord< string, ManifestComponent >\n> {\n\tif ( cachedComponents ) {\n\t\treturn cachedComponents;\n\t}\n\n\tconst response = await fetch( COMPONENTS_MANIFEST_URL );\n\tif ( ! response.ok ) {\n\t\tthrow new Error(\n\t\t\t`Failed to fetch components manifest: ${ response.status } ${ response.statusText }`\n\t\t);\n\t}\n\n\tconst manifest: {\n\t\tv: number;\n\t\tcomponents: Record< string, ManifestComponent >;\n\t} = await response.json();\n\n\tconst filtered: Record< string, ManifestComponent > = {};\n\tfor ( const [ key, component ] of Object.entries( manifest.components ) ) {\n\t\tif ( packageNameFromPath( component.path ) ) {\n\t\t\tfiltered[ key ] = component;\n\t\t}\n\t}\n\n\tcachedComponents = filtered;\n\treturn cachedComponents;\n}\n\n/**\n * Get all components from allowed packages.\n *\n * @return Parsed component list.\n */\nexport async function getComponents(): Promise< Component[] > {\n\tconst components = await fetchComponents();\n\treturn parseComponents( components );\n}\n\n/**\n * Get detailed documentation for a single component by name.\n *\n * @param name - The component name (case-insensitive).\n * @return The component detail, or null if not found.\n */\nexport async function getComponentDetail(\n\tname: string\n): Promise< ComponentDetail | null > {\n\tconst components = await fetchComponents();\n\treturn parseComponentDetail( components, name );\n}\n\n/**\n * Get the design tokens reference document as markdown.\n *\n * @return The tokens markdown content.\n */\nexport async function getDesignTokens(): Promise< { content: string } > {\n\tif ( ! cachedTokens ) {\n\t\tconst response = await fetch( DESIGN_TOKENS_URL );\n\t\tif ( ! response.ok ) {\n\t\t\tthrow new Error(\n\t\t\t\t`Failed to fetch design tokens: ${ response.status } ${ response.statusText }`\n\t\t\t);\n\t\t}\n\n\t\tcachedTokens = await response.text();\n\t}\n\n\treturn { content: cachedTokens };\n}\n"],
5
5
  "mappings": ";AAAA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAGP,IAAM,0BACL,QAAQ,IAAI,2BACZ;AAED,IAAM,oBACL,QAAQ,IAAI,qBACZ;AAED,IAAI,mBAA+D;AACnE,IAAI,eAA8B;AAK3B,SAAS,aAAmB;AAClC,qBAAmB;AACnB,iBAAe;AAChB;AAQA,eAAe,kBAEb;AACD,MAAK,kBAAmB;AACvB,WAAO;AAAA,EACR;AAEA,QAAM,WAAW,MAAM,MAAO,uBAAwB;AACtD,MAAK,CAAE,SAAS,IAAK;AACpB,UAAM,IAAI;AAAA,MACT,wCAAyC,SAAS,MAAO,IAAK,SAAS,UAAW;AAAA,IACnF;AAAA,EACD;AAEA,QAAM,WAGF,MAAM,SAAS,KAAK;AAExB,QAAM,WAAgD,CAAC;AACvD,aAAY,CAAE,KAAK,SAAU,KAAK,OAAO,QAAS,SAAS,UAAW,GAAI;AACzE,QAAK,oBAAqB,UAAU,IAAK,GAAI;AAC5C,eAAU,GAAI,IAAI;AAAA,IACnB;AAAA,EACD;AAEA,qBAAmB;AACnB,SAAO;AACR;AAOA,eAAsB,gBAAwC;AAC7D,QAAM,aAAa,MAAM,gBAAgB;AACzC,SAAO,gBAAiB,UAAW;AACpC;AAQA,eAAsB,mBACrB,MACoC;AACpC,QAAM,aAAa,MAAM,gBAAgB;AACzC,SAAO,qBAAsB,YAAY,IAAK;AAC/C;AAOA,eAAsB,kBAAkD;AACvE,MAAK,CAAE,cAAe;AACrB,UAAM,WAAW,MAAM,MAAO,iBAAkB;AAChD,QAAK,CAAE,SAAS,IAAK;AACpB,YAAM,IAAI;AAAA,QACT,kCAAmC,SAAS,MAAO,IAAK,SAAS,UAAW;AAAA,MAC7E;AAAA,IACD;AAEA,mBAAe,MAAM,SAAS,KAAK;AAAA,EACpC;AAEA,SAAO,EAAE,SAAS,aAAa;AAChC;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/format.ts"],
4
- "sourcesContent": ["import type { Component, ComponentDetail } from './types';\n\n/**\n * Format a component's name, package, and description as markdown.\n *\n * @param component - The component to format.\n * @param headingLevel - The heading level for the component name.\n * @return Markdown lines.\n */\nfunction formatComponentSummary(\n\tcomponent: Component,\n\theadingLevel: number\n): string[] {\n\tconst heading = '#'.repeat( headingLevel );\n\tconst lines = [ `${ heading } ${ component.name }` ];\n\n\tif ( component.description ) {\n\t\tlines.push( '', component.description );\n\t}\n\n\treturn lines;\n}\n\n/**\n * Format the component list as markdown.\n *\n * @param components - The components to format.\n * @return Formatted markdown.\n */\nexport function formatComponents( components: Component[] ): string {\n\tconst lines = [ '# WordPress Design System Components' ];\n\n\tfor ( const component of components ) {\n\t\tlines.push( '', ...formatComponentSummary( component, 2 ) );\n\t}\n\n\treturn lines.join( '\\n' );\n}\n\n/**\n * Format a single component's detail as markdown documentation.\n *\n * @param detail - The component detail to format.\n * @return Formatted markdown.\n */\nexport function formatComponentDetail( detail: ComponentDetail ): string {\n\tconst lines = formatComponentSummary( detail, 1 );\n\n\tlines.push( '', `**Package:** \\`${ detail.packageName }\\`` );\n\n\tif ( detail.importStatement ) {\n\t\tlines.push(\n\t\t\t'',\n\t\t\t'## Import',\n\t\t\t'',\n\t\t\t'```ts',\n\t\t\tdetail.importStatement,\n\t\t\t'```'\n\t\t);\n\t}\n\n\tif ( detail.props.length > 0 ) {\n\t\tlines.push( '', '## Props', '' );\n\t\tfor ( const prop of detail.props ) {\n\t\t\tconst required = prop.required ? ' **(required)**' : '';\n\t\t\tconst defaultNote = prop.defaultValue\n\t\t\t\t? ` (default: \\`${ prop.defaultValue }\\`)`\n\t\t\t\t: '';\n\t\t\tlines.push(\n\t\t\t\t`### \\`${ prop.name }\\`: \\`${ prop.type }\\`${ required }${ defaultNote }`,\n\t\t\t\t''\n\t\t\t);\n\t\t\tif ( prop.description ) {\n\t\t\t\tlines.push( prop.description, '' );\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( detail.stories.length > 0 ) {\n\t\tlines.push( '', '## Examples', '' );\n\t\tfor ( const story of detail.stories ) {\n\t\t\tlines.push( `### ${ story.name }` );\n\t\t\tif ( story.snippet ) {\n\t\t\t\tlines.push( '', '```tsx', story.snippet, '```' );\n\t\t\t}\n\t\t\tlines.push( '' );\n\t\t}\n\t}\n\n\treturn lines.join( '\\n' );\n}\n"],
4
+ "sourcesContent": ["import type { Component, ComponentDetail } from './types.ts';\n\n/**\n * Format a component's name, package, and description as markdown.\n *\n * @param component - The component to format.\n * @param headingLevel - The heading level for the component name.\n * @return Markdown lines.\n */\nfunction formatComponentSummary(\n\tcomponent: Component,\n\theadingLevel: number\n): string[] {\n\tconst heading = '#'.repeat( headingLevel );\n\tconst lines = [ `${ heading } ${ component.name }` ];\n\n\tif ( component.description ) {\n\t\tlines.push( '', component.description );\n\t}\n\n\treturn lines;\n}\n\n/**\n * Format the component list as markdown.\n *\n * @param components - The components to format.\n * @return Formatted markdown.\n */\nexport function formatComponents( components: Component[] ): string {\n\tconst lines = [ '# WordPress Design System Components' ];\n\n\tfor ( const component of components ) {\n\t\tlines.push( '', ...formatComponentSummary( component, 2 ) );\n\t}\n\n\treturn lines.join( '\\n' );\n}\n\n/**\n * Format a single component's detail as markdown documentation.\n *\n * @param detail - The component detail to format.\n * @return Formatted markdown.\n */\nexport function formatComponentDetail( detail: ComponentDetail ): string {\n\tconst lines = formatComponentSummary( detail, 1 );\n\n\tlines.push( '', `**Package:** \\`${ detail.packageName }\\`` );\n\n\tif ( detail.importStatement ) {\n\t\tlines.push(\n\t\t\t'',\n\t\t\t'## Import',\n\t\t\t'',\n\t\t\t'```ts',\n\t\t\tdetail.importStatement,\n\t\t\t'```'\n\t\t);\n\t}\n\n\tif ( detail.props.length > 0 ) {\n\t\tlines.push( '', '## Props', '' );\n\t\tfor ( const prop of detail.props ) {\n\t\t\tconst required = prop.required ? ' **(required)**' : '';\n\t\t\tconst defaultNote = prop.defaultValue\n\t\t\t\t? ` (default: \\`${ prop.defaultValue }\\`)`\n\t\t\t\t: '';\n\t\t\tlines.push(\n\t\t\t\t`### \\`${ prop.name }\\`: \\`${ prop.type }\\`${ required }${ defaultNote }`,\n\t\t\t\t''\n\t\t\t);\n\t\t\tif ( prop.description ) {\n\t\t\t\tlines.push( prop.description, '' );\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( detail.stories.length > 0 ) {\n\t\tlines.push( '', '## Examples', '' );\n\t\tfor ( const story of detail.stories ) {\n\t\t\tlines.push( `### ${ story.name }` );\n\t\t\tif ( story.snippet ) {\n\t\t\t\tlines.push( '', '```tsx', story.snippet, '```' );\n\t\t\t}\n\t\t\tlines.push( '' );\n\t\t}\n\t}\n\n\treturn lines.join( '\\n' );\n}\n"],
5
5
  "mappings": ";AASA,SAAS,uBACR,WACA,cACW;AACX,QAAM,UAAU,IAAI,OAAQ,YAAa;AACzC,QAAM,QAAQ,CAAE,GAAI,OAAQ,IAAK,UAAU,IAAK,EAAG;AAEnD,MAAK,UAAU,aAAc;AAC5B,UAAM,KAAM,IAAI,UAAU,WAAY;AAAA,EACvC;AAEA,SAAO;AACR;AAQO,SAAS,iBAAkB,YAAkC;AACnE,QAAM,QAAQ,CAAE,sCAAuC;AAEvD,aAAY,aAAa,YAAa;AACrC,UAAM,KAAM,IAAI,GAAG,uBAAwB,WAAW,CAAE,CAAE;AAAA,EAC3D;AAEA,SAAO,MAAM,KAAM,IAAK;AACzB;AAQO,SAAS,sBAAuB,QAAkC;AACxE,QAAM,QAAQ,uBAAwB,QAAQ,CAAE;AAEhD,QAAM,KAAM,IAAI,kBAAmB,OAAO,WAAY,IAAK;AAE3D,MAAK,OAAO,iBAAkB;AAC7B,UAAM;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP;AAAA,IACD;AAAA,EACD;AAEA,MAAK,OAAO,MAAM,SAAS,GAAI;AAC9B,UAAM,KAAM,IAAI,YAAY,EAAG;AAC/B,eAAY,QAAQ,OAAO,OAAQ;AAClC,YAAM,WAAW,KAAK,WAAW,oBAAoB;AACrD,YAAM,cAAc,KAAK,eACtB,gBAAiB,KAAK,YAAa,QACnC;AACH,YAAM;AAAA,QACL,SAAU,KAAK,IAAK,SAAU,KAAK,IAAK,KAAM,QAAS,GAAI,WAAY;AAAA,QACvE;AAAA,MACD;AACA,UAAK,KAAK,aAAc;AACvB,cAAM,KAAM,KAAK,aAAa,EAAG;AAAA,MAClC;AAAA,IACD;AAAA,EACD;AAEA,MAAK,OAAO,QAAQ,SAAS,GAAI;AAChC,UAAM,KAAM,IAAI,eAAe,EAAG;AAClC,eAAY,SAAS,OAAO,SAAU;AACrC,YAAM,KAAM,OAAQ,MAAM,IAAK,EAAG;AAClC,UAAK,MAAM,SAAU;AACpB,cAAM,KAAM,IAAI,UAAU,MAAM,SAAS,KAAM;AAAA,MAChD;AACA,YAAM,KAAM,EAAG;AAAA,IAChB;AAAA,EACD;AAEA,SAAO,MAAM,KAAM,IAAK;AACzB;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["import { McpServer } from '@modelcontextprotocol/server';\nimport { registerTools } from './tools/index';\n\nexport { parseComponents, parseComponentDetail } from './parse-components';\n\nexport function createServer() {\n\tconst server = new McpServer(\n\t\t{\n\t\t\tname: 'WordPress Design System',\n\t\t\tversion: '0.1.0',\n\t\t},\n\t\t{\n\t\t\tinstructions: [\n\t\t\t\t'Provides discovery and usage information for the WordPress Design System. Covers components in `@wordpress/components` and `@wordpress/ui`, and the underlying design tokens from `@wordpress/theme` exposed as `--wpds-*` CSS custom properties.',\n\t\t\t\t'In a typical flow, a user will often refer to components by generic names (\"button\", \"dropdown menu\") that don\\'t match the actual export. Call `get_components` first to map the request to canonical component names, then `get_component_details` for one or more of those names to get props, descriptions, and usage notes.',\n\t\t\t\t'`get_design_tokens` covers the semantic, themeable design tokens that the components are built on. While these can be used for custom styling that adapts to the current design system theme settings, prefer using the available component APIs when available.',\n\t\t\t].join( '\\n\\n' ),\n\t\t}\n\t);\n\n\tregisterTools( server );\n\n\treturn server;\n}\n"],
4
+ "sourcesContent": ["import { McpServer } from '@modelcontextprotocol/server';\nimport { registerTools } from './tools/index.ts';\n\nexport { parseComponents, parseComponentDetail } from './parse-components.ts';\n\nexport function createServer() {\n\tconst server = new McpServer(\n\t\t{\n\t\t\tname: 'WordPress Design System',\n\t\t\tversion: '0.1.0',\n\t\t},\n\t\t{\n\t\t\tinstructions: [\n\t\t\t\t'Provides discovery and usage information for the WordPress Design System. Covers components in `@wordpress/components` and `@wordpress/ui`, and the underlying design tokens from `@wordpress/theme` exposed as `--wpds-*` CSS custom properties.',\n\t\t\t\t'In a typical flow, a user will often refer to components by generic names (\"button\", \"dropdown menu\") that don\\'t match the actual export. Call `get_components` first to map the request to canonical component names, then `get_component_details` for one or more of those names to get props, descriptions, and usage notes.',\n\t\t\t\t'`get_design_tokens` covers the semantic, themeable design tokens that the components are built on. While these can be used for custom styling that adapts to the current design system theme settings, prefer using the available component APIs when available.',\n\t\t\t].join( '\\n\\n' ),\n\t\t}\n\t);\n\n\tregisterTools( server );\n\n\treturn server;\n}\n"],
5
5
  "mappings": ";AAAA,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAE9B,SAAS,iBAAiB,4BAA4B;AAE/C,SAAS,eAAe;AAC9B,QAAM,SAAS,IAAI;AAAA,IAClB;AAAA,MACC,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,IACA;AAAA,MACC,cAAc;AAAA,QACb;AAAA,QACA;AAAA,QACA;AAAA,MACD,EAAE,KAAM,MAAO;AAAA,IAChB;AAAA,EACD;AAEA,gBAAe,MAAO;AAEtB,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/parse-components.ts"],
4
- "sourcesContent": ["import type {\n\tComponent,\n\tComponentDetail,\n\tComponentProp,\n\tManifestComponent,\n} from './types';\n\n/**\n * Mapping of canonical name to actual exported identifier, keyed by\n * `package:name`. A package's actual exported identifier may be different from\n * the canonical name in the internal implementation that's known to Storybook.\n *\n * Ideally we could derive this from the package's source code, but MCP\n * consumers aren't guaranteed to have these packages installed. Since this\n * is a legacy convention, we expect this list will only ever shrink over time\n * and can eventually be removed.\n */\nconst EXPORT_ALIASES: Record< string, string > = {\n\t'@wordpress/components:ConfirmDialog': '__experimentalConfirmDialog',\n\t'@wordpress/components:InputControl': '__experimentalInputControl',\n\t'@wordpress/components:ItemGroup': '__experimentalItemGroup',\n\t'@wordpress/components:ToggleGroupControl':\n\t\t'__experimentalToggleGroupControl',\n\t'@wordpress/components:TreeGrid': '__experimentalTreeGrid',\n\t'@wordpress/components:Truncate': '__experimentalTruncate',\n};\n\n/**\n * Build the import statement a consumer should use to bring a component into\n * scope under its canonical name. For aliased components, emit an `as` rename\n * so that subsequent code samples (which reference the canonical name) resolve\n * against the actual export.\n *\n * @param name - The canonical component name.\n * @param packageName - The npm package name.\n * @return The import statement as a single-line string.\n */\nfunction buildImportStatement( name: string, packageName: string ): string {\n\tconst exported = EXPORT_ALIASES[ `${ packageName }:${ name }` ];\n\treturn exported\n\t\t? `import { ${ exported } as ${ name } } from '${ packageName }';`\n\t\t: `import { ${ name } } from '${ packageName }';`;\n}\n\n/**\n * Derive the npm package name from the story file path.\n *\n * Manifest paths look like `../packages/<dir>/src/.../index.story.tsx`. We\n * extract `<dir>` and prepend the `@wordpress/` npm namespace. Curation of\n * which components appear in the manifest is handled upstream via Storybook\n * tags, so this only needs to recognize package-shaped paths.\n *\n * @param storyPath - The story file path from the manifest.\n * @return The npm package name, or null for paths outside `packages/*`.\n */\nexport function packageNameFromPath( storyPath: string ): string | null {\n\tconst match = storyPath.match( /\\.\\.\\/packages\\/([^/]+)\\// );\n\treturn match ? `@wordpress/${ match[ 1 ] }` : null;\n}\n\n/**\n * For components exported as a namespace (e.g. `AlertDialog`, with members\n * `AlertDialog.Root`, `AlertDialog.Trigger`, etc.), the manifest lists the\n * primary entry under a dotted name like `AlertDialog.Root`. The canonical\n * name we expose is the top-level identifier a consumer actually imports,\n * which is the portion before the first dot. For simple components (e.g.\n * `Button`), this is a no-op.\n *\n * @param name - The component name from the manifest.\n * @return The top-level importable identifier.\n */\nfunction canonicalComponentName( name: string ): string {\n\treturn name.split( '.', 1 )[ 0 ];\n}\n\n/**\n * Parse props from a component's `reactComponentMeta` data, filtering out\n * deprecated and ignored props.\n *\n * @param rawProps - The component meta props record.\n * @return Parsed props with deprecated entries removed.\n */\nexport function parseProps(\n\trawProps: Record<\n\t\tstring,\n\t\t{\n\t\t\trequired?: boolean;\n\t\t\ttype?: { name: string; raw?: string };\n\t\t\tdescription?: string;\n\t\t\tdefaultValue?: { value: string } | null;\n\t\t}\n\t>\n): ComponentProp[] {\n\treturn Object.entries( rawProps )\n\t\t.filter( ( [ , propInfo ] ) => {\n\t\t\tconst description = ( propInfo.description || '' ).toLowerCase();\n\t\t\treturn (\n\t\t\t\t! description.includes( '@deprecated' ) &&\n\t\t\t\t! description.includes( '@ignore' )\n\t\t\t);\n\t\t} )\n\t\t.map( ( [ propName, propInfo ] ) => ( {\n\t\t\tname: propName,\n\t\t\t// Prefer `raw` when present, as it carries the source-authored type\n\t\t\t// expression a consumer could use directly. Primitives emit only\n\t\t\t// `name`, so fall back if `raw` is not present.\n\t\t\ttype: propInfo.type?.raw || propInfo.type?.name || 'unknown',\n\t\t\trequired: propInfo.required || false,\n\t\t\tdescription: propInfo.description || '',\n\t\t\tdefaultValue: propInfo.defaultValue?.value ?? null,\n\t\t} ) );\n}\n\n/**\n * Parse manifest components into a flat list sorted alphabetically by name.\n * When a component is defined across multiple story files (e.g. a companion\n * file documenting a specific aspect), it is collapsed to a single entry keyed\n * by its canonical name and package.\n *\n * @param components - The manifest components record.\n * @return Flat list of components derived from the manifest.\n */\nexport function parseComponents(\n\tcomponents: Record< string, ManifestComponent >\n): Component[] {\n\tconst byKey = new Map< string, Component >();\n\n\tfor ( const component of Object.values( components ) ) {\n\t\tconst packageName = packageNameFromPath( component.path );\n\t\tif ( ! packageName ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst name = canonicalComponentName( component.name );\n\t\tconst key = `${ packageName }:${ name }`;\n\t\tconst existing = byKey.get( key );\n\t\tconst description = component.description || '';\n\n\t\tif ( ! existing ) {\n\t\t\tbyKey.set( key, { name, description, packageName } );\n\t\t} else {\n\t\t\t// Prefer a non-empty description from a later entry over an\n\t\t\t// empty one from the first.\n\t\t\texisting.description ||= description;\n\t\t}\n\t}\n\n\treturn Array.from( byKey.values() ).sort( ( a, b ) =>\n\t\ta.name.localeCompare( b.name )\n\t);\n}\n\n/**\n * Find a single component by name (case-insensitive) and return its full\n * detail including props and stories. When a component is spread across\n * multiple story files, stories from every contributing file are collected\n * in manifest order. Descriptions and props are also authored on the component\n * itself, so in principle they should be identical across story files; in\n * practice one file may omit them, so we prefer any non-empty value found.\n *\n * @param components - The manifest components record.\n * @param name - The component name to look up.\n * @return The component detail, or null if not found.\n */\nexport function parseComponentDetail(\n\tcomponents: Record< string, ManifestComponent >,\n\tname: string\n): ComponentDetail | null {\n\tlet detail: ComponentDetail | null = null;\n\n\tfor ( const component of Object.values( components ) ) {\n\t\tconst canonicalName = canonicalComponentName( component.name );\n\t\tif ( canonicalName.toLowerCase() !== name.toLowerCase() ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst pkg = packageNameFromPath( component.path );\n\t\tif ( ! pkg ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst description = component.description || '';\n\t\tconst props = parseProps( component.reactComponentMeta?.props || {} );\n\t\tconst stories = component.stories || [];\n\n\t\tif ( ! detail ) {\n\t\t\tdetail = {\n\t\t\t\tname: canonicalName,\n\t\t\t\tdescription,\n\t\t\t\tpackageName: pkg,\n\t\t\t\timportStatement: buildImportStatement( canonicalName, pkg ),\n\t\t\t\tprops,\n\t\t\t\tstories: [ ...stories ],\n\t\t\t};\n\t\t} else if ( detail.packageName === pkg ) {\n\t\t\tdetail.description ||= description;\n\t\t\tif ( detail.props.length === 0 ) {\n\t\t\t\tdetail.props = props;\n\t\t\t}\n\t\t\tdetail.stories.push( ...stories );\n\t\t}\n\t}\n\n\treturn detail;\n}\n"],
4
+ "sourcesContent": ["import type {\n\tComponent,\n\tComponentDetail,\n\tComponentProp,\n\tManifestComponent,\n} from './types.ts';\n\n/**\n * Mapping of canonical name to actual exported identifier, keyed by\n * `package:name`. A package's actual exported identifier may be different from\n * the canonical name in the internal implementation that's known to Storybook.\n *\n * Ideally we could derive this from the package's source code, but MCP\n * consumers aren't guaranteed to have these packages installed. Since this\n * is a legacy convention, we expect this list will only ever shrink over time\n * and can eventually be removed.\n */\nconst EXPORT_ALIASES: Record< string, string > = {\n\t'@wordpress/components:ConfirmDialog': '__experimentalConfirmDialog',\n\t'@wordpress/components:InputControl': '__experimentalInputControl',\n\t'@wordpress/components:ItemGroup': '__experimentalItemGroup',\n\t'@wordpress/components:ToggleGroupControl':\n\t\t'__experimentalToggleGroupControl',\n\t'@wordpress/components:TreeGrid': '__experimentalTreeGrid',\n\t'@wordpress/components:Truncate': '__experimentalTruncate',\n};\n\n/**\n * Build the import statement a consumer should use to bring a component into\n * scope under its canonical name. For aliased components, emit an `as` rename\n * so that subsequent code samples (which reference the canonical name) resolve\n * against the actual export.\n *\n * @param name - The canonical component name.\n * @param packageName - The npm package name.\n * @return The import statement as a single-line string.\n */\nfunction buildImportStatement( name: string, packageName: string ): string {\n\tconst exported = EXPORT_ALIASES[ `${ packageName }:${ name }` ];\n\treturn exported\n\t\t? `import { ${ exported } as ${ name } } from '${ packageName }';`\n\t\t: `import { ${ name } } from '${ packageName }';`;\n}\n\n/**\n * Derive the npm package name from the story file path.\n *\n * Manifest paths look like `../packages/<dir>/src/.../index.story.tsx`. We\n * extract `<dir>` and prepend the `@wordpress/` npm namespace. Curation of\n * which components appear in the manifest is handled upstream via Storybook\n * tags, so this only needs to recognize package-shaped paths.\n *\n * @param storyPath - The story file path from the manifest.\n * @return The npm package name, or null for paths outside `packages/*`.\n */\nexport function packageNameFromPath( storyPath: string ): string | null {\n\tconst match = storyPath.match( /\\.\\.\\/packages\\/([^/]+)\\// );\n\treturn match ? `@wordpress/${ match[ 1 ] }` : null;\n}\n\n/**\n * For components exported as a namespace (e.g. `AlertDialog`, with members\n * `AlertDialog.Root`, `AlertDialog.Trigger`, etc.), the manifest lists the\n * primary entry under a dotted name like `AlertDialog.Root`. The canonical\n * name we expose is the top-level identifier a consumer actually imports,\n * which is the portion before the first dot. For simple components (e.g.\n * `Button`), this is a no-op.\n *\n * @param name - The component name from the manifest.\n * @return The top-level importable identifier.\n */\nfunction canonicalComponentName( name: string ): string {\n\treturn name.split( '.', 1 )[ 0 ];\n}\n\n/**\n * Parse props from a component's `reactComponentMeta` data, filtering out\n * deprecated and ignored props.\n *\n * @param rawProps - The component meta props record.\n * @return Parsed props with deprecated entries removed.\n */\nexport function parseProps(\n\trawProps: Record<\n\t\tstring,\n\t\t{\n\t\t\trequired?: boolean;\n\t\t\ttype?: { name: string; raw?: string };\n\t\t\tdescription?: string;\n\t\t\tdefaultValue?: { value: string } | null;\n\t\t}\n\t>\n): ComponentProp[] {\n\treturn Object.entries( rawProps )\n\t\t.filter( ( [ , propInfo ] ) => {\n\t\t\tconst description = ( propInfo.description || '' ).toLowerCase();\n\t\t\treturn (\n\t\t\t\t! description.includes( '@deprecated' ) &&\n\t\t\t\t! description.includes( '@ignore' )\n\t\t\t);\n\t\t} )\n\t\t.map( ( [ propName, propInfo ] ) => ( {\n\t\t\tname: propName,\n\t\t\t// Prefer `raw` when present, as it carries the source-authored type\n\t\t\t// expression a consumer could use directly. Primitives emit only\n\t\t\t// `name`, so fall back if `raw` is not present.\n\t\t\ttype: propInfo.type?.raw || propInfo.type?.name || 'unknown',\n\t\t\trequired: propInfo.required || false,\n\t\t\tdescription: propInfo.description || '',\n\t\t\tdefaultValue: propInfo.defaultValue?.value ?? null,\n\t\t} ) );\n}\n\n/**\n * Parse manifest components into a flat list sorted alphabetically by name.\n * When a component is defined across multiple story files (e.g. a companion\n * file documenting a specific aspect), it is collapsed to a single entry keyed\n * by its canonical name and package.\n *\n * @param components - The manifest components record.\n * @return Flat list of components derived from the manifest.\n */\nexport function parseComponents(\n\tcomponents: Record< string, ManifestComponent >\n): Component[] {\n\tconst byKey = new Map< string, Component >();\n\n\tfor ( const component of Object.values( components ) ) {\n\t\tconst packageName = packageNameFromPath( component.path );\n\t\tif ( ! packageName ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst name = canonicalComponentName( component.name );\n\t\tconst key = `${ packageName }:${ name }`;\n\t\tconst existing = byKey.get( key );\n\t\tconst description = component.description || '';\n\n\t\tif ( ! existing ) {\n\t\t\tbyKey.set( key, { name, description, packageName } );\n\t\t} else {\n\t\t\t// Prefer a non-empty description from a later entry over an\n\t\t\t// empty one from the first.\n\t\t\texisting.description ||= description;\n\t\t}\n\t}\n\n\treturn Array.from( byKey.values() ).sort( ( a, b ) =>\n\t\ta.name.localeCompare( b.name )\n\t);\n}\n\n/**\n * Find a single component by name (case-insensitive) and return its full\n * detail including props and stories. When a component is spread across\n * multiple story files, stories from every contributing file are collected\n * in manifest order. Descriptions and props are also authored on the component\n * itself, so in principle they should be identical across story files; in\n * practice one file may omit them, so we prefer any non-empty value found.\n *\n * @param components - The manifest components record.\n * @param name - The component name to look up.\n * @return The component detail, or null if not found.\n */\nexport function parseComponentDetail(\n\tcomponents: Record< string, ManifestComponent >,\n\tname: string\n): ComponentDetail | null {\n\tlet detail: ComponentDetail | null = null;\n\n\tfor ( const component of Object.values( components ) ) {\n\t\tconst canonicalName = canonicalComponentName( component.name );\n\t\tif ( canonicalName.toLowerCase() !== name.toLowerCase() ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst pkg = packageNameFromPath( component.path );\n\t\tif ( ! pkg ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst description = component.description || '';\n\t\tconst props = parseProps( component.reactComponentMeta?.props || {} );\n\t\tconst stories = component.stories || [];\n\n\t\tif ( ! detail ) {\n\t\t\tdetail = {\n\t\t\t\tname: canonicalName,\n\t\t\t\tdescription,\n\t\t\t\tpackageName: pkg,\n\t\t\t\timportStatement: buildImportStatement( canonicalName, pkg ),\n\t\t\t\tprops,\n\t\t\t\tstories: [ ...stories ],\n\t\t\t};\n\t\t} else if ( detail.packageName === pkg ) {\n\t\t\tdetail.description ||= description;\n\t\t\tif ( detail.props.length === 0 ) {\n\t\t\t\tdetail.props = props;\n\t\t\t}\n\t\t\tdetail.stories.push( ...stories );\n\t\t}\n\t}\n\n\treturn detail;\n}\n"],
5
5
  "mappings": ";AAiBA,IAAM,iBAA2C;AAAA,EAChD,uCAAuC;AAAA,EACvC,sCAAsC;AAAA,EACtC,mCAAmC;AAAA,EACnC,4CACC;AAAA,EACD,kCAAkC;AAAA,EAClC,kCAAkC;AACnC;AAYA,SAAS,qBAAsB,MAAc,aAA8B;AAC1E,QAAM,WAAW,eAAgB,GAAI,WAAY,IAAK,IAAK,EAAG;AAC9D,SAAO,WACJ,YAAa,QAAS,OAAQ,IAAK,YAAa,WAAY,OAC5D,YAAa,IAAK,YAAa,WAAY;AAC/C;AAaO,SAAS,oBAAqB,WAAmC;AACvE,QAAM,QAAQ,UAAU,MAAO,2BAA4B;AAC3D,SAAO,QAAQ,cAAe,MAAO,CAAE,CAAE,KAAK;AAC/C;AAaA,SAAS,uBAAwB,MAAuB;AACvD,SAAO,KAAK,MAAO,KAAK,CAAE,EAAG,CAAE;AAChC;AASO,SAAS,WACf,UASkB;AAClB,SAAO,OAAO,QAAS,QAAS,EAC9B,OAAQ,CAAE,CAAE,EAAE,QAAS,MAAO;AAC9B,UAAM,eAAgB,SAAS,eAAe,IAAK,YAAY;AAC/D,WACC,CAAE,YAAY,SAAU,aAAc,KACtC,CAAE,YAAY,SAAU,SAAU;AAAA,EAEpC,CAAE,EACD,IAAK,CAAE,CAAE,UAAU,QAAS,OAAS;AAAA,IACrC,MAAM;AAAA;AAAA;AAAA;AAAA,IAIN,MAAM,SAAS,MAAM,OAAO,SAAS,MAAM,QAAQ;AAAA,IACnD,UAAU,SAAS,YAAY;AAAA,IAC/B,aAAa,SAAS,eAAe;AAAA,IACrC,cAAc,SAAS,cAAc,SAAS;AAAA,EAC/C,EAAI;AACN;AAWO,SAAS,gBACf,YACc;AACd,QAAM,QAAQ,oBAAI,IAAyB;AAE3C,aAAY,aAAa,OAAO,OAAQ,UAAW,GAAI;AACtD,UAAM,cAAc,oBAAqB,UAAU,IAAK;AACxD,QAAK,CAAE,aAAc;AACpB;AAAA,IACD;AAEA,UAAM,OAAO,uBAAwB,UAAU,IAAK;AACpD,UAAM,MAAM,GAAI,WAAY,IAAK,IAAK;AACtC,UAAM,WAAW,MAAM,IAAK,GAAI;AAChC,UAAM,cAAc,UAAU,eAAe;AAE7C,QAAK,CAAE,UAAW;AACjB,YAAM,IAAK,KAAK,EAAE,MAAM,aAAa,YAAY,CAAE;AAAA,IACpD,OAAO;AAGN,eAAS,gBAAgB;AAAA,IAC1B;AAAA,EACD;AAEA,SAAO,MAAM,KAAM,MAAM,OAAO,CAAE,EAAE;AAAA,IAAM,CAAE,GAAG,MAC9C,EAAE,KAAK,cAAe,EAAE,IAAK;AAAA,EAC9B;AACD;AAcO,SAAS,qBACf,YACA,MACyB;AACzB,MAAI,SAAiC;AAErC,aAAY,aAAa,OAAO,OAAQ,UAAW,GAAI;AACtD,UAAM,gBAAgB,uBAAwB,UAAU,IAAK;AAC7D,QAAK,cAAc,YAAY,MAAM,KAAK,YAAY,GAAI;AACzD;AAAA,IACD;AAEA,UAAM,MAAM,oBAAqB,UAAU,IAAK;AAChD,QAAK,CAAE,KAAM;AACZ;AAAA,IACD;AAEA,UAAM,cAAc,UAAU,eAAe;AAC7C,UAAM,QAAQ,WAAY,UAAU,oBAAoB,SAAS,CAAC,CAAE;AACpE,UAAM,UAAU,UAAU,WAAW,CAAC;AAEtC,QAAK,CAAE,QAAS;AACf,eAAS;AAAA,QACR,MAAM;AAAA,QACN;AAAA,QACA,aAAa;AAAA,QACb,iBAAiB,qBAAsB,eAAe,GAAI;AAAA,QAC1D;AAAA,QACA,SAAS,CAAE,GAAG,OAAQ;AAAA,MACvB;AAAA,IACD,WAAY,OAAO,gBAAgB,KAAM;AACxC,aAAO,gBAAgB;AACvB,UAAK,OAAO,MAAM,WAAW,GAAI;AAChC,eAAO,QAAQ;AAAA,MAChB;AACA,aAAO,QAAQ,KAAM,GAAG,OAAQ;AAAA,IACjC;AAAA,EACD;AAEA,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/tools/get-component-details.ts"],
4
- "sourcesContent": ["import type { McpServer } from '@modelcontextprotocol/server';\nimport { z } from 'zod';\nimport { getComponentDetail } from '../data';\nimport { formatComponentDetail } from '../format';\n\nconst inputSchema = z.object( {\n\tname: z\n\t\t.union( [\n\t\t\tz.string().min( 1 ),\n\t\t\tz.array( z.string().min( 1 ) ).min( 1 ).max( 10 ),\n\t\t] )\n\t\t.describe(\n\t\t\t'A component name, or an array of component names to fetch in a single call (e.g. \"Button\" or [\"Button\", \"Tabs\"]).'\n\t\t),\n} );\n\nexport async function handler( { name }: z.infer< typeof inputSchema > ) {\n\tconst names = Array.isArray( name ) ? name : [ name ];\n\tconst sections: string[] = [];\n\tconst missing: string[] = [];\n\n\tfor ( const componentName of names ) {\n\t\tconst detail = await getComponentDetail( componentName );\n\t\tif ( detail ) {\n\t\t\tsections.push( formatComponentDetail( detail ) );\n\t\t} else {\n\t\t\tmissing.push( componentName );\n\t\t}\n\t}\n\n\tif ( sections.length === 0 ) {\n\t\tconst list = missing.map( ( n ) => `\"${ n }\"` ).join( ', ' );\n\t\treturn {\n\t\t\tcontent: [\n\t\t\t\t{\n\t\t\t\t\ttype: 'text' as const,\n\t\t\t\t\ttext: `No components were found for: ${ list }.`,\n\t\t\t\t},\n\t\t\t],\n\t\t\tisError: true,\n\t\t};\n\t}\n\n\tlet text = sections.join( '\\n\\n---\\n\\n' );\n\tif ( missing.length > 0 ) {\n\t\tconst list = missing.map( ( n ) => `\"${ n }\"` ).join( ', ' );\n\t\ttext += `\\n\\n---\\n\\n_No components were found for: ${ list }._`;\n\t}\n\n\treturn {\n\t\tcontent: [\n\t\t\t{\n\t\t\t\ttype: 'text' as const,\n\t\t\t\ttext,\n\t\t\t},\n\t\t],\n\t};\n}\n\n/**\n * Register the get_component_details tool.\n *\n * @param server - The MCP server instance.\n */\nexport function register( server: McpServer ): void {\n\tserver.registerTool(\n\t\t'get_component_details',\n\t\t{\n\t\t\ttitle: 'Get Component Details',\n\t\t\tdescription:\n\t\t\t\t'Get detailed documentation for one or more WordPress Design System components including props, usage examples, and import statements. Pass multiple names to fetch several components in a single call instead of making repeated calls.',\n\t\t\tinputSchema,\n\t\t\tannotations: {\n\t\t\t\treadOnlyHint: true,\n\t\t\t},\n\t\t},\n\t\thandler\n\t);\n}\n"],
4
+ "sourcesContent": ["import type { McpServer } from '@modelcontextprotocol/server';\nimport { z } from 'zod';\nimport { getComponentDetail } from '../data.ts';\nimport { formatComponentDetail } from '../format.ts';\n\nconst inputSchema = z.object( {\n\tname: z\n\t\t.union( [\n\t\t\tz.string().min( 1 ),\n\t\t\tz.array( z.string().min( 1 ) ).min( 1 ).max( 10 ),\n\t\t] )\n\t\t.describe(\n\t\t\t'A component name, or an array of component names to fetch in a single call (e.g. \"Button\" or [\"Button\", \"Tabs\"]).'\n\t\t),\n} );\n\nexport async function handler( { name }: z.infer< typeof inputSchema > ) {\n\tconst names = Array.isArray( name ) ? name : [ name ];\n\tconst sections: string[] = [];\n\tconst missing: string[] = [];\n\n\tfor ( const componentName of names ) {\n\t\tconst detail = await getComponentDetail( componentName );\n\t\tif ( detail ) {\n\t\t\tsections.push( formatComponentDetail( detail ) );\n\t\t} else {\n\t\t\tmissing.push( componentName );\n\t\t}\n\t}\n\n\tif ( sections.length === 0 ) {\n\t\tconst list = missing.map( ( n ) => `\"${ n }\"` ).join( ', ' );\n\t\treturn {\n\t\t\tcontent: [\n\t\t\t\t{\n\t\t\t\t\ttype: 'text' as const,\n\t\t\t\t\ttext: `No components were found for: ${ list }.`,\n\t\t\t\t},\n\t\t\t],\n\t\t\tisError: true,\n\t\t};\n\t}\n\n\tlet text = sections.join( '\\n\\n---\\n\\n' );\n\tif ( missing.length > 0 ) {\n\t\tconst list = missing.map( ( n ) => `\"${ n }\"` ).join( ', ' );\n\t\ttext += `\\n\\n---\\n\\n_No components were found for: ${ list }._`;\n\t}\n\n\treturn {\n\t\tcontent: [\n\t\t\t{\n\t\t\t\ttype: 'text' as const,\n\t\t\t\ttext,\n\t\t\t},\n\t\t],\n\t};\n}\n\n/**\n * Register the get_component_details tool.\n *\n * @param server - The MCP server instance.\n */\nexport function register( server: McpServer ): void {\n\tserver.registerTool(\n\t\t'get_component_details',\n\t\t{\n\t\t\ttitle: 'Get Component Details',\n\t\t\tdescription:\n\t\t\t\t'Get detailed documentation for one or more WordPress Design System components including props, usage examples, and import statements. Pass multiple names to fetch several components in a single call instead of making repeated calls.',\n\t\t\tinputSchema,\n\t\t\tannotations: {\n\t\t\t\treadOnlyHint: true,\n\t\t\t},\n\t\t},\n\t\thandler\n\t);\n}\n"],
5
5
  "mappings": ";AACA,SAAS,SAAS;AAClB,SAAS,0BAA0B;AACnC,SAAS,6BAA6B;AAEtC,IAAM,cAAc,EAAE,OAAQ;AAAA,EAC7B,MAAM,EACJ,MAAO;AAAA,IACP,EAAE,OAAO,EAAE,IAAK,CAAE;AAAA,IAClB,EAAE,MAAO,EAAE,OAAO,EAAE,IAAK,CAAE,CAAE,EAAE,IAAK,CAAE,EAAE,IAAK,EAAG;AAAA,EACjD,CAAE,EACD;AAAA,IACA;AAAA,EACD;AACF,CAAE;AAEF,eAAsB,QAAS,EAAE,KAAK,GAAmC;AACxE,QAAM,QAAQ,MAAM,QAAS,IAAK,IAAI,OAAO,CAAE,IAAK;AACpD,QAAM,WAAqB,CAAC;AAC5B,QAAM,UAAoB,CAAC;AAE3B,aAAY,iBAAiB,OAAQ;AACpC,UAAM,SAAS,MAAM,mBAAoB,aAAc;AACvD,QAAK,QAAS;AACb,eAAS,KAAM,sBAAuB,MAAO,CAAE;AAAA,IAChD,OAAO;AACN,cAAQ,KAAM,aAAc;AAAA,IAC7B;AAAA,EACD;AAEA,MAAK,SAAS,WAAW,GAAI;AAC5B,UAAM,OAAO,QAAQ,IAAK,CAAE,MAAO,IAAK,CAAE,GAAI,EAAE,KAAM,IAAK;AAC3D,WAAO;AAAA,MACN,SAAS;AAAA,QACR;AAAA,UACC,MAAM;AAAA,UACN,MAAM,iCAAkC,IAAK;AAAA,QAC9C;AAAA,MACD;AAAA,MACA,SAAS;AAAA,IACV;AAAA,EACD;AAEA,MAAI,OAAO,SAAS,KAAM,aAAc;AACxC,MAAK,QAAQ,SAAS,GAAI;AACzB,UAAM,OAAO,QAAQ,IAAK,CAAE,MAAO,IAAK,CAAE,GAAI,EAAE,KAAM,IAAK;AAC3D,YAAQ;AAAA;AAAA;AAAA;AAAA,iCAA8C,IAAK;AAAA,EAC5D;AAEA,SAAO;AAAA,IACN,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;AAOO,SAAS,SAAU,QAA0B;AACnD,SAAO;AAAA,IACN;AAAA,IACA;AAAA,MACC,OAAO;AAAA,MACP,aACC;AAAA,MACD;AAAA,MACA,aAAa;AAAA,QACZ,cAAc;AAAA,MACf;AAAA,IACD;AAAA,IACA;AAAA,EACD;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/tools/get-components.ts"],
4
- "sourcesContent": ["import type { McpServer } from '@modelcontextprotocol/server';\nimport { getComponents } from '../data';\nimport { formatComponents } from '../format';\n\n/**\n * Register the get_components tool.\n *\n * @param server - The MCP server instance.\n */\nexport function register( server: McpServer ): void {\n\tserver.registerTool(\n\t\t'get_components',\n\t\t{\n\t\t\ttitle: 'Get Components',\n\t\t\tdescription:\n\t\t\t\t'Get a list of all available WordPress Design System components with their package names and descriptions.',\n\t\t\tannotations: {\n\t\t\t\treadOnlyHint: true,\n\t\t\t},\n\t\t},\n\t\tasync () => {\n\t\t\tconst components = await getComponents();\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\ttext: formatComponents( components ),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t}\n\t);\n}\n"],
4
+ "sourcesContent": ["import type { McpServer } from '@modelcontextprotocol/server';\nimport { getComponents } from '../data.ts';\nimport { formatComponents } from '../format.ts';\n\n/**\n * Register the get_components tool.\n *\n * @param server - The MCP server instance.\n */\nexport function register( server: McpServer ): void {\n\tserver.registerTool(\n\t\t'get_components',\n\t\t{\n\t\t\ttitle: 'Get Components',\n\t\t\tdescription:\n\t\t\t\t'Get a list of all available WordPress Design System components with their package names and descriptions.',\n\t\t\tannotations: {\n\t\t\t\treadOnlyHint: true,\n\t\t\t},\n\t\t},\n\t\tasync () => {\n\t\t\tconst components = await getComponents();\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\ttext: formatComponents( components ),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t}\n\t);\n}\n"],
5
5
  "mappings": ";AACA,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AAO1B,SAAS,SAAU,QAA0B;AACnD,SAAO;AAAA,IACN;AAAA,IACA;AAAA,MACC,OAAO;AAAA,MACP,aACC;AAAA,MACD,aAAa;AAAA,QACZ,cAAc;AAAA,MACf;AAAA,IACD;AAAA,IACA,YAAY;AACX,YAAM,aAAa,MAAM,cAAc;AACvC,aAAO;AAAA,QACN,SAAS;AAAA,UACR;AAAA,YACC,MAAM;AAAA,YACN,MAAM,iBAAkB,UAAW;AAAA,UACpC;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/tools/get-design-tokens.ts"],
4
- "sourcesContent": ["import type { McpServer } from '@modelcontextprotocol/server';\nimport { getDesignTokens } from '../data';\n\n/**\n * Register the get_design_tokens tool.\n *\n * @param server - The MCP server instance.\n */\nexport function register( server: McpServer ): void {\n\tserver.registerTool(\n\t\t'get_design_tokens',\n\t\t{\n\t\t\ttitle: 'Get Design Tokens',\n\t\t\tdescription:\n\t\t\t\t'Get the WordPress Design System design tokens reference (colors, spacing, typography, motion, etc.).',\n\t\t\tannotations: {\n\t\t\t\treadOnlyHint: true,\n\t\t\t},\n\t\t},\n\t\tasync () => {\n\t\t\tconst tokens = await getDesignTokens();\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\ttext: tokens.content,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t}\n\t);\n}\n"],
4
+ "sourcesContent": ["import type { McpServer } from '@modelcontextprotocol/server';\nimport { getDesignTokens } from '../data.ts';\n\n/**\n * Register the get_design_tokens tool.\n *\n * @param server - The MCP server instance.\n */\nexport function register( server: McpServer ): void {\n\tserver.registerTool(\n\t\t'get_design_tokens',\n\t\t{\n\t\t\ttitle: 'Get Design Tokens',\n\t\t\tdescription:\n\t\t\t\t'Get the WordPress Design System design tokens reference (colors, spacing, typography, motion, etc.).',\n\t\t\tannotations: {\n\t\t\t\treadOnlyHint: true,\n\t\t\t},\n\t\t},\n\t\tasync () => {\n\t\t\tconst tokens = await getDesignTokens();\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\ttext: tokens.content,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t}\n\t);\n}\n"],
5
5
  "mappings": ";AACA,SAAS,uBAAuB;AAOzB,SAAS,SAAU,QAA0B;AACnD,SAAO;AAAA,IACN;AAAA,IACA;AAAA,MACC,OAAO;AAAA,MACP,aACC;AAAA,MACD,aAAa;AAAA,QACZ,cAAc;AAAA,MACf;AAAA,IACD;AAAA,IACA,YAAY;AACX,YAAM,SAAS,MAAM,gBAAgB;AACrC,aAAO;AAAA,QACN,SAAS;AAAA,UACR;AAAA,YACC,MAAM;AAAA,YACN,MAAM,OAAO;AAAA,UACd;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/tools/index.ts"],
4
- "sourcesContent": ["import type { McpServer } from '@modelcontextprotocol/server';\nimport { register as getComponents } from './get-components';\nimport { register as getComponentDetails } from './get-component-details';\nimport { register as getDesignTokens } from './get-design-tokens';\n\n/**\n * Register all MCP tools on the server.\n *\n * @param server - The MCP server instance.\n */\nexport function registerTools( server: McpServer ): void {\n\tgetComponents( server );\n\tgetComponentDetails( server );\n\tgetDesignTokens( server );\n}\n"],
4
+ "sourcesContent": ["import type { McpServer } from '@modelcontextprotocol/server';\nimport { register as getComponents } from './get-components.ts';\nimport { register as getComponentDetails } from './get-component-details.ts';\nimport { register as getDesignTokens } from './get-design-tokens.ts';\n\n/**\n * Register all MCP tools on the server.\n *\n * @param server - The MCP server instance.\n */\nexport function registerTools( server: McpServer ): void {\n\tgetComponents( server );\n\tgetComponentDetails( server );\n\tgetDesignTokens( server );\n}\n"],
5
5
  "mappings": ";AACA,SAAS,YAAY,qBAAqB;AAC1C,SAAS,YAAY,2BAA2B;AAChD,SAAS,YAAY,uBAAuB;AAOrC,SAAS,cAAe,QAA0B;AACxD,gBAAe,MAAO;AACtB,sBAAqB,MAAO;AAC5B,kBAAiB,MAAO;AACzB;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- import type { Component, ComponentDetail } from './types';
1
+ import type { Component, ComponentDetail } from './types.ts';
2
2
  /**
3
3
  * Clear cached data. Intended for testing.
4
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAqB,MAAM,SAAS,CAAC;AAa7E;;GAEG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAGjC;AAsCD;;;;GAIG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAE,SAAS,EAAE,CAAE,CAG5D;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACvC,IAAI,EAAE,MAAM,GACV,OAAO,CAAE,eAAe,GAAG,IAAI,CAAE,CAGnC;AAED;;;;GAIG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAE,CAatE"}
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAqB,MAAM,YAAY,CAAC;AAahF;;GAEG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAGjC;AAsCD;;;;GAIG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAE,SAAS,EAAE,CAAE,CAG5D;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACvC,IAAI,EAAE,MAAM,GACV,OAAO,CAAE,eAAe,GAAG,IAAI,CAAE,CAGnC;AAED;;;;GAIG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAE,CAatE"}
@@ -1,4 +1,4 @@
1
- import type { Component, ComponentDetail } from './types';
1
+ import type { Component, ComponentDetail } from './types.ts';
2
2
  /**
3
3
  * Format the component list as markdown.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAuB1D;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAE,UAAU,EAAE,SAAS,EAAE,GAAI,MAAM,CAQlE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAE,MAAM,EAAE,eAAe,GAAI,MAAM,CA6CvE"}
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAuB7D;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAE,UAAU,EAAE,SAAS,EAAE,GAAI,MAAM,CAQlE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAE,MAAM,EAAE,eAAe,GAAI,MAAM,CA6CvE"}
@@ -1,4 +1,4 @@
1
1
  import { McpServer } from '@modelcontextprotocol/server';
2
- export { parseComponents, parseComponentDetail } from './parse-components';
2
+ export { parseComponents, parseComponentDetail } from './parse-components.ts';
3
3
  export declare function createServer(): McpServer;
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAGzD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE3E,wBAAgB,YAAY,cAkB3B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAGzD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE9E,wBAAgB,YAAY,cAkB3B"}
@@ -1,4 +1,4 @@
1
- import type { Component, ComponentDetail, ComponentProp, ManifestComponent } from './types';
1
+ import type { Component, ComponentDetail, ComponentProp, ManifestComponent } from './types.ts';
2
2
  /**
3
3
  * Derive the npm package name from the story file path.
4
4
  *
@@ -1 +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,IAAI,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACxC,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"}
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,YAAY,CAAC;AAuCpB;;;;;;;;;;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,IAAI,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACxC,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/design-system-mcp",
3
- "version": "0.10.0",
3
+ "version": "0.11.2-next.v.202608281122.0",
4
4
  "description": "MCP server for the WordPress Design System.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -52,5 +52,5 @@
52
52
  "publishConfig": {
53
53
  "access": "public"
54
54
  },
55
- "gitHead": "989764d42ff93e33684aaf0b96a5b7f3d9bbff52"
55
+ "gitHead": "de479d415171765f7b573c81aeec5334ff506a12"
56
56
  }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=data.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/test/data.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=format.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/test/format.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=parse-components.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse-components.d.ts","sourceRoot":"","sources":["../../src/test/parse-components.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=get-component-details.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-component-details.d.ts","sourceRoot":"","sources":["../../../src/tools/test/get-component-details.ts"],"names":[],"mappings":""}