Skip to main content
Glama

Primitiv

The design system contract keeping teams and agents in sync.

Retrieval gives you data. Reconciliation gives you truth.

The problem

Design-system knowledge is spread across code, Figma, Storybook, and documentation. When those sources drift, people reconcile the differences through experience; AI coding agents often fall back to generic patterns that work but do not belong in the product.

Primitiv gives every agent the same current design context through a machine-readable contract and a read-only MCP interface. It helps agents reuse what exists, follow established decisions, and surface inconsistencies before they ship.

Primitiv runs locally. Your code never leaves your machine.

Related MCP server: uxship

Quick start

Run these commands from your project root:

npx @ai-by-design/primitiv init
npx @ai-by-design/primitiv build
npx @ai-by-design/primitiv serve

init sets up Primitiv for the current project, build creates its design contract, and serve makes that contract available to MCP-compatible agents.

See the Primitiv documentation for installation, configuration, commands, and integration guides.

IMPORTANT

Keep Primitiv configured at project level. A global MCP configuration can serve the wrong project's contract when you switch repositories.

Capabilities

  • Bring design context from your codebase, Figma, and Storybook together

  • Make existing tokens, components, rules, and rationale available to agents

  • Surface conflicts, drift, and hardcoded token misuse

  • Provide read-only access from MCP-compatible agents and editors

  • Verify that the contract stays current in CI

Primitiv also checks local JSX usage against each codebase component's complete finite prop domains. Known out-of-domain values produce a pending within-source conflict, even under auto-resolve. Align the JSX usage or widen the declared domain to resolve it. warn reports these conflicts without blocking; error and verify --strict exit with code 2. Dynamic values and incomplete domains remain unknown.

When component evidence cannot be compared, primitiv verify reports a short diagnostic summary. Use primitiv verify --verbose for the reasons, or --json for a structured report. Diagnostics explain uncertainty and do not count as conflicts or directly fail verification; changes to them can still make the saved contract stale. --fast reports saved diagnostics instead of rebuilding them.

Agents can read diagnostic counts in the MCP summary and paginated details through get_design_context with category: "diagnostics".

Component drift in CI

Run primitiv verify against your saved contract to check declared prop facts, finite variant values, observed JSX values, and component relationships. Verification also compares Storybook default args, story args, and control choices, including mapped values. Story labels and other presentation metadata do not count as API drift. Observations and examples describe static source evidence, not runtime frequency or breaking-change severity.

For example, changing a Button usage from size="sm" to size="lg" is detected even when the number of JSX sites stays the same. Drift messages identify the component ID and field path, such as components/Button and usage.props.size.

Normal verification scans current sources in memory and uses their current conflicts for reporting and governance. Introducing or fixing an out-of-domain JSX value takes effect in verification immediately. The saved contract remains the drift baseline and is never rewritten by verification: run primitiv build to refresh it, then verify again. MCP continues serving the saved contract until it is rebuilt and reloaded.

Failed sources and incomplete or truncated evidence cannot prove that an unavailable fact was removed or that a conflict was resolved. Verification reports available changes and comparison uncertainty. Older contracts remain readable; newly available evidence makes them stale until rebuilt.

Stale evidence exits with code 1, or 2 under --strict. Pending conflicts exit with code 2 under error governance or --strict; warn-only conflicts do not independently fail verification. --fast uses saved findings and file modification times instead of scanning current API evidence, so use normal verification in CI. Use --json for the verification result and --verbose for comparison diagnostic details.

Available Tools

9 tools
find_componentsB
Read-only

Find a bounded component shortlist sorted by exact ID. Filters combine with AND; intents match any by default. Inspect coverage and broaden filters or search unclassified records before concluding no reusable component exists. Continue using nextCursor with the same filters. Read-only.

Inputs: kind, level, limit, scope, +4 more.

get_componentA
Read-only

Look up a component by name or id. Read-only, no side effects. Pass context (your current working file or directory) so same-name components resolve by path scope. Returns the component JSON (with its id) when the lookup resolves to exactly one component, or an error listing available names if not found. Detail is opt-in: pass 'api' for the component's declared prop contract, 'usage' for static JSX-site counts and observed prop values, 'relationships' for sorted outgoing uses and derived incoming usedBy counts, 'conflicts' for bounded source-conflict evidence, or 'all' for every projection. These are static source-site facts, never runtime frequency. When several components share the name and neither governance nor scope decides, returns { ambiguous, matches, instruction } — follow the instruction: match each candidate's rationale.when against the user's intent, and if that doesn't decide, ask the user; never pick arbitrarily. Use this when you need implementation details for a known component to reuse it rather than recreate it. For a list of all components, use get_design_context with category 'components' instead.

Inputs: name (required), limit, detail, offset, +1 more.

get_component_catalogA
Read-only

Inspect component counts, classification coverage, supported discovery filters, source/guidance health, and the loaded snapshot. Read-only. No full name inventory.

Inputs: no named parameters.

get_component_contextA
Read-only

