An intelligent MCP (Model Context Protocol) server that bridges Figma designs with code generation. Matches Figma components to code templates and resolves design tokens automatically.
This agent system enables AI assistants (like Claude) to:
- Match Figma components to known design system patterns
- Resolve design tokens to platform-specific values (Tailwind, MUI, etc.)
- Generate code using pre-defined templates for web, React, Vue, Android, and Flutter
figma-design-agent/
├── golden-records/ # Human-readable component specifications
│ ├── avatar_golden_record.json
│ ├── avatar_golden_record.md
│ └── tokens.json
├── kb/ # Agent-optimized knowledge base
│ ├── components.agent.json
│ └── tokens.agent.json
├── src/
│ └── mcp-server.ts # MCP server implementation
└── build_kb.js # KB build script
npm installnpm run build:kbThis transforms golden records into agent-optimized KB files.
npm run build:servernode test-server.js# Production
npm run start:mcp
# Development (with auto-reload)
npm run dev:mcpMatches a Figma node name to a known component and extracts variant/prop information.
Input:
{
"figmaNode": {
"name": "M3/Navigation/Avatar/Monogram",
"type": "COMPONENT"
}
}Output:
{
"matched": true,
"component": {
"name": "Avatar",
"category": "User Representation",
"description": "Avatars represent users or entities..."
},
"variant": {
"name": "Monogram",
"type": "text",
"description": "Displays user initials"
},
"templates": {
"react": {
"template": "<Avatar className='{{styles}}' ... />",
"component": "Avatar",
"package": "@mui/material"
}
},
"referencedTokens": ["M3/sys/light/primary-container"],
"specifications": { ... },
"accessibility": { ... }
}Resolves a design token name to its code value.
Input:
{
"tokenName": "M3/sys/light/primary-container"
}Output:
{
"resolved": true,
"tokenName": "M3/sys/light/primary-container",
"value": "bg-purple-100"
}Golden records are the source of truth for component specifications. They include:
- Metadata: Version, last updated, Figma file ID
- Specifications: Dimensions, shapes, constraints
- Variants: Different states of the component
- Design Tokens: Color, typography, spacing references
- Accessibility: ARIA roles, labels, requirements
- Platform Templates: Code templates for web, React, Vue, Android, Flutter
- Usage Guidelines: Best practices and examples
- Extract component data from Figma
- Create a JSON file following the schema:
golden-records/component_golden_record_schema.json - Create a markdown file for human readability
- Rebuild the knowledge base:
npm run build:kb
The build_kb.js script:
- Reads all golden record JSON files
- Extracts agent-actionable fields
- Optimizes for fast lookup
- Generates
kb/components.agent.jsonandkb/tokens.agent.json
This separation allows:
- Human editors to maintain readable golden records
- Agents to access optimized, focused data
- Fast iteration without agent retraining
Add to your Claude Code MCP settings:
{
"mcpServers": {
"figma-design-agent": {
"command": "node",
"args": ["/Users/mootantan/projects/figma-design-agent/dist/mcp-server.js"]
}
}
}- Avatar: User representation with image, monogram, and status variants
- Web: Native HTML
- React: Material-UI (@mui/material)
- Vue: Vuetify
- Android: Jetpack Compose (Material 3)
- Flutter: Material Design
20+ Material 3 design tokens currently supported, including:
- Color tokens (primary, secondary, surface, etc.)
- Semantic tokens mapped to Tailwind classes
- Create golden record JSON and MD in
golden-records/ - Run
npm run build:kbto update knowledge base - Test with
node test-server.js - Rebuild MCP server if needed:
npm run build:server
- Edit
golden-records/tokens.json - Run
npm run build:kb - Restart MCP server
Run the test suite:
node test-server.jsThis validates:
- Knowledge base loading
- Component name matching
- Token resolution
- Server readiness
- Human-first: Easy to edit and review
- Traceable: Link back to Figma sources
- Versionable: Git-friendly JSON/MD format
- Performance: Agents load only what they need
- Scalability: Can grow to hundreds of components
- Maintainability: Clear separation of concerns
- Standardized: Works with any MCP-compatible client
- Composable: Can combine with other MCP tools
- Efficient: In-memory KB for fast lookups
- Semantic component matching (RAG-based)
- Figma API integration for auto-extraction
- Component composition rules
- Dark mode token variants
- Responsive sizing tokens
- Animation/transition templates
- Multi-language token support
To add support for a new design system:
- Create golden records for components
- Define design token mappings
- Add platform templates
- Update the schema if needed
- Rebuild and test
MIT
Built with:
- @modelcontextprotocol/sdk
- Material Design 3 specifications
- TypeScript
Status: Production Ready ✅ Version: 1.0.0 Last Updated: 2025-11-12