Command Palette

Search for a command to run...

UnylyUnyly
Весь каталог

Insider Design System

БесплатноНе проверен

Automated MCP server for the Insider Design System. Enables AI assistants to discover, understand, and generate code for over 60 Design System components with a

GitHubEmbed

Описание

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

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 components
  • get-component - 🆕 Markdown format - Get component info in human-readable format with 77% token savings
  • search-components - Search by name/description
  • generate-code - Generate Vue component code
  • map-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 list
  • ds://registry - Registry metadata
  • ds://component/{name} - Individual component
  • ds://categories - Component categories

📖 Documentation

→ See docs/ for complete documentation index


🚀 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:

  1. Gets InButtonV2 docs (Markdown format)

    • Original: 55KB JSON → 6.6KB Markdown
    • Token savings: 88% (~12,198 tokens)
  2. Gets InDropdownMenu docs (Markdown format)

    • Original: 36KB JSON → 4.8KB Markdown
    • Token savings: 87% (~8,214 tokens)
  3. 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

  1. Fork the repository
  2. Create feature branch: git checkout -b feature/amazing
  3. Make changes
  4. Run tests: npm test
  5. Commit: git commit -m "feat: add amazing feature"
  6. Push: git push origin feature/amazing
  7. 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)

from github.com/denizzeybek-fe/design-system-mcp

Установка Insider Design System

У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.

▸ github.com/denizzeybek-fe/design-system-mcp

FAQ

Insider Design System MCP бесплатный?

Да, Insider Design System MCP бесплатный — установка в пару кликов через Unyly без оплаты.

Нужен ли API-ключ для Insider Design System?

Нет, Insider Design System работает без API-ключей и переменных окружения.

Insider Design System — hosted или self-hosted?

Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.

Как установить Insider Design System в Claude Desktop, Claude Code или Cursor?

Открой Insider Design System на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.

Похожие MCP

Compare Insider Design System with

Не уверен что выбрать?

Найди свой стек за 60 секунд

Автор?

Embed-бейдж для README

Похожее

Все в категории development