Skip to content

MCP: get_component_examples and get_component_accessibility_guidelines still use the component id instead of the slug (home page returned for multi-word components) #8561

Closed

Description

@iamamy26

Description

get_component_examples and get_component_accessibility_guidelines build the primer.style URL from the component id (for example text_input) instead of its slug (text-input). For multi-word components the wrong path does not 404: primer.style answers HTTP 200 with the home page, so both tools return the home page as if it were the component's examples or accessibility guidance.

#8530 fixed the same problem for get_component_usage_guidelines; these two calls were not changed. On main (e236683):

  • L256 get_component_examples: new URL(`/product/components/${match.id}`, ...)
  • L390 get_component_accessibility_guidelines: new URL(`/product/components/${match.id}/accessibility`, ...)

get_component (L141) and the usage tool after #8530 (L317) already use match.slug.

In @primer/react/generated/components.json, 43 of 80 component ids contain an underscore (action_list, icon_button, text_input, ...), so these two tools fail for about half of the components.

Suggested fix: use match.slug in both places. Because a wrong path returns 200, a guard on the response (for example, checking that the fetched page title names the component) would also catch future id/slug mismatches.

Steps to reproduce

  1. Run npx @primer/mcp@1.1.0 and connect an MCP client.
  2. Call get_component_accessibility_guidelines with {"name": "TextInput"}.
  3. The text starts with the Primer home page ("The design system for GitHub") instead of the TextInput accessibility page.
  4. Call get_component_examples with {"name": "TextInput"}: same result.
  5. {"name": "Button"} works, because its id and slug are the same.

Direct check: https://primer.style/product/components/text_input/accessibility returns <title>Primer</title>, while https://primer.style/product/components/text-input/accessibility/ returns <title>Accessibility - TextInput | Primer</title>.

Version

@primer/mcp 1.1.0 from npm (it also still has the usage-guidelines bug fixed in #8530, so a release would help). Source checked against main at e236683 on 2026-10-16.

Browser

N/A (MCP server on Node.js)

Activity

  1. Pranay623 commented on Oct 16, 2026

    @Pranay623
    Contributor

    @iamamy26 can you please assign this issue to me

  2. bindu-yogesh commented on Oct 17, 2026

    @bindu-yogesh

    Hi, I'd like to work on this issue.

    I'm interested in investigating why get_component_examples and get_component_accessibility_guidelines use component IDs instead of slugs for multi-word component names. I'd like to trace the issue, implement a fix, and add tests to prevent regressions.

    Could you please assign this issue to me? I'm happy to submit a PR once the fix is ready. Thank you!

  3. siddharthkp commented on Oct 19, 2026

    @siddharthkp
    Member

    @Pranay623 Because you asked first, feel free to go for it!

  4. added theissue type on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions