Model Context Protocol (MCP) is the missing link between AI assistants and your design system. Instead of hoping the AI remembers your component APIs from training data, MCP tools let it query your library in real time.
Fragments ships with 9 MCP tools. Here's how a typical AI-assisted workflow looks:
fragments_discover to find relevant components (Form, Field, Switch, Select, Card)fragments_inspect on each component to get props, usage guidelines, and examplesfragments_tokens to get your design token valuesThe result is code that uses your real components with correct props, follows your usage guidelines, and respects your token system.
The pattern is straightforward:
// Define a tool
server.tool('my_component_lookup', {
description: 'Look up component API by name',
parameters: z.object({
name: z.string().describe('Component name'),
}),
handler: async ({ name }) => {
const contract = await loadContract(name);
return { content: [{ type: 'text', text: JSON.stringify(contract) }] };
},
});The key insight is that MCP tools should return structured data, not prose. AI assistants are better at using JSON contracts than parsing documentation paragraphs.
The real power comes from tools that encode your team's decisions:
These tools turn your design system from a passive library into an active collaborator in every AI-assisted development session.