Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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)

Aperta Adatta ai principianti
#8,561 3 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@Pranay623 ci sta già lavorando.

Dal 19/10/2026.

  • #8582 di @Pranay623 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
node.js, typescript
Ambito
tooling

Direzione di ricerca

I due URL vengono costruiti in packages/mcp/src/server.ts, nel handler get_component_examples (intorno a L256) e nel handler get_component_accessibility_guidelines (intorno a L390), e usano entrambi match.id. Confrontali con l'handler usage-guidelines, che usa già match.slug. Avvia il server MCP e chiama entrambi i tool con name TextInput. È completato quando entrambi restituiscono la pagina di TextInput invece della home page, e Button continua a funzionare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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/[email protected] 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)

Lingua principale
TypeScript
Stelle
3.9k
Fork
705
Merge medio
3g 18h
PR unite (30g)
47

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di primer/react

Tutte le issue di primer/react

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.