style-system
Design-system lookup for coding agents: theme tokens, Tailwind classes, Storybook components and previews
Serves a project's reconciled design-system contract (tokens, components, conflicts) to coding agents
By AI by design TypeScript Local · stdio DesignDeveloper tools
28 popularity score ★ 21 ↓ 27/wk
Opens the app, which asks before it adds the server.
claude mcp add primitiv -- npx -y @ai-by-design/primitiv serve{
"mcpServers": {
"primitiv": {
"command": "npx",
"args": [
"-y",
"@ai-by-design/primitiv",
"serve"
]
}
}
}{
"mcpServers": {
"primitiv": {
"command": "npx",
"args": [
"-y",
"@ai-by-design/primitiv",
"serve"
]
}
}
}{
"servers": {
"primitiv": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@ai-by-design/primitiv",
"serve"
]
}
}
}[mcp_servers.primitiv]
command = "npx"
args = ["-y", "@ai-by-design/primitiv", "serve"]gemini mcp add --scope user primitiv npx -- -y @ai-by-design/primitiv serveFIGMA_ACCESS_TOKEN |
Optional: Figma token read by the generated primitiv.config.js when the Figma source is enabled; used by build, not by serve. |
|---|
Primitiv is a command-line tool with a built-in stdio MCP server for front-end projects. Its build step scans a project's code (CSS variables, TypeScript tokens, React components) and, when configured, Figma variables and a Storybook manifest, compares what each source says, records disagreements as conflicts, flags hardcoded values that bypass the tokens, and writes the result to primitiv.contract.json. The serve command then exposes that file to an agent, so it can check which tokens and components already exist before writing new UI.
At version 2.21.1 the server registers seven read-only tools in src/mcp/server.ts: a design summary, token and component lookups, a component catalogue and filtered search, paged component context, and a paged conflict list (25 per page by default, up to 100). The docs' MCP Tools page also lists get_inferred_rules and get_violations, but neither is registered in that file at 2.21.1; violation counts appear in the get_design_context summary instead.
The server watches the contract file and reloads it when a new build replaces it. If the file is missing or invalid it logs a message telling you to run primitiv build. The makers advise keeping the MCP configuration per project rather than global, because a global entry can serve another repository's contract. The same package also provides init (writes primitiv.config.js, a project .mcp.json or .cursor/mcp.json, AGENTS.md and CLAUDE.md blocks, and a GitHub CI workflow) and verify, a CI check that exits 1 or 2 on stale contracts or pending conflicts.
| Runtime | Node.js |
|---|
Node.js with npx. A JavaScript or TypeScript front-end project; init detects Next, Nuxt, Astro, SvelteKit, Remix, Expo, Qwik, Vite, Solid or React. Run `npx @ai-by-design/primitiv init` and `npx @ai-by-design/primitiv build` in the project root first, so primitiv.contract.json exists before serve starts. Figma as a source needs a Figma access token and file ID in primitiv.config.js; Storybook needs a reachable Storybook URL.
Read-only: no tool edits code, tokens or the contract. Agents see only the last built contract, so changes in code, Figma or Storybook are invisible until primitiv build runs again. Component evidence is static source analysis, not runtime usage, and dynamic prop values stay unknown. The docs list get_inferred_rules and get_violations as tools, but the 2.21.1 source does not register them. Figma and Storybook are optional by default: if one cannot be scanned, the build warns and carries on without it, unless it is the configured sourceOfTruth or is marked optional: false.
Teams with a React-family front end and an established design system who want coding agents to reuse existing tokens and components, especially when Figma, Storybook and code have drifted apart. Since it is local and read-only, it fits repositories where an agent must not change anything through MCP. It is less useful for projects without a token or component layer, and it will not edit Figma or fix code itself. If you only need Figma files themselves, a Figma-focused server is the better fit.
get_design_contextget_tokenget_componentget_component_catalogfind_componentsget_component_contextget_conflicts