OTFotf
All posts
Claude Code

Using Claude + Knapsack MCP to Build with Your Components

5 min
Using Claude + Knapsack MCP to Build with Your Components

Stop getting generic components from AI. Connect your design system via Knapsack MCP and let Claude Code build with YOUR actual components.

The Generic Component Problem

When you ask Claude Code to 'build a settings page,' it generates generic components from scratch. The button doesn't match your design system. The card component ignores your spacing tokens. The typography uses defaults instead of your font stack.

The problem isn't the AI — it's the context. Claude Code doesn't know about your design system unless you tell it. Copying component code into every prompt is tedious and error-prone.

Knapsack MCP solves this by giving Claude Code structured access to your entire component library. When connected, Claude Code knows every component you have, its props, variants, and usage patterns. It builds with YOUR components instead of inventing new ones.

Setting Up Knapsack MCP

Connect your component library to Claude Code in minutes.

1

Add your components to Knapsack

If you're not already using Knapsack, add your component library. Knapsack supports React, Vue, Angular, and Web Components. Import your existing components with their props, variants, and documentation.

2

Enable the MCP server

Knapsack provides an MCP server that exposes your component library. Enable it in your Knapsack workspace settings and get the connection URL.

3

Connect Claude Code

Add the Knapsack MCP server to your Claude Code configuration. Now Claude Code can query your component library: available components, their props, accepted values, and usage examples.

4

Build with your components

Prompt Claude Code: 'Build a settings page using our component library.' Claude Code queries Knapsack, finds your Button, Card, Input, and Layout components, and assembles the page using your actual design system.

Building with Your Components

Component Discovery

Claude Code can ask Knapsack: 'What components do I have for displaying data tables?' and get a list of your table, data grid, and list components with their capabilities. No more reinventing components that already exist.

Prop-Aware Generation

When using your Button component, Claude Code knows the exact props: variant (primary, secondary, ghost), size (sm, md, lg), loading state, disabled state. Generated code uses your actual API, not guessed props.

Pattern Reuse

If your design system includes page patterns (settings page, dashboard layout), Claude Code can reference and reuse them. Consistent pages across your entire application, generated in minutes.

Design System Compliance

Because Claude Code uses your actual components, the generated code is automatically compliant with your design system. No manual cleanup to replace generic components with branded ones.

More Claude Code resources

On this page