🚀 GarenCode Design - AI-Powered Intelligent Component Design Platform
⚔️ In the name of Garen, forge perfect designs ⚔️

🎯 From requirements to code, an AI-driven intelligent design pipeline
⚡ Empower every developer to become a component design master
📋 Table of Contents
- 🌟 Project Introduction
- 🎨 Design Process
- ⚙️ Project Configuration
- 🔧 IDE Integration
- 🚀 Quick Start
- 📚 Usage Guide
- 🔮 Future Plans
- 🏗️ Project Architecture
🌟 Project Introduction
🎯 Core Concept
GarenCode Design is an AI-driven component design platform based on MCP (Model Context Protocol). We are committed to enabling every developer to easily create high-quality front-end components, with full-process intelligence from requirement analysis to code generation.
✨ Core Features
| Feature |
Details |
| 🎨 Intelligent Design |
AI-driven component design, automatic analysis of user requirements, and intelligent recommendation of best practices. |
| ⚡ Efficient Generation |
Support for multiple AI models, real-time code generation, and type safety guarantee. |
| 🔧 Private Components |
An enterprise-level component library, unified design specifications, and a reusable component ecosystem. |
🏆 Technical Advantages
- 🚀 Over 50% improvement in development efficiency - An automated pipeline from requirements to code.
- 🎯 Design consistency - A unified component library and design specifications.
- 🔧 High maintainability - Standardized code structure and API design.
- ⚡ Support for multiple models - Mainstream AI models such as Claude, GPT, DeepSeek, and Ollama.
🎨 Design Process
🔄 Core Workflow
graph LR
A[🎤 User Requirements] --> B[🔍 Requirement Analysis]
B --> C[🧩 Component Decomposition]
C --> D[🎨 Design Strategy]
D --> E[⚡ Code Generation]
E --> F[🔗 Module Integration]
F --> G[🚀 Final Delivery]
style A fill:#ff6b6b,stroke:#333,stroke-width:3px
style B fill:#4ecdc4,stroke:#333,stroke-width:3px
style C fill:#45b7d1,stroke:#333,stroke-width:3px
style D fill:#96ceb4,stroke:#333,stroke-width:3px
style E fill:#feca57,stroke:#333,stroke-width:3px
style F fill:#ff9ff3,stroke:#333,stroke-width:3px
style G fill:#5f27cd,stroke:#333,stroke-width:3px
📝 Detailed Process Explanation
1️⃣ Requirement Analysis Phase 🔍
const analysis = await analyzeRequirement({
userInput: 'Create a user management page',
context: 'Enterprise-level background management system',
constraints: ['Vue 3', 'TypeScript', 'Private component library'],
});
2️⃣ Complexity Assessment 📊
const complexity = await assessComplexity({
requirements: analysis.requirements,
businessLogic: analysis.businessLogic,
uiComplexity: analysis.uiComplexity,
});
3️⃣ Intelligent Decomposition 🧩
const blocks = await decomposeToBlocks({
requirements: analysis.requirements,
complexity: complexity,
designStrategy: 'block-based',
});
4️⃣ Design Strategy Generation 🎨
const strategy = await generateDesignStrategy({
blocks: blocks,
componentLibrary: 'private-components',
designSystem: 'garen-design-system',
});
5️⃣ Block-by-Block Development ⚡
for (const block of blocks) {
const design = await designBlock({
block: block,
strategy: strategy,
aiModel: getRecommendedModel('DESIGN'),
});
const code = await generateCode({
design: design,
framework: 'vue3',
typescript: true,
});
}
6️⃣ Intelligent Integration 🔗
const integration = await integrateDesign({
blocks: completedBlocks,
layout: 'responsive',
dataFlow: 'centralized',
});
⚙️ Project Configuration
📁 Configuration File Structure
data/
├── config.json # 🎯 AI model configuration (actual use)
├── config.example.json # 📝 AI configuration example (sensitive information removed)
├── codegens.json # 🧩 Private component library configuration (actual use)
└── codegens.example.json # 📚 Component library configuration example
🔑 AI Model Configuration
1. Copy the configuration files
cp data/config.example.json data/config.json
cp data/codegens.example.json data/codegens.json
2. Configure AI providers
Edit data/config.json:
{
"defaultModels": {
"ANALYSIS": "claude-3-7-sonnet-latest",
"DESIGN": "claude-3-5-sonnet-latest",
"QUERY": "claude-3-5-sonnet-latest",
"INTEGRATION": "claude-3-7-sonnet-latest"
},
"providers": [
{
"provider": "anthropic",
"models": [
{
"model": "claude-3-5-sonnet-latest",
"title": "Claude 3.5 Sonnet",
"baseURL": "https://api.302.ai/v1",
"features": ["reasoning", "creativity"],
"apiKey": "sk-your-anthropic-api-key-here"
}
]
},
{
"provider": "openai",
"models": [
{
"model": "gpt-4o",
"title": "GPT-4o",
"baseURL": "https://api.openai.com/v1",
"features": ["vision", "reasoning", "creativity"],
"apiKey": "sk-your-openai-api-key-here"
}
]
}
]
}
3. Supported AI Providers
| Provider |
Features |
Configuration Example |
| 🤖 Anthropic |
Reasoning, creativity |
https://api.anthropic.com |
| 🧠 OpenAI |
Vision, reasoning |
https://api.openai.com/v1 |
| 🔍 DeepSeek |
Reasoning, creativity |
https://api.deepseek.com |
| 🏠 Ollama |
Local deployment |
http://localhost:11434 |
4. Validate the configuration
node scripts/validate-config.js
node scripts/test-model-recommendation.js
🧩 Private Component Library Configuration
data/codegens.json contains the complete configuration for the private component library:
[
{
"title": "Private Component Codegen",
"description": "Code generator based on private components",
"fullStack": "Vue",
"rules": [
{
"type": "private-components",
"description": "Usage rules for private components",
"docs": {
"Component Name": {
"purpose": "Purpose of use",
"usage": "Description of frequently used scenarios in the project",
"props": {
"type": "",
"size": ""
...
}
}
}
}
]
}
]
🔧 IDE Integration
📝 MCP Configuration File
Create a mcp-config.json file:
{
"mcpServers": {
"garencode-design": {
"command": "/bin/zsh",
"args": ["-c", "cd /path/to/your/project && npm run mcp:dev"]
}
}
}
🎯 Usage
1. Use in Cursor
const result = await mcp.callTool({
name: 'design_component',
arguments: {
prompt: [
{
type: 'text',
text: 'Create a user management page, including a user list, search, and add/edit functions',
},
],
},
});
2. Use in VS Code
{
"mcp.servers": {
"garencode-design": {
"command": "node",
"args": ["dist/mcp-server.js"],
"cwd": "/path/to/garencode-design"
}
}
}
🚀 Quick Start
1️⃣ Environment Preparation
git clone https://github.com/lyw405/mcp-garendesign.git
cd mcp-garendesign
npm install
pnpm install
2️⃣ Configuration Settings
cp data/config.example.json data/config.json
cp data/codegens.example.json data/codegens.json
vim data/config.json
3️⃣ Start the Service
chmod +x scripts/start-standalone.sh
./scripts/start-standalone.sh
npm run build
npm run mcp:dev
4️⃣ Verify the Installation
node scripts/validate-config.js
node scripts/test-model-recommendation.js
📚 Usage Guide
🎨 Component Design Tools
design_component
Design front-end components:
{
"name": "design_component",
"arguments": {
"prompt": [
{
"type": "text",
"text": "Create a product card component, including an image, title, price, and purchase button"
}
]
}
}
design_block
Design a single block of a complex page:
{
"name": "design_block",
"arguments": {
"prompt": [
{
"type": "text",
"text": "Design a user list management block, including a table, search, and pagination functions"
}
]
}
}
query_component
Query detailed information about a component:
{
"name": "query_component",
"arguments": {
"componentName": "das-button"
}
}
🔄 Complete Workflow Example
import { MCPClient } from '@modelcontextprotocol/sdk/client';
const client = new MCPClient({
name: 'GarenCode Design Client',
version: '1.0.0',
});
await client.connect({
type: 'stdio',
command: 'tsx',
args: ['src/mcp-server.ts'],
});
const result = await client.callTool({
name: 'design_component',
arguments: {
prompt: [
{
type: 'text',
text: 'Create a login form component, including username and password input fields and a login button',
},
],
},
});
console.log('🎉 Component design completed:', result);
🔮 Future Plans
🎯 Current Capabilities
✅ Reuse of private components - Full support for a private component library.
✅ Intelligent design process - AI-driven component design.
✅ Support for multiple models - Claude, GPT, DeepSeek, Ollama.
✅ Type safety - Full support for TypeScript.
✅ Configuration management - Flexible AI model configuration.
🚀 Upcoming Features
1️⃣ Private State Management 🔄
const stateConfig = {
globalState: {
user: 'UserState',
theme: 'ThemeState',
language: 'LanguageState',
},
localState: {
form: 'FormState',
modal: 'ModalState',
},
};
const stateCode = await generateStateManagement({
components: designedComponents,
stateConfig: stateConfig,
framework: 'pinia',
});
2️⃣ Global Attribute Automation ⚙️
const globalProps = {
theme: 'light | dark',
language: 'zh-CN | en-US',
permissions: 'admin | user | guest',
device: 'desktop | mobile | tablet',
};
const enhancedComponents = await injectGlobalProps({
components: designedComponents,
globalProps: globalProps,
injectionStrategy: 'automatic',
});
3️⃣ Intelligent Code Optimization 🧠
const optimization = await optimizeCode({
components: generatedComponents,
optimizationTargets: [
'bundle-size',
'runtime-performance',
'memory-usage',
'accessibility',
],
});
4️⃣ Design System Integration 🎨
const designSystem = await syncDesignSystem({
components: designedComponents,
designTokens: {
colors: 'design-tokens/colors.json',
typography: 'design-tokens/typography.json',
spacing: 'design-tokens/spacing.json',
},
syncStrategy: 'real-time',
});
📅 Development Roadmap
| Phase |
Feature |
Status |
| 🎯 Phase 1 |
Reuse of private components |
🟢 Production-ready |
| 🔄 Phase 2 |
Private state management |
🟡 In development |
| ⚙️ Phase 3 |
Global attribute automation |
🟠 In planning |
| 🧠 Phase 4 |
Intelligent code optimization |
🔴 Planned |
🏗️ Project Architecture
📁 Directory Structure
mcp-garendesign/
├── 📁 src/
│ ├── 🚀 mcp-server.ts # MCP server entry
│ ├── 🛠️ tools/ # MCP tool implementation
│ │ ├── design/
│ │ │ ├── component.ts # Component design tool
│ │ │ └── block.ts # Block design tool
│ │ └── query/
│ │ └── component.ts # Component query tool
│ ├── 🧠 core/ # Core business logic
│ │ ├── design/ # Design engine
│ │ │ ├── complexity-analyzer.ts
│ │ │ ├── strategy/
│ │ │ ├── blocks/
│ │ │ └── integration/
│ │ └── query/ # Query engine
│ ├── ⚙️ config/ # Configuration management
│ │ ├── ai-client-adapter.ts # AI client adapter
│ │ ├── model-manager.ts # Model manager
│ │ ├── config-validator.ts # Configuration validator
│ │ └── types.ts # Configuration type definition
│ ├── 🎨 utils/ # Utility functions
│ │ └── formatters/ # Formatting tools
│ ├── 📚 resources/ # MCP resources
│ └── 🏷️ types/ # Type definitions
├── 📁 data/ # Configuration files
│ ├── config.json # AI model configuration
│ ├── config.example.json # Configuration example
│ ├── codegens.json # Private component library configuration
│ └── codegens.example.json # Component library configuration example
├── 📁 scripts/ # Script files
├── 📁 docs/ # Documentation
└── 📄 package.json
🔧 Adding New Tools
- Create a tool file
export async function newTool(args: NewToolArgs): Promise<ToolResult> {
return {
content: [
{
type: 'text',
text: 'Tool execution result',
},
],
};
}
- Register the tool
import { newTool } from './tools/design/new-tool.js';
tools: [
{
name: 'new_tool',
description: 'New tool description',
inputSchema: {
type: 'object',
properties: {
},
},
},
];
📚 Adding New Resources
- Create a resource function
export function getNewResource() {
return {
contents: [
{
type: 'text',
text: 'Resource content',
},
],
};
}
- Register the resource
import { getNewResource } from './resources/index.js';
resources: [
{
uri: 'garencode://resources/new-resource',
name: 'new_resource',
description: 'New resource description',
mimeType: 'text/plain',
},
];
🧪 Testing
npm test
node scripts/validate-config.js
node scripts/test-model-recommendation.js
🤝 Contribution Guidelines
We welcome all forms of contribution!
🐛 Reporting Issues
If you find an issue, please create an Issue.
💡 Submitting Feature Requests
If you have an idea for a new feature, please create a Feature Request.
🔧 Submitting Code
- Fork the project.
- Create a feature branch (
git checkout -b feature/amazing-feature).
- Commit your changes (
git commit -m 'Add amazing feature').
- Push to the branch (
git push origin feature/amazing-feature).
- Create a Pull Request.
📄 License
This project is licensed under the MIT License.
⚔️ In the name of Garen, forge perfect designs ⚔️
🌟 GarenCode Design - Make every component meet your expectations
