Skip to content

feat: add mcp package #6222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Aug 6, 2025
Merged

feat: add mcp package #6222

merged 15 commits into from
Aug 6, 2025

Conversation

joshblack
Copy link
Member

@joshblack joshblack commented Jun 19, 2025

Pitch: https://github.com/github/primer/issues/5363

Add an experimental @primer/mcp package that could be used in any context where MCPs are supported. This package runs a server that exposes the following tools:

  • get_components: used to discover what components are available from Primer
  • get_component: used to get the documentation for a specific component
  • get_component_examples: used to get the examples for a specific component (specifically storybook examples around usage)
  • get_patterns: used to discover pattern guidance that is available from Primer
  • get_pattern: used to get the docs for a specific pattern
  • get_tokens: used to get a list of design tokens
  • get_*_usage: used to get usage guidelines for foundations

Below is a quick demo showing an idea of someone might interact with it in agent mode (or could be used by the Copilot agent directly)

Screen.Recording.2025-06-19.at.2.58.18.PM.mov

In the future, it would be awesome to include support for:

  • init: setup a project that uses Primer
  • suggest_design_token: suggest what design token to use for a specific usage
  • General migration feedback, including tables and tools (like eslint autofixers) to use to help move to new

Finally, it would be great to have a demo showing how this will help an agent get more context in order to use Primer more effectively.

Changelog

New

  • Add @primer/mcp package

Changed

Removed

Rollout strategy

  • None; if selected, include a brief description as to why

This is an internal package for now

Copy link

changeset-bot bot commented Jun 19, 2025

⚠️ No Changeset found

Latest commit: 9f60fef

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@github-actions github-actions bot added the staff Author is a staff member label Jun 19, 2025
@joshblack joshblack added the skip changeset This change does not need a changelog label Jun 19, 2025
Copy link
Contributor

github-actions bot commented Jun 19, 2025

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 90.2 KB (0%)
packages/react/dist/browser.umd.js 90.38 KB (0%)

@github-actions github-actions bot temporarily deployed to storybook-preview-6222 June 19, 2025 20:00 Inactive
@github-actions github-actions bot requested a deployment to storybook-preview-6222 June 19, 2025 20:08 Abandoned
@github-actions github-actions bot temporarily deployed to storybook-preview-6222 June 19, 2025 20:22 Inactive
@github-actions github-actions bot requested a deployment to storybook-preview-6222 August 6, 2025 18:11 Abandoned
@github-actions github-actions bot requested a deployment to storybook-preview-6222 August 6, 2025 18:20 Abandoned
@github-actions github-actions bot temporarily deployed to storybook-preview-6222 August 6, 2025 18:30 Inactive
@joshblack joshblack marked this pull request as ready for review August 6, 2025 18:52
@Copilot Copilot AI review requested due to automatic review settings August 6, 2025 18:52
@joshblack joshblack requested a review from a team as a code owner August 6, 2025 18:52
@joshblack joshblack requested a review from hectahertz August 6, 2025 18:52
Copy link
Contributor

@Copilot 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 the @primer/mcp package - an experimental MCP (Model Context Protocol) server that exposes Primer design system components, patterns, and design tokens to AI tools. The server provides various tools for AI agents to discover and get documentation about Primer components, patterns, and design tokens.

Key changes:

  • Added a complete MCP server implementation with tools for components, patterns, and design tokens
  • Integrated with existing Primer documentation by fetching and converting HTML content
  • Created build and packaging configuration for the new npm workspace

Reviewed Changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/mcp/package.json Package configuration and dependencies for the MCP server
packages/mcp/src/server.ts Main server implementation with all MCP tools
packages/mcp/src/primer.ts Data structures and functions for Primer components and patterns
packages/mcp/src/transports/stdio.ts Entry point for stdio transport
packages/mcp/tsconfig.json TypeScript configuration
packages/mcp/tsconfig.build.json Build-specific TypeScript configuration
packages/mcp/rollup.config.js Rollup bundling configuration
packages/mcp/README.md Documentation for the MCP package
package.json Root workspace configuration update

"version": "0.0.0",
"private": true,
"type": "module",
"bin": "./dist/stdio.js",
Copy link
Preview

Copilot AI Aug 6, 2025

Choose a reason for hiding this comment

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

The bin field points to ./dist/stdio.js but the rollup config outputs the file as ./dist/transports/stdio.js based on the input path. This mismatch will prevent the binary from being found.

Suggested change
"bin": "./dist/stdio.js",
"bin": "./dist/transports/stdio.js",

Copilot uses AI. Check for mistakes.

@kendallgassner
Copy link
Contributor

kendallgassner commented Aug 6, 2025

@joshblack I am currently working on tracking how copilot Padawan does at fixing axe scanning violations and have noticed that is awful at fixing violations that use Primer components.

I would love to setup some time to talk through this idea with you. Maybe we can test how this works with resolving axe scanning issues.

@joshblack
Copy link
Member Author

@kendallgassner sounds great to me! Would love to chat about it 😄

@github-actions github-actions bot requested a deployment to storybook-preview-6222 August 6, 2025 20:46 Abandoned
@github-actions github-actions bot temporarily deployed to storybook-preview-6222 August 6, 2025 20:54 Inactive
@github-actions github-actions bot requested a deployment to storybook-preview-6222 August 6, 2025 21:00 Abandoned
@joshblack joshblack added this pull request to the merge queue Aug 6, 2025
Merged via the queue into main with commit 82ab383 Aug 6, 2025
43 checks passed
@joshblack joshblack deleted the feat/add-mcp-server branch August 6, 2025 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip changeset This change does not need a changelog staff Author is a staff member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants