Skip to content

Design System MCP: Add get_guidance tool and routing hints - #85203

Closed
simison wants to merge 3 commits into
trunkfrom
simison/design-system-mcp-guidance
Closed

simison wants to merge 3 commits into
trunkfrom
simison/design-system-mcp-guidance

Conversation

@simison

@simison simison commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Expose usage guidelines, best practices and migration guides from the Storybook docs (attached component docs plus the standalone docs manifest), and point to them from the tool descriptions and server instructions.

Just an initial pass with AI, likely needing refinement.

Related to surfacing patterns #82547

What?

  • A new get_guidance tool. With no argument it lists every page, with its id, title, summary and attached components. With a page id, title or component name (such as Button) it returns the page as markdown.
  • Pages attached to a component, like usage-guidelines.mdx, come from components.json. Standalone pages come from manifests/docs.json.
  • parse-guidance.ts converts MDX to markdown. It drops imports, <Meta> and <Canvas>, unwraps <Markdown>{…}</Markdown> blocks, and turns ?path=/docs/… links into plain text.
  • The server instructions and the descriptions of get_components, get_component_details and get_design_tokens now point agents to get_guidance for choosing between similar components, or migrating components.

Why?

  • Include more "design guidance" in MCP; currently it includes mostly mechanical technical documentation, but no guidance on how to use those components in a sensible way.
  • In future we'll expand the design guidance in such way that it becomes easier for agents to build "the right way" using the design system, as well as agents reviewing PRs will catch issues easier.

How?

I'm taking inspiration from Storybook's own MCP, which gave the idea to add a summary to <Meta> so that agents can pick a page from a list without reading all of it, and to publish a docs manifest (manifests/docs.json) alongside the components manifest. Storybook marks the docs manifest schema as preview and not yet stable, so it may change.

The idea of a separate guidance tool comes from the Visa design system MCP, which pairs component tools with parallel guidelines tools. Muibook Guidelines is another example of a guidelines-focused server.

I also looked at Shopify's Polaris tooling and Google's Material Design MCP for some ideas. Got the idea for the existing tool descriptions and server instructions pointing agents to get_guidance from them.

Testing Instructions

WIP

Testing Instructions for Keyboard

Use of AI Tools

yep!

@simison simison added [Status] In Progress Tracking issues with work in progress [Package] Design System MCP /packages/design-system-mcp labels Oct 20, 2026
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground

🏷️ Labels

This pull request needs exactly one label indicating its type, and has 0.

  • Required: any label starting with [Type].
  • Found: none.

Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you.

📦 Bundle size

Size Change: 0 B

Total Size: 8.56 MB

f409777 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 6b2e422 trunk % Change
timeToFirstByte 45.05 ms +15.54% -5.33% 43.7 ms +5.15% -4.58% 3.09%
largestContentfulPaint 74 ms +10.81% -2.7% 76 ms +0% -5.26% -2.63%
lcpMinusTtfb 27.7 ms +21.84% -4.69% 31.75 ms +9.92% -14.8% -12.76%
wpBeforeTemplate 23.54 ms +17.16% -5.44% 22.68 ms +7.72% -2.65% 3.79%
wpTemplate 17.56 ms +8.09% -5.52% 17.02 ms +5.23% -4.41% 3.17%
wpTotal 41.44 ms +15.61% -5.33% 40.37 ms +5.4% -4.83% 2.65%
wpMemoryUsage 7.70 MB +0% -0% 7.67 MB +0% -0% 0.43%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric 6b2e422 trunk % Change
timeToFirstByte 36.2 ms +9.81% -1.52% 36.5 ms +4.38% -2.6% -0.82%
largestContentfulPaint 80 ms +5% -0% 80 ms +2.5% -0% 0%
lcpMinusTtfb 44.35 ms +2.03% -0.9% 44 ms +1.93% -2.5% 0.8%
wpBeforeTemplate 19.6 ms +7.86% -2.14% 19.85 ms +2.97% -2.37% -1.26%
wpTemplate 13.73 ms +2.69% -1.46% 13.55 ms +3.25% -4.06% 1.33%
wpTotal 33.4 ms +10.63% -1.98% 33.54 ms +4.56% -3.1% -0.42%
wpMemoryUsage 6.39 MB +0% -0% 6.36 MB +0% -0% 0.53%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric 6b2e422 trunk % Change
mediaProcessingJpeg 324.76 ms +5.65% -0.39% 335.4 ms +1.65% -0.82% -3.17%
mediaProcessingAvif 4866.63 ms +0.94% -0.16% 4868.91 ms +0.67% -0.19% -0.05%
mediaProcessingJpegToAvif 3404.94 ms +0.13% -0.23% 3412.34 ms +0.49% -0.25% -0.22%

media-upload

Metric 6b2e422 trunk % Change
jpegUploadProcessing 1453.39 ms +0.8% -1.03% 1440.47 ms +0.84% -1.15% 0.9%
pngUploadProcessing 236.85 ms +10.74% -7.98% 229.31 ms +10.54% -2.66% 3.29%
largeJpegUploadProcessing 1422.48 ms +1.04% -0.52% 1421.92 ms +0.46% -0.48% 0.04%
multipleImageUploadProcessing 1526.58 ms +2.47% -1.49% 1513.59 ms +1.19% -1.96% 0.86%

post-editor

Metric 6b2e422 trunk % Change
serverResponse 517.09 ms +4.04% -3.35% 544.76 ms +3.21% -4.97% -5.08%
firstPaint 380.05 ms +30.79% -26.8% 396.14 ms +27.17% -26.44% -4.06%
domContentLoaded 915.63 ms +1.31% -5.32% 899.55 ms +1.41% -2.43% 1.79%
loaded 916.72 ms +1.33% -5.28% 900.84 ms +1.42% -2.44% 1.76%
firstContentfulPaint 531.03 ms +2.26% -7.72% 531.12 ms +1.21% -5.45% -0.02%
firstBlock 3120.15 ms +2.01% -0.56% 3161.59 ms +1.51% -0.78% -1.31%
type 17.59 ms +7.5% -7.5% 18.76 ms +4.37% -6.18% -6.24%
typeWithoutInspector 17.56 ms +3.99% -3.47% 19.03 ms +2.26% -8.67% -7.72%
typeWithTopToolbar 23.7 ms +6.37% -11.98% 28.97 ms +16.33% -9.35% -18.19%
typeContainer 8.4 ms +12.26% -5.6% 9.04 ms +16.04% -7.85% -7.08%
focus 129.55 ms +1.96% -8.75% 125.44 ms +14.72% -6.04% 3.28%
firstFocus 239.15 ms +0% -0% 262.3 ms +0% -0% -8.83%
selectAll 485.62 ms +1.95% -1.84% 520.07 ms +8.64% -1.99% -6.62%
undo 32.17 ms +0.9% -8.98% 33.2 ms +6.96% -6.05% -3.1%
listViewOpen 84.93 ms +13.26% -6.85% 85.33 ms +4.03% -9.5% -0.47%
inserterOpen 43.3 ms +4.18% -8.06% 46.12 ms +11.64% -9.84% -6.11%
inserterHover 11.18 ms +10.29% -8.68% 11.17 ms +12.8% -8.77% 0.09%
inserterSearch 8.96 ms +3.91% -10.71% 7.99 ms +2% -8.26% 12.14%
loadPatterns 662.08 ms +1.88% -8.7% 663.12 ms +9.12% -7.79% -0.16%
wpTotal 506.9 ms +4.19% -3.42% 534.43 ms +3.05% -5.08% -5.15%
wpMemoryUsage 14.75 MB +0% -0% 14.72 MB +0% -0% 0.24%
wpDbQueries 55 +0% -1.82% 55 +0% -1.82% 0%

site-editor