Inspect an exact component ID in the selected snapshot, with API, guidance, relationships and source sections. Follow nextCursor until complete. JSON-fragment continuations must be concatenated in order then JSON-parsed. Observed usage is static evidence; pairings are advisory. Restart discovery after snapshot-changed. Read-only.

Inputs: id (required), snapshotId (required), cursor, sections.

get_conflictsA
Read-only

Get a bounded, repeatable page of design-system conflicts. Read-only, no side effects. Filter by type, status, scope, exact component name or durable component ID, and a structured fieldPath prefix. Use offset and limit for pagination (default 25, maximum 100). For resolved design values, use get_token or get_component instead.

Inputs: type, limit, scope, offset, +3 more.

get_design_contextA
Read-only

Get the resolved design system context before building UI. Read-only, no side effects. Default (no category) returns a JSON summary of token counts, component names, conflict counts, comparison diagnostic counts, and contract metadata. Pass category: 'all' | 'tokens' | 'components' | 'conflicts' | 'diagnostics' to get detail. Pass tokenCategory to filter tokens: colors, spacing, sizes, typography, borderRadius, shadows, zIndex, breakpoints, motion (unknown/aliased categories return an actionable error, not a silent empty result). Use this as the first call to understand what exists. For lookups by name, use get_token or get_component instead.

Inputs: limit, offset, category, tokenCategory.

get_inferred_rulesA
Read-only

Get the design rules inferred from your codebase patterns. Read-only, no side effects. Returns JSON with a list of rules including category, pattern, and confidence, or an error if no rules have been generated yet. Pass category to filter: spacing, colors, typography, borderRadius, naming, components. Omit category to get all. Use this to understand implicit conventions the codebase follows. For explicit design token values, use get_token. For source conflicts, use get_conflicts.

Inputs: category.

get_tokenA
Read-only

Look up a specific design token by name. Read-only, no side effects. Returns the token's name, value, and category, or an error if not found. Pass category to narrow search: colors, spacing, sizes, typography, borderRadius, shadows, zIndex, breakpoints, motion (aliases like 'color'/'radius'/'z-index' are normalized). Omit category to search all. Use this when you know the token name. For a broad overview of all tokens, use get_design_context with category 'tokens' instead.

Inputs: name (required), category.

get_violationsA
Read-only

Get hardcoded token values: literals in source code typed inline instead of referencing a design token, bypassing the contract. Read-only, no side effects. Returns JSON with a count, suggestion-coverage stats, and a list with file:line:column, the captured literal, the surrounding utility (e.g. 'bg-[#ff0000]'), and an optional smart-match suggestion when a contract token has the same value. Pass category to filter: 'all' | 'colors' | 'spacing' (hardcoded values are only detected for these). Call this BEFORE generating UI with literal values — prefer the suggested token over a hardcoded literal. For available tokens to use instead, use get_design_context or get_token.

Inputs: category.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 9 tools

    Disambiguation4/5

    Most tools have distinct purposes, but there are real overlaps: get_component vs get_component_context (both inspect a single component), and get_design_context vs get_component_catalog (both give a system overview). The descriptions mitigate this heavily with explicit cross-references ('for X, use Y instead'), keeping misselection risk low but nonzero.

    Naming Consistency5/5

    Eight of nine tools use a clean get_<noun> pattern (get_component, get_token, get_conflicts, get_violations, get_inferred_rules, get_design_context, get_component_catalog, get_component_context). find_components is the lone deviation, but the search-vs-fetch distinction is meaningful and readable.

    Tool Count5/5

    Nine tools is well-scoped for a read-only design-system inspection server. Each tool covers a distinct facet (catalog, discovery, component detail, tokens, rules, conflicts, violations, context) without redundancy in count.

    Completeness4/5

    The surface covers discovery, component lookup, token lookup, inferred rules, conflicts, and violations, giving broad lifecycle coverage for a read-only inspection role. Minor gaps exist (no explicit snapshot-compare or diagnostics tool outside get_design_context), but agents can work around these.

    Maintenance

    ActivityMaintained
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI coding agents to read the live state of an open Figma file — variables, modes, components, prototype edges and assets — and to export design tokens and code packages for web, iOS, Android, React, Django and Tauri through a user-run loopback bridge with separate read and write gates.
      2
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to write AI-generated designs into design-tool canvases (MasterGo, Penpot) as native editable layers, and to read canvas selections back out as HTML + Tailwind, design tokens, and SVG assets. Runs locally with progressive tool disclosure and structurally truncated results so large design files stay within an agent's context budget.
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Gives AI agents token-efficient, provenance-aware context from scattered design-system knowledge — component specs, guidelines, decision records, research, and team-local overrides — through structured lookup, semantic search, and progressive document disclosure. It also surfaces conflicts and hides superseded content by default, so agents can answer design questions without confidently citing outdated guidance.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to draw on a shared local design canvas — creating frames, shapes, text, vector paths, components, and diagrams alongside a human collaborator — while taking screenshots and running checks for contrast, overflowing text, and missing design tokens, then exporting results as HTML, React components, or SVG.
      1
      MIT