mhooooo/figma-design-agent
If you are the rightful owner of figma-design-agent and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The Figma Design Agent is an intelligent MCP server that connects Figma designs with code generation, facilitating seamless integration between design and development.
Figma Design Agent
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.
Overview
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
Architecture
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
Quick Start
1. Install Dependencies
npm install
2. Build Knowledge Base
npm run build:kb
This transforms golden records into agent-optimized KB files.
3. Build MCP Server
npm run build:server
4. Test the Setup
node test-server.js
5. Start the MCP Server
# Production
npm run start:mcp
# Development (with auto-reload)
npm run dev:mcp
MCP Tools
matchComponent
Matches 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": { ... }
}
resolveToken
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
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
Creating New Golden Records
- 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
Knowledge Base Build Process
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
Integration with Claude Code
Add to your Claude Code MCP settings:
{
"mcpServers": {
"figma-design-agent": {
"command": "node",
"args": ["/Users/mootantan/projects/figma-design-agent/dist/mcp-server.js"]
}
}
}
Current Components
- Avatar: User representation with image, monogram, and status variants
Supported Platforms
- Web: Native HTML
- React: Material-UI (@mui/material)
- Vue: Vuetify
- Android: Jetpack Compose (Material 3)
- Flutter: Material Design
Design Tokens
20+ Material 3 design tokens currently supported, including:
- Color tokens (primary, secondary, surface, etc.)
- Semantic tokens mapped to Tailwind classes
Development Workflow
Add a New Component
- 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
Update Design Tokens
- Edit
golden-records/tokens.json - Run
npm run build:kb - Restart MCP server
Testing
Run the test suite:
node test-server.js
This validates:
- Knowledge base loading
- Component name matching
- Token resolution
- Server readiness
Architecture Decisions
Why Golden Records?
- Human-first: Easy to edit and review
- Traceable: Link back to Figma sources
- Versionable: Git-friendly JSON/MD format
Why Separate KB Files?
- Performance: Agents load only what they need
- Scalability: Can grow to hundreds of components
- Maintainability: Clear separation of concerns
Why MCP?
- Standardized: Works with any MCP-compatible client
- Composable: Can combine with other MCP tools
- Efficient: In-memory KB for fast lookups
Future Enhancements
- 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
Contributing
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
License
MIT
Credits
Built with:
- @modelcontextprotocol/sdk
- Material Design 3 specifications
- TypeScript
Status: Production Ready ✅ Version: 1.0.0 Last Updated: 2025-11-12