Metric 6b2e422 trunk % Change
serverResponse 278.67 ms +2.9% -8.16% 280.56 ms +4.24% -7.77% -0.67%
firstPaint 211.04 ms +69.45% -10.34% 197.39 ms +13.46% -10.3% 6.92%
domContentLoaded 628.72 ms +3.6% -1.51% 621.06 ms +7.8% -2.41% 1.23%
loaded 630.18 ms +3.53% -1.59% 622.05 ms +7.82% -2.43% 1.31%
firstContentfulPaint 368.39 ms +3.09% -4.77% 361.02 ms +8.53% -4.24% 2.04%
firstBlock 2582.26 ms +7.92% -2.5% 2657.1 ms +5.93% -2.81% -2.82%
type 14.87 ms +5.78% -7.67% 14.07 ms +3.84% -2.27% 5.69%
navigate 108.19 ms +9.16% -6.04% 91.35 ms +14.65% -1.86% 18.43%
loadPatterns 844.98 ms +8.29% -7.42% 807.07 ms +8.19% -7.29% 4.7%
loadPages 968.45 ms +3.62% -2.24% 990 ms +3.3% -5.09% -2.18%
wpTotal 271.73 ms +2.7% -8.35% 273.38 ms +4.31% -7.93% -0.6%
wpMemoryUsage 12.77 MB +0% -0% 12.74 MB +0% -0% 0.24%
wpDbQueries 44.5 +1.12% -1.12% 44.5 +1.12% -1.12% 0%

f409777 Run

🏁 Flaky tests

Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

Custom Completer: should allow option selection via keypress event in /test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js, passed after 2 failed attempts.
Error: apiRequestContext.fetch: socket hang up
Call log:
  - → GET http://localhost:8891/wp-json/wp/v2/users?per_page=100
    - user-agent: Playwright/1.63.0 (x64; ubuntu 24.04) node/24.20 CI/1
    - accept: */*
    - accept-encoding: gzip,deflate,br
    - X-WP-Nonce: 0ab027e52d
    - cookie: wordpress_test_cookie=WP%20Cookie%20check; wordpress_logged_in_da433b7faafd8180ebeb1624ceeeab7e=admin%7C1793365803%7CiefutmDo9kCLNzvJkPkrD7d3Pu8ukaAqjccXEwtWnSb%7C474745e628e8b99541daa4613b2361198c8b3279209816675ac72896381a81db; wp-settings-time-1=1793193159

    at RequestUtils.rest (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/rest.ts:111:39)
    at RequestUtils.listUsers (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/users.ts:34:30)
    at RequestUtils.deleteAllUsers (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/users.ts:106:44)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js:73:22

Undo restores the post selection when another synced entity is loaded (RTC WebSocket) in /test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

  Object {
    "attributeKey": "content",
    "blockIndex": 0,
    "content": "abcdef",
-   "endOffset": 3,
-   "offset": 3,
+   "endOffset": 6,
+   "offset": 6,
  }

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts:363:5
can be converted to a quote in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

@@ -1,9 +1,9 @@
  <!-- wp:quote -->
  <blockquote class="wp-block-quote"><!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
- <li>one</li>
+ <li>ne</li>
  <!-- /wp:list-item -->

  <!-- wp:list-item -->
  <li>two</li>
  <!-- /wp:list-item --></ul>

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:436:52
can randomize the image on the front end in /test/e2e/specs/editor/blocks/gallery.spec.js, passed after 1 failed attempt.
Error: apiRequestContext.fetch: socket hang up
Call log:
  - → GET http://localhost:8889/wp-json/wp/v2/media?per_page=100
    - user-agent: Playwright/1.63.0 (x64; ubuntu 24.04) node/24.20 CI/1
    - accept: */*
    - accept-encoding: gzip,deflate,br
    - X-WP-Nonce: 604f9190e9
    - cookie: wordpress_test_cookie=WP%20Cookie%20check; wordpress_logged_in_23778236db82f19306f247e20a353a99=admin%7C1793365803%7C5UHbTB1ZcgtSvBm75N9zAiZXwXXKTo5pO2fZQyxqB0n%7C687d96bc2dc16ee299e674bf171bb20d54a55a04066f5cdec843aeb9a7bd15c7; wp-settings-time-1=1793193004

    at RequestUtils.rest (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/rest.ts:111:39)
    at RequestUtils.listMedia (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/media.ts:24:30)
    at RequestUtils.deleteAllMedia (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/media.ts:85:27)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/gallery.spec.js:18:22
