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)
维护者通常 2 天内回复
@bindu-yogesh 已经在做这个了。
开始于 2026年10月17日。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 82/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- node.js, typescript
- 领域
- tooling
调研方向
两个 URL 在 packages/mcp/src/server.ts 中构建,分别位于 get_component_examples 处理程序(约 L256)和 get_component_accessibility_guidelines 处理程序(约 L390),两者都使用 match.id。请与已经使用 match.slug 的 usage-guidelines 处理程序进行比较。运行 MCP 服务器,并以 name 为 TextInput 调用这两个工具。当两者都返回 TextInput 页面而非首页,且 Button 仍然正常工作时,即完成。
由索引模型根据 Issue 内容生成。
描述
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
- Run
npx @primer/[email protected]and connect an MCP client. - Call
get_component_accessibility_guidelineswith{"name": "TextInput"}. - The text starts with the Primer home page ("The design system for GitHub") instead of the TextInput accessibility page.
- Call
get_component_exampleswith{"name": "TextInput"}: same result. {"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)
- 主要语言
- TypeScript
- 星标
- 3.9k
- 派生
- 697
- 平均合并
- 3 天 21 小时
- 30 天内合并 PR
- 51
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
primer/react 的其他 Issue
-
PageHeader.Title does not seem to accept id prop可能已有人在做 @TylerJDev 于 6 天前认领。 未关闭component: PageHeader react staff
难度 2/5 1-3 小时 新手友好度 72/100
primer/react#8474 · 1 条评论 · 1 个 reaction · 已指派 1 人 ·
维护者通常 2 天内回复
-
The padding prop seems to have no effect with PageLayout.Sidebar可能已有人在做 @minwookshin 于 18 天前认领。 未关闭component: PageLayout react staff
难度 2/5 1-3 小时 新手友好度 68/100
primer/react#8470 · 1 条评论 · 1 个 reaction ·
维护者通常 2 天内回复
-
bug component: Spinner react
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 2 天内回复
-
waiting for author response
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 2 天内回复
-
Checkbox: replace useLayoutEffect with ref callback for indeterminate prop可能重新可做 关联的 PR 已关闭且未合并。 未关闭component: Checkbox react
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
相似的 Issue
-
"Contains" page watch never matches when its text has a trailing space可能已有人在做 @RaphaelFakhri 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 77/100
CopilotKit/openmuse#184 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 67/100
bootstrap-vue-next/bootstrap-vue-next#3357 ·
维护者通常 1 天内回复
-
[quality] tide.ts: six mutation survivors in the merge-queue gate, draft refusal, fork-403 workflow-file diagnosis and getPull's fork flag are unpinned by any test可能已有人在做 @hivecommons-hive 今天认领。 未关闭agent/quality needs-kind stage/040-covered-by-pr testing
难度 2/5 1-3 小时 新手友好度 68/100
cncf/prow-github-actions#517 · 1 条评论 ·
维护者通常 2 天内回复
-
Unsampled pageload span is profiled when profileLifecycle is 'trace' (browser UI profiling)可能已有人在做 @Jxxunnn 今天认领。 未关闭Browser Waiting for: Product Owner
难度 2/5 1-3 小时 新手友好度 82/100
getsentry/sentry-javascript#25497 · 1 条评论 ·
维护者通常 1 天内回复