mcp-garendesign
Enables AI-driven frontend component design and code generation from natural language requirements. Supports Vue, React, and Angular with intelligent component decomposition, API design, and complete project generation.
README
🚀 mcp-garendesign - AI-driven component design and code generation toolkit
<div align="center">
<img src="assets/garen.jpeg" alt="God-King Garen - mcp-garendesign project logo" width="400" /> <br> <em>God-King Garen - a symbol of powerful AI design capability</em>
From requirements to code: an intelligent automated pipeline 🎯
</div>
<div align="center">
</div>
📋 Table of Contents
🎯 Overview
mcp-garendesign is an AI-driven component design service based on the Model Context Protocol (MCP). It focuses on intelligent design and generation of frontend components, enabling end-to-end automation from user requirements to a complete code project.
🌟 Core Value
- 🚀 Productivity: Improve development efficiency by 50%+
- 🎯 Quality: Use shared state and a shared component library
- 🔧 Maintainability: Standardized code structure and API design
- 🎨 Consistency: Unified design system and component library
🔄 Core Workflow
graph TD
A[🎤 User Requirements] --> B[🔍 Requirement Analysis]
B --> C[🧩 Decompose into Components]
C --> D[🎨 Component Content & API Design]
D --> E[⚡ IDE Code Generation]
E --> F[🔄 Iterative API/Design Validation]
F --> G[🔗 Module Integration Design]
G --> H[🚀 IDE Code Integration]
style A fill:#ff6b6b,stroke:#333,stroke-width:2px
style B fill:#4ecdc4,stroke:#333,stroke-width:2px
style C fill:#45b7d1,stroke:#333,stroke-width:2px
style D fill:#96ceb4,stroke:#333,stroke-width:2px
style E fill:#feca57,stroke:#333,stroke-width:2px
style F fill:#ff9ff3,stroke:#333,stroke-width:2px
style G fill:#54a0ff,stroke:#333,stroke-width:2px
style H fill:#5f27cd,stroke:#333,stroke-width:2px
📝 Workflow Details
1️⃣ User Requirements 🎤
Users describe their needs in natural language. The system extracts the core requirements.
2️⃣ Requirement Analysis 🔍
Analyze and structure requirements: functional, non-functional, user stories, and business logic.
3️⃣ Decomposition 🧩
Split into manageable components, determine component types, complexity, and dependencies.
4️⃣ Component Content & API Design 🎨
Design detailed specs for each component: Props, Events, Slots, and styles.
5️⃣ IDE Code Generation ⚡
Generate code from the design: component files, type definitions, styles, tests.
6️⃣ Iterative Validation 🔄
Monitor generation status, adjust polling intervals, handle timeouts and errors.
7️⃣ Module Integration 🔗
Integrate components into full pages: layout, data flow, and state management.
8️⃣ IDE Code Integration 🚀
Produce a complete project: structure, configs, build scripts, deployment.
💡 Key Features
🎯 Intelligent Requirement Understanding
- NLP: Understand user intent
- Context awareness: Map to business scenarios
- Requirement validation: Ensure completeness
🧩 Smart Component Decomposition
- Complexity analysis: Auto-evaluate component complexity
- Dependency management: Handle component dependencies smartly
- Token optimization: Efficient AI usage
⚡ Efficient Code Generation
- Multi-framework: Vue, React, Angular
- Type safety: Full TypeScript support
- Best practices: Industry standards
🔄 Intelligent Monitoring
- Adaptive polling: Auto-adjust frequency
- Error recovery: Retry mechanisms
- Performance: Resource optimization
🎨 Design System Integration
- Component libraries: Private library integration
- Design guidelines: Unified standards
- Theming: Multiple themes
🏗️ Architecture
graph TB
subgraph "Frontend Layer"
A[User Interface]
B[IDE Plugin]
end
subgraph "Service Layer"
C[MCP Server]
D[Requirement Analysis Engine]
E[Component Design Engine]
F[Code Generation Engine]
G[Polling Controller]
end
subgraph "AI Layer"
H[AI Model Integration]
I[Multi-model Support]
J[Streaming]
end
subgraph "Data Layer"
K[Component Knowledge Base]
L[Design Template Library]
M[Configuration Management]
end
A --> C
B --> C
C --> D
C --> E
C --> F
C --> G
D --> H
E --> H
F --> H
G --> H
H --> I
H --> J
D --> K
E --> L
F --> M
🚀 Getting Started
1. Install dependencies
# Clone the repository
git clone https://github.com/lyw405/mcp-garendesign.git
cd mcp-garendesign
# Install dependencies
npm install
# Or use pnpm
pnpm install
2. Configure environment
# Copy configuration files (note filenames)
cp data/config.exmple.json data/config.json
cp data/codegens.example.json data/codegens.json
3. Configure AI providers
Edit data/config.json:
{
"providers": [
{
"provider": "anthropic",
"models": [
{
"model": "claude-3-7-sonnet-latest",
"title": "Claude 3.7 Sonnet",
"baseURL": "https://api.anthropic.com",
"features": [],
"apiKey": "your-api-key"
}
]
}
]
}
Supported AI providers:
- Anthropic Claude:
https://api.anthropic.comor proxies - OpenAI GPT:
https://api.openai.com/v1or proxies - DeepSeek:
https://api.deepseek.comor proxies - Ollama:
http://localhost:11434(local models)
4. Start the service
# Quick start
./scripts/start.sh
# Or run manually
npm run build
npm start
# Development mode
npm run dev
5. Use the workflow
import { WorkflowEngine } from '@mcp-garendesign/core';
const workflow = new WorkflowEngine();
const result = await workflow.process({
requirement: 'Create a user management page',
framework: 'vue',
style: 'modern',
});
📚 Usage Guide
MCP Tools
design_component
Design frontend components from user requirements.
{
"name": "design_component",
"arguments": {
"prompt": [
{
"type": "text",
"text": "Create a product card component showing product image, name, price, and a buy button"
}
]
}
}
query_component
Query detailed information for a component.
{
"name": "query_component",
"arguments": {
"componentName": "Button"
}
}
Basic Example
import { MCPClient } from '@modelcontextprotocol/sdk/client';
const client = new MCPClient({
name: 'My MCP Client',
version: '1.0.0',
});
// Connect to the service
await client.connect({
type: 'stdio',
command: 'tsx',
args: ['src/mcp-server.ts'],
});
// Design a component
const result = await client.callTool({
name: 'design_component',
arguments: {
prompt: [{ type: 'text', text: 'Create a login form component' }],
},
});
🗂️ Project Structure
mcp-garendesign/
├── src/
│ ├── mcp-server.ts # MCP server entry
│ ├── tools/ # MCP tools
│ │ ├── design-component.ts
│ │ └── query-component.ts
│ ├── core/ # Core logic
│ │ ├── blocks/
│ │ ├── parsers/
│ │ ├── query/
│ │ └── strategy/
│ ├── shared/ # Shared utils
│ │ ├── config/
│ │ ├── formatters/
│ │ └── validators/
│ ├── types/ # Type definitions
│ └── resources/ # MCP resources
├── data/ # Configuration files
│ ├── codegens.json # Component library config
│ └── config.json # AI providers config
├── docs/ # Documentation
│ └── GAREN_MCP_New_Version_Plan.md # Release plan
├── scripts/ # Scripts
└── package.json
🔧 Troubleshooting
Common Issues
-
Configuration files not found
# Ensure configuration files exist ls data/config.json ls data/codegens.json -
Invalid API key
# Validate configuration npm run validate -
Service failed to start
# Check dependencies npm install # Rebuild npm run build -
Permission issues
# Make the start script executable chmod +x scripts/start.sh
Debug mode
# Enable debug
export DEBUG=true
export LOG_LEVEL=debug
# Start the service
npm run dev
🛠️ Development Guide
Add a new tool
- Create a tool file under
src/tools/ - Register it in
src/mcp-server.ts - Update the tool handlers
Add a new resource
- Add a resource function in
src/resources/index.ts - Register it in
src/mcp-server.ts - Update resource handlers
📄 License
MIT License
<div align="center">
mcp-garendesign - Make AI a powerful assistant for every engineering team 🤖
</div>
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。