should format text across blocks in /test/e2e/specs/editor/various/multi-block-selection.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 1
+ Received  + 1

@@ -1,9 +1,9 @@
  Array [
    Object {
      "attributes": Object {
-       "content": "ab",
+       "content": "",
      },
      "name": "core/paragraph",
    },
    Object {
      "attributes": Object {

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/multi-block-selection.spec.js:2219:41
should indent and outdent a list item when its content is fully selected in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 7
+ Received  + 7

  <!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
- <li>a<!-- wp:list -->
- <ul class="wp-block-list"><!-- wp:list-item -->
- <li>b</li>
+ <li></li>
+ <!-- /wp:list-item --></ul>
- <!-- /wp:list-item --></ul>
+ <!-- /wp:list -->
+
- <!-- /wp:list --></li>
- <!-- /wp:list-item --></ul>
+ <!-- wp:paragraph -->
+ <p>b</p>
- <!-- /wp:list -->
+ <!-- /wp:paragraph -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:819:52
should indent with Space and outdent with Shift+Space at the start in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 7
+ Received  + 7

  <!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
- <li>a<!-- wp:list -->
- <ul class="wp-block-list"><!-- wp:list-item -->
- <li>b</li>
+ <li></li>
+ <!-- /wp:list-item --></ul>
- <!-- /wp:list-item --></ul>
+ <!-- /wp:list -->
+
- <!-- /wp:list --></li>
- <!-- /wp:list-item --></ul>
+ <!-- wp:paragraph -->
+ <p> b</p>
- <!-- /wp:list -->
+ <!-- /wp:paragraph -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:875:52
should keep a full selection when outdenting nested items with Shift+Tab in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for locator('role=toolbar[name="Block tools"i]').locator('role=button[name="Indent"]')
    - locator resolved to <button id="_r_1l_" type="button" tabindex="-1" aria-label="Indent" aria-disabled="true" data-toolbar-item="true" data-truly-disabled="false" aria-describedby="components-button__description-26" class="components-button components-toolbar-button is-compact has-icon">…</button>
  - attempting click action
    2 × waiting for element to be visible, enabled and stable
      - element is not enabled
    - retrying click action
    - waiting 20ms
    2 × waiting for element to be visible, enabled and stable
      - element is not enabled
    - retrying click action
      - waiting 100ms
    18 × waiting for element to be visible, enabled and stable
       - element is not enabled
     - retrying click action
       - waiting 500ms

    at Editor.clickBlockToolbarButton (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/editor/click-block-toolbar-button.ts:17:15)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:1166:3
should merge a following sibling list into the outermost list with Delete from a nested item (#77245) in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

@@ -8,11 +8,11 @@
          "innerBlocks": Array [
            Object {
              "innerBlocks": Array [
                Object {
                  "attributes": Object {
-                   "content": "b‸",
+                   "content": "b",
                  },
                  "name": "core/list-item",
                },
              ],
              "name": "core/list",
@@ -25,11 +25,11 @@
    },
    Object {
      "innerBlocks": Array [
        Object {
          "attributes": Object {
-           "content": "1",
+           "content": "‸1",
          },
          "innerBlocks": Array [
            Object {
              "innerBlocks": Array [
                Object {

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:2854:41
should replace selected non-breaking spaces from the toolbar in /test/e2e/specs/editor/various/rich-text.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 1
+ Received  + 1

  Array [
    Object {
      "attributes": Object {
-       "content": "one two three",
+       "content": "ne two three",
      },
      "name": "core/paragraph",
    },
  ]

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/rich-text.spec.js:1050:41
should replace the selection across blocks with an inline image in /test/e2e/specs/editor/various/multi-block-selection.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 1
+ Received  + 1

@@ -1,9 +1,9 @@
  Array [
    Object {
      "attributes": Object {
-       "content": "ab",
+       "content": "b",
      },
      "name": "core/paragraph",
    },
    Object {
      "attributes": Object {

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/multi-block-selection.spec.js:2421:41
should split indented list item in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

@@ -1,8 +1,8 @@
  <!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
- <li>one<!-- wp:list -->
+ <li>ne<!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
  <li>two</li>
  <!-- /wp:list-item -->

  <!-- wp:list-item -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:668:52
should undo without broken temporary state in /test/e2e/specs/editor/blocks/image.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 2
+ Received  + 2

- <!-- wp:image -->
- <figure class="wp-block-image"><img alt=""/></figure>
+ <!-- wp:image {"id":20,"sizeSlug":"full","linkDestination":"none"} -->
+ <figure class="wp-block-image size-full"><img src="http://localhost:8889/wp-content/uploads/2026/10/bb8ba9ab-a548-43c2-a0f8-3d86f30ed0ba.png" alt="" class="wp-image-20"/></figure>
  <!-- /wp:image -->
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/image.spec.js:363:49
should update the URL from the last navigation if only varies in the URL fragment in /test/e2e/specs/interactivity/router-navigate.spec.ts, passed after 1 failed attempt.
Error: expect(locator).toHaveText(expected) failed

Locator:  getByTestId('title')
Expected: "Link 1"
Received: "Main"
Timeout:  5000ms

Call log:
  - Expect "toHaveText" getByTestId('title') with timeout 5000ms
  - waiting for getByTestId('title')
    14 × locator resolved to <h2 data-testid="title">Main</h2>
       - unexpected value "Main"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/interactivity/router-navigate.spec.ts:160:25

f409777 Run

@simison
simison force-pushed the simison/design-system-mcp-guidance branch from dfb9a17 to a41241f Compare October 20, 2026 14:47
@github-actions github-actions Bot added [Package] Components /packages/components [Package] Theme /packages/theme [Package] UI /packages/ui labels Oct 20, 2026
@simison
simison force-pushed the simison/design-system-mcp-guidance branch from 180d291 to 552a617 Compare October 23, 2026 18:11
Expose usage guidelines, best practices and migration guides from the Storybook docs (attached component docs plus the standalone docs manifest), and point to them from the tool descriptions and server instructions.
The summary is included in the Storybook docs manifest, so the design system MCP get_guidance tool can list pages with a description.
@simison
simison force-pushed the simison/design-system-mcp-guidance branch from 552a617 to f409777 Compare October 28, 2026 13:03
@aduth

aduth commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

@simison I have a local branch in progress that looks at exposing these usage guidelines as part of the existing get_component_detail, which feels to me like it might be more appropriate for documentation related to individual components like usage guidelines. What do you think?

I ran into some limitations around the inconsistencies with how we "link" these kinds of documents to components, but that's something we can standardize.

Edit: I see you mentioned the alternative in #84864 (comment) 😄

@simison

simison commented Nov 27, 2026 •

Copy link
Copy Markdown
Member Author

Superseded by #84864

@simison simison closed this Nov 27, 2026
@simison
simison deleted the simison/design-system-mcp-guidance branch November 27, 2026 16:09
@aduth

aduth commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

I don't think #84864 really solved the root issue you were trying to address here, which is that the MCP server doesn't include migration guides or usage guidelines. I created a new issue #87701 to track the remaining work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Components /packages/components [Package] Design System MCP /packages/design-system-mcp [Package] Theme /packages/theme [Package] UI /packages/ui [Status] In Progress Tracking issues with work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants