Insider Design System MCP
Automated MCP server for the Insider Design System. Enables AI assistants to discover, understand, and generate code for over 60 Design System components with automated extraction from source code.
README
🎨 Insider Design System MCP
Automated Model Context Protocol server for the Insider Design System. Enables AI assistants like Claude to discover, understand, and generate code for 60+ Design System components with automated extraction from source code.
Version: 2.0 (Automated Extraction) Status: ✅ Production Ready Last Updated: 2025-11-21
✨ Features
🤖 Automated Extraction
- Zero Manual Work: Automatically extracts component metadata from Vue source files
- Always Up-to-Date: Re-run extraction when Design System changes (~5 minutes)
- Rich Metadata: Props, emits, enums, validators, slots - all extracted automatically
📊 Comprehensive Data
- 62 Components: Full coverage of Insider Design System
- 1,087 Props: With types, defaults, and validators
- 30 Enums: STYLES, TYPES, SIZES automatically detected
- Real Usage Analysis: Common mistakes detected from analytics-fe codebase
- Manual Enrichments: Critical components have detailed examples and notes
🔧 MCP Tools
list-components- List all componentsget-component- 🆕 Markdown format - Get component info in human-readable format with 77% token savingssearch-components- Search by name/descriptiongenerate-code- Generate Vue component codemap-figma-component- Map Figma to DS components
⚡ Markdown Format (NEW!)
The get-component tool now returns component documentation in Markdown format for massive token savings:
Benefits:
- 💰 77% token savings compared to JSON format (690KB → 161KB)
- 📖 Human-readable format with clear structure
- 🎯 ~135,335 tokens saved across all components
- ⚡ Faster responses with smaller payloads
Top Performers:
- InButtonV2: 88% savings (55KB → 6.6KB)
- InDropdownMenu: 87% savings (36KB → 4.8KB)
- InTooltipV2: 86% savings (31KB → 4.2KB)
Format includes:
- Props with types, defaults, descriptions
- Events with payloads
- Examples with code snippets
- Common mistakes and best practices
- Related components
📚 MCP Resources
ds://components- All components listds://registry- Registry metadatads://component/{name}- Individual componentds://categories- Component categories
📖 Documentation
→ See docs/ for complete documentation index
-
Architecture - System design and data flow
- How It Works - Complete architecture overview
- Smart Filter Layer - Token optimization system
- Figma Integration - Figma to Vue workflow
-
Guides - How-to guides and workflows
- Developer Workflow - Day-to-day development
- Enrichment Strategy - Creating enrichments
- Enrichment Template - Enrichment templates
-
Reference - API and tool references
- Agent Usage - Specialized agents guide
🚀 Quick Start
Prerequisites
- Node.js >= 20.0.0
- npm >= 10.0.0
Installation
# Clone repository
git clone <repo-url>
cd design-system-mcp
# Install dependencies
npm install
# Extract component metadata (first time)
npm run extract:all
# Build
npm run build
# Test
npm run test:production
Need help with extraction scripts? See WORKFLOW.md for detailed usage guide.
⚙️ Configuration
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"design-system": {
"command": "node",
"args": ["/Users/YOUR_USERNAME/path/to/design-system-mcp/dist/index.js"]
}
}
}
Environment Variables
# Design System source path (for extraction)
export DS_PATH="/Users/YOUR_USERNAME/path/to/insider-design-system"
# Analytics FE path (for usage analysis)
export ANALYTICS_FE_PATH="/Users/YOUR_USERNAME/path/to/analytics-fe"
🔄 Data Extraction Pipeline
Architecture
Design System Source Code (Vue files)
↓ AUTOMATED EXTRACTION
data/combined.json (209 KB)
↓ BUILD & COPY
dist/data/combined.json
↓ RUNTIME LOADING
MCP Server (in-memory, enum-resolved)
↓ FAST QUERIES
Claude Code
Extraction Commands
# Extract all data (run when Design System changes)
npm run extract:all
# Or run individually:
npm run extract:components # Parse Vue components → data/components.json
npm run extract:storybook # Extract examples → data/storybook.json
npm run extract:usage # Analyze usage → data/usage.json
npm run extract:argtypes # Sync possibleValues from storybook argTypes
npm run extract:merge # Merge all → data/combined.json
# Rebuild MCP server
npm run build
What Gets Extracted?
1. Component Metadata (extract-components.ts)
- Props (type, default, required, validator)
- Emits (from
$emit()calls) - Enums (const STYLES = {...})
- Slots
- Version (V1/V2)
2. Storybook Examples (extract-storybook.ts)
- Code examples from stories
- Descriptions
- Categories
3. Real Usage Analysis (extract-usage.ts)
- Usage counts from analytics-fe
- Common mistakes (auto-detected)
- Most used props
- Real code patterns
4. Manual Enrichments (overlay)
- Detailed valueFormat for critical props
- Common mistakes documentation
- Helper functions
- Migration guides
📖 Usage Examples
🎯 Complete Walkthrough: From Raw Request to Implementation
Scenario: You need a button that opens a dropdown menu.
Step 1: Optimize Your Raw Request
# In Claude Code (works in ANY project with Design System MCP!)
User: "Use optimize-prompt to transform this request: I need a button that opens a dropdown menu"
Claude calls mcp__design-system__optimize-prompt and returns:
# Original Prompt
I need a button that opens a dropdown menu
# Analysis
- Language: English
- Intent: implement
- Components: InButtonV2, InDropdownMenu
- Complexity: medium
- Estimated Token Savings: ~24,000 tokens
# Optimized Prompt
I need to implement InButtonV2 and InDropdownMenu components with proper integration.
Please use the Design System MCP to:
1. Get documentation for both components
- Tool: mcp__design-system__get-component
- Components: InButtonV2, InDropdownMenu
- Note: Markdown format saves ~87% tokens on average
2. Generate implementation code
- Tool: mcp__design-system__generate-code
- Include integration between components
Requirements:
- Primary styling for main actions
- Dropdown opens below trigger element
- Proper state management between components
Show me:
✅ Which components you're using
✅ Token savings from Markdown format for each component
✅ The generated Vue code
✅ Integration example showing how components work together
Step 2: Use the Optimized Prompt
User: "Now use the optimized prompt above to implement the button + dropdown"
Claude executes:
-
Gets InButtonV2 docs (Markdown format)
- Original: 55KB JSON → 6.6KB Markdown
- Token savings: 88% (~12,198 tokens)
-
Gets InDropdownMenu docs (Markdown format)
- Original: 36KB JSON → 4.8KB Markdown
- Token savings: 87% (~8,214 tokens)
-
Generates integrated Vue code:
<template>
<div class="button-dropdown-container">
<InButtonV2
id="actions-button"
:type="TYPES.PRIMARY"
:styling="STYLES.SOLID"
label-text="Actions"
@click="toggleDropdown"
/>
<InDropdownMenu
v-if="isOpen"
:items="menuItems"
@item-click="handleItemClick"
@close="isOpen = false"
/>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { InButtonV2, InDropdownMenu } from '@useinsider/design-system-vue';
import '@useinsider/design-system-vue/dist/design-system-vue.css';
const isOpen = ref(false);
const menuItems = [
{ id: 'export', label: 'Export Data', icon: 'download' },
{ id: 'share', label: 'Share Report', icon: 'share' },
{ id: 'settings', label: 'Settings', icon: 'settings' },
];
const toggleDropdown = () => {
isOpen.value = !isOpen.value;
};
const handleItemClick = (item: any) => {
console.log('Clicked:', item.id);
isOpen.value = false;
};
</script>
Summary
Total token savings: ~20,412 tokens (87.5% reduction) Time saved: Claude uses the right tools in the right order Quality: Proper integration, best practices included
💡 Pro Tips
Always optimize raw requests first:
❌ Don't do this:
User: "I need a button"
Claude searches through code files, wastes time.
✅ Do this:
User: "Use optimize-prompt: I need a button"
Claude gets optimized prompt → Uses MCP tools → Fast & accurate implementation.
Works everywhere:
- ✅ analytics-fe project
- ✅ marketing-web project
- ✅ customer-portal project
- ✅ ANY project with Design System MCP configured
🎯 Quick Reference: optimize-prompt
// Single component
mcp__design-system__optimize-prompt("I need a button")
// Multiple components
mcp__design-system__optimize-prompt("button and dropdown menu")
// Migration task
mcp__design-system__optimize-prompt("migrate InDatePicker from V1 to V2")
// Debug issue
mcp__design-system__optimize-prompt("InSelect not working, showing errors")
// Learning
mcp__design-system__optimize-prompt("how to use InTooltipV2?")
Get Component Details
// Claude automatically calls:
mcp__design-system__get-component("InButtonV2")
// Returns in Markdown format (88% token savings):
# InButtonV2
**Version:** v2
## Props
### `styling`
**Type:** `String` | **Default:** `"STYLES.SOLID"`
**Allowed values:** `solid`, `ghost`, `text`
### `type`
**Type:** `String` | **Default:** `"TYPES.PRIMARY"`
...
## Examples
### Basic Primary Button
```vue
<InButtonV2
id="primary-btn"
styling="solid"
type="primary"
label-text="Click Me"
/>
Token savings: 55KB → 6.6KB (88% reduction)
### Search Components
```typescript
mcp__design-system__search-components("button")
// Returns: InButton, InButtonV2, InCreateButton...
Generate Code
mcp__design-system__generate-code({
component: "InButtonV2",
props: { styling: "solid", type: "primary" }
})
// Returns:
// <InButtonV2
// id="button-1"
// styling="solid"
// type="primary"
// label-text="Button"
// />
🧪 Testing
# Test combined dataset
npm run test:data
# Test production build
npm run test:production
# Run unit tests
npm test
# Coverage
npm run test:coverage
📂 Project Structure
design-system-mcp/
├── 📄 README.md # This file
├── 📄 COMPLETION_REPORT.md # Full project report
├── 📄 HOW_IT_WORKS.md # Architecture deep dive
├── 📄 CLEANUP_SUMMARY.md # Cleanup history
├── 📦 package.json # Dependencies & scripts
├── 🔧 tsup.config.ts # Build configuration
│
├── 📂 src/ # Source code
│ ├── index.ts # Entry point
│ ├── server.ts # MCP server
│ ├── tools/index.ts # MCP tools
│ ├── resources/index.ts # MCP resources
│ ├── types/index.ts # TypeScript types
│ └── registry/
│ ├── combined-loader.ts # ⭐ Dataset loader (NEW)
│ ├── enrichments/ # Manual enrichments
│ │ ├── InButtonV2.json
│ │ ├── InDatePickerV2.json
│ │ └── InSelect.json
│ └── migrations/ # V1→V2 guides
│ └── InDatePicker-to-V2.json
│
├── 📂 scripts/ # Extraction scripts
│ ├── extract-components.ts # Vue component parser
│ ├── extract-storybook.ts # Example extractor
│ ├── extract-usage.ts # Usage analyzer
│ └── merge-datasets.ts # Dataset combiner
│
├── 📂 data/ # Extracted data
│ ├── components.json # 148 KB - Parsed components
│ ├── storybook.json # 1.6 KB - Examples
│ ├── usage.json # Real usage data
│ └── combined.json # 209 KB - ⭐ FINAL DATASET
│
└── 📂 dist/ # Build output
├── index.js # Bundled MCP server
└── data/combined.json # Runtime dataset
🔄 Update Workflow
When Design System Changes
# 1. Pull latest Design System
cd /path/to/insider-design-system
git pull
# 2. Re-extract metadata
cd /path/to/design-system-mcp
npm run extract:all # ~5 minutes
# 3. Rebuild MCP server
npm run build
# 4. Test
npm run test:production
# 5. Commit (optional)
git add data/combined.json
git commit -m "chore: update component metadata"
git push
# Claude Desktop will auto-reload! ✅
Before: 2-3 hours manual work Now: 5 minutes automated! 🚀
For more scenarios and detailed workflow guide, see WORKFLOW.md.
💡 Key Innovations
1. Automated Extraction
No more manual JSON editing. Parser reads Vue files directly.
2. Enum Resolution
// Source: const STYLES = { SOLID: 'solid', GHOST: 'ghost' }
// Extracted: enums: [{ name: "STYLES", values: {...} }]
// Runtime: validValues: ["solid", "ghost", "text"] ✅
3. Real Usage Intelligence
Scans analytics-fe for common mistakes:
{
"mistake": "Using number for iconSize",
"occurrences": 12,
"fix": "Use string: icon-size=\"24\"",
"severity": "critical"
}
4. Layered Enrichment
Auto-extracted (100% coverage)
+
Manual enrichments (critical details)
=
Best of both worlds! ✅
📊 Data Quality
Components: 62 (100% coverage)
Props: 1,087 (with types, defaults, validators)
Enums: 30 (automatically detected)
Emits: 170
Manual Enrichments: 3 (InButtonV2, InDatePickerV2, InSelect)
Migration Guides: 1
File Size: 209 KB (combined.json)
🎯 Benefits
For Developers
- ✅ Accurate component information
- ✅ Enum values always correct
- ✅ Common mistakes documented
- ✅ Real usage examples
- ✅ Fast code generation
For Design System Team
- ✅ Zero manual maintenance
- ✅ Always synchronized with source
- ✅ Easy updates (5 minutes)
- ✅ Automatic mistake detection
Expected Impact
- Code Generation Accuracy: 30% → 85%
- First-Try Correctness: 20% → 80%
- Onboarding Time: -70%
- Design System Questions: -50%
🛠️ Development
Scripts
# Build
npm run build # Build for production
npm run dev # Watch mode
# Extraction
npm run extract:components # Extract component metadata
npm run extract:storybook # Extract examples
npm run extract:usage # Analyze real usage
npm run extract:merge # Merge all datasets
npm run extract:all # Run all extractions
# Testing
npm test # Run unit tests
npm run test:coverage # Coverage report
npm run test:data # Test dataset validity
npm run test:production # Test production build
# Code Quality
npm run lint # Run ESLint
npm run lint:fix # Fix linting issues
npm run typecheck # TypeScript check
Adding New Enrichments
Option 1: Use enrichment-maker agent (Recommended)
# Let AI generate enrichment for you
# In Claude Code: "Use enrichment-maker agent to create enrichment for InTooltipV2"
# Agent analyzes component and creates:
# - valueFormat for complex props
# - commonMistakes documentation
# - Real-world examples
# - Helper functions
# Then merge and build:
npm run extract:merge
npm run build
Option 2: Manual creation
# 1. Create enrichment file
touch src/registry/enrichments/InTooltipV2.json
# 2. Add detailed metadata
# (See existing enrichments: InButtonV2, InDatePickerV2, InSelect)
# 3. Rebuild
npm run extract:merge
npm run build
📚 Documentation
- README.md (this file) - Quick start & overview
- WORKFLOW.md - ⭐ When and how to run extraction scripts
- AGENT_USAGE.md - 🤖 How to use agents and slash commands
- HOW_IT_WORKS.md - Architecture deep dive
- COMPLETION_REPORT.md - Full project report
- CLEANUP_SUMMARY.md - Cleanup history
- CLAUDE.md - Instructions for Claude Code
🤝 Contributing
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing - Make changes
- Run tests:
npm test - Commit:
git commit -m "feat: add amazing feature" - Push:
git push origin feature/amazing - Submit Pull Request
📄 License
UNLICENSED - Internal use only (Insider)
💬 Support
For questions and issues:
- Create GitHub issue
- Contact Design System team
- Slack: #design-system
🎉 Success Stories
"Component metadata is now always accurate. Claude generates correct code on first try!" — Developer using MCP
"We updated 15 components in Design System. Re-extraction took 5 minutes!" — Design System Team
Built with ❤️ by the Insider Design System Team
Powered by: Claude Code (Sonnet 4.5)
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。