-
Notifications
You must be signed in to change notification settings - Fork 625
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
feat: add mcp package #6222
Conversation
|
size-limit report 📦
|
There was a problem hiding this 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", |
There was a problem hiding this comment.
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.
"bin": "./dist/stdio.js", | |
"bin": "./dist/transports/stdio.js", |
Copilot uses AI. Check for mistakes.
@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. |
@kendallgassner sounds great to me! Would love to chat about it 😄 |
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
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 Primerget_component
: used to get the documentation for a specific componentget_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 Primerget_pattern
: used to get the docs for a specific patternget_tokens
: used to get a list of design tokensget_*_usage
: used to get usage guidelines for foundationsBelow 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 Primersuggest_design_token
: suggest what design token to use for a specific usageFinally, 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
@primer/mcp
packageChanged
Removed
Rollout strategy
This is an internal package for now