MCP server

Help AI agents use Primer correctly with the Primer Model Context Protocol server.

The Primer MCP server (@primer/mcp) helps AI agents understand and use Primer’s design system correctly.

The @primer/mcp package provides a local (stdio) server that connects AI tools to Primer design tokens, components, patterns, icons, and more. It can be run in your local development environment or set up in tools like GitHub Actions for AI agents.

What it provides

The server exposes a set of tools that AI agents can call:

ToolWhat it does
initSets up or creates a project that includes Primer React.
list_componentsLists the components available from Primer React.
get_componentGets API information for a Primer React component.
get_component_examplesGets examples for how to use a Primer React component.
get_component_usage_guidelinesGets usage guidance for a Primer component.
get_component_accessibility_guidelinesGets accessibility guidance for a Primer component.
list_patternsLists available Primer patterns.
get_patternGets guidance for a Primer pattern.
find_tokensFinds Primer design tokens by intent or value.
get_token_group_bundleGets bundled token data for a token group.
get_design_token_specsGets design token specifications.
get_token_usage_patternsGets guidance for using Primer design tokens.
lint_cssChecks CSS for Primer token usage.
get_color_usageGets guidance for applying color to a user interface.
get_typography_usageGets guidance for applying typography to a user interface.
list_iconsLists the icons available from Primer Octicons React.
get_iconGets a specific Octicon by name.
primer_coding_guidelinesGets guidance for writing code that uses Primer or for UI code that you are creating.
review_alt_textEvaluates image alt text against accessibility best practices and context relevance.

Set up in VS Code

To use @primer/mcp in VS Code, install the server from the Command Palette:

  1. Open the Command Palette (Cmd/Ctrl+Shift+P).
  2. Type MCP: Install Server and select it.
  3. Select the stdio type.
  4. Enter npx @primer/mcp@latest.
  5. Enter Primer for the server name.

Your MCP server configuration should look like:

{
  "servers": {
    "Primer": {
      "type": "stdio",
      "command": "npx",
      "args": ["@primer/mcp@latest"]
    }
  },
  "inputs": []
}

Set up in other clients

GitHub Copilot CLI supports a similar stdio configuration in either .mcp.json or .github/mcp.json:

{
  "mcpServers": {
    "Primer": {
      "type": "stdio",
      "command": "npx",
      "args": ["@primer/mcp@latest"]
    }
  }
}

Other stdio-enabled MCP clients can use the same npx @primer/mcp@latest server command in their own configuration format. Refer to the package README for the latest configuration details.