Skip to content

feat(mcp): Replace design token tools with enhanced search and bundle system#7574

Merged
lukasoppermann merged 13 commits intomainfrom
mcp-design-tokens-update
Feb 24, 2026
Merged

feat(mcp): Replace design token tools with enhanced search and bundle system#7574
lukasoppermann merged 13 commits intomainfrom
mcp-design-tokens-update

Conversation

@lukasoppermann
Copy link
Contributor

@lukasoppermann lukasoppermann commented Feb 20, 2026

Summary

Replaces the single list_tokens tool in the MCP server with four new design token tools that provide better token discovery and usage guidance.

New tools

Tool Purpose
find_tokens Keyword search with group filtering and alias resolution
get_token_group_bundle Fetch tokens across multiple groups in one call
get_design_token_specs Logic matrix, color pairings, and group reference
get_token_usage_patterns Golden example CSS for buttons and layouts

Changes to primitives.ts

  • Token spec parsing from DESIGN_TOKENS_SPEC.md
  • Group alias mapping for fuzzy/human-readable group names (e.g. "background" → bgColor)
  • Token pattern expansion (e.g. [accent, danger] variants)
  • Formatted Markdown bundle output
  • Graceful fallback when primitives files (radius.json, DESIGN_TOKENS_SPEC.md, DESIGN_TOKENS_GUIDE.md) are not yet available

What's unchanged

All non-design-token tools remain untouched: components, patterns, icons, foundations, coding guidelines, and accessibility.

Integration tests

Integration tests skipped: MCP-only changes in this PR

lukasoppermann and others added 2 commits February 20, 2026 13:15
… system

Replace the single list_tokens tool with four new design token tools:
- find_tokens: keyword search with group filtering and alias resolution
- get_token_group_bundle: fetch tokens across multiple groups in one call
- get_design_token_specs: logic matrix, color pairings, and group reference
- get_token_usage_patterns: golden example CSS for buttons and layouts

Add comprehensive token guidelines support in primitives.ts including:
- Token spec parsing from DESIGN_TOKENS_SPEC.md
- Group alias mapping for fuzzy/human-readable group names
- Token pattern expansion (e.g., [accent, danger] variants)
- Formatted Markdown bundle output
- Graceful fallback when primitives files are not yet available

All non-design-token tools (components, patterns, icons, foundations,
coding guidelines, accessibility) remain unchanged.

Co-authored-by: Copilot <[email protected]>
@lukasoppermann lukasoppermann requested a review from a team as a code owner February 20, 2026 12:20
@changeset-bot
Copy link

changeset-bot bot commented Feb 20, 2026

🦋 Changeset detected

Latest commit: 294ce2a

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

This comment was marked as outdated.

Copy link
Contributor

Copilot AI commented Feb 20, 2026

@lukasoppermann I've opened a new pull request, #7575, to work on those changes. Once the pull request is ready, I'll request review from you.

…text (#7575)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: lukasoppermann <[email protected]>
lukasoppermann and others added 2 commits February 20, 2026 15:05
listTokenGroups() was only reading categories.functional.themes.light,
which omitted non-theme groups like stack, text, borderRadius, borderWidth,
outline, spinner, etc. Now uses the full tokens array so get_design_token_specs
provides a complete group map.

Co-authored-by: Copilot <[email protected]>
The description documents group-only mode (omit query, provide only group),
but query was required in the schema, causing validation failure. Now
optional with empty string default.

Co-authored-by: Copilot <[email protected]>
@github-actions github-actions bot requested a deployment to storybook-preview-7574 February 20, 2026 14:13 Abandoned
Copy link
Member

@siddharthkp siddharthkp left a comment

Choose a reason for hiding this comment

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

I have no idea what this means but I believe in you

Store canonical group prefix (e.g. 'bgColor') in token.group instead of
human-readable label (e.g. 'background color'). Add GROUP_LABELS map for
display purposes in formatBundle headers. This makes group filtering,
valid-groups messaging, and tokenMatchesGroup comparisons consistent.

No behavior change: GROUP_ALIASES still resolves human-readable inputs
before any matching occurs.

Co-authored-by: Copilot <[email protected]>

This comment was marked as outdated.

@github-actions github-actions bot requested a deployment to storybook-preview-7574 February 23, 2026 19:15 Abandoned
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

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

@github-actions github-actions bot requested a deployment to storybook-preview-7574 February 23, 2026 19:25 Abandoned
@primer
Copy link
Contributor

primer bot commented Feb 23, 2026

🤖 Lint issues have been automatically fixed and committed to this PR.

@lukasoppermann lukasoppermann added the integration-tests: skipped manually Changes in this PR do not require an integration test label Feb 24, 2026
@lukasoppermann lukasoppermann added this pull request to the merge queue Feb 24, 2026
Merged via the queue into main with commit 14c5a6c Feb 24, 2026
57 checks passed
@lukasoppermann lukasoppermann deleted the mcp-design-tokens-update branch February 24, 2026 08:05
@primer primer bot mentioned this pull request Feb 23, 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.

4 participants