Skip to content

Conversation

@adierkens
Copy link
Contributor

@adierkens adierkens commented Feb 2, 2026

With the new evals framework, we discovered that the existing Primer MCP tools for getting component documentation was insufficient. It would include HTML fragments, confusing formatting and other results that skewed the effectiveness. In one example it couldn't find the import path for a component via the docs.

Running our evals framework for Primer experience generation with and without the new endpoint enabled, we see a 5x reduction in token usage for much more actionable content.

Changelog

New

  • Expands the MCP tool to include pulling in content via the <component>/llms.txt endpoint. This is intended to serve as a more concise summary of the component documentation, tailed specifically for agent consumption.

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

@changeset-bot
Copy link

changeset-bot bot commented Feb 2, 2026

🦋 Changeset detected

Latest commit: f873384

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/mcp Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for fetching component documentation via a new /llms.txt endpoint in the MCP (Model Context Protocol) server, which is designed to provide more concise, AI-agent-friendly documentation compared to the existing HTML-based approach.

Changes:

  • Added fetch logic for the /llms.txt endpoint with automatic fallback to the existing documentation approach
  • Modified the error response structure for the component-not-found case to use isError and errorMessage fields
  • Added a changeset documenting this as a minor release

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/mcp/src/server.ts Adds /llms.txt endpoint fetch logic with fallback mechanism and changes error response structure
.changeset/gold-snakes-smash.md Documents the change as a minor release with appropriate description

Comment on lines 113 to +117
return {
content: [
{
type: 'text',
text: `There is no component named \`${name}\` in the @primer/react package. For a full list of components, use the \`list_components\` tool.`,
},
],
isError: true,
errorMessage: `There is no component named \`${name}\` in the @primer/react package. For a full list of components, use the \`list_components\` tool.`,
content: [],
}
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error response structure using isError and errorMessage is inconsistent with the rest of the codebase. All other error cases in this file (e.g., get_component_examples at lines 186-194, get_component_usage_guidelines at lines 246-254) return error messages within the standard content array structure. This change breaks that established pattern.

Consider changing this to match the existing pattern by returning the error message in a content array instead of using isError and errorMessage fields.

Copilot uses AI. Check for mistakes.
@adierkens adierkens added the integration-tests: skipped manually Changes in this PR do not require an integration test label Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: skipped manually Changes in this PR do not require an integration test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants