Skip to main content
Glama
jozrftamson

Hermes Figma Prompt Hub MCP Server

by jozrftamson
README.md
# Hermes Figma Prompt Hub - Complete Platform

> Design System & Prompt Management Platform with Figma Integration

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![GitHub Actions](https://github.com/jozrftamson/hermes-figma-prompt-hub-nuxt/workflows/CI/badge.svg)](https://github.com/jozrftamson/hermes-figma-prompt-hub-nuxt/actions)

## šŸŽÆ Features

### šŸ“Š Core Features
- āœ… **Figma Integration** — Import PROMPT/* frames directly from Figma
- āœ… **Design System** — Complete CSS/SCSS generation from design tokens
- āœ… **Validation Suite** — Schema, layer contract, and quality checks
- āœ… **Prompt Management** — Create, edit, validate, and version prompts
- āœ… **Auto-Sync** — Webhook-based auto-sync from Figma changes
- āœ… **Web UI** — Nuxt 3 dashboard for prompt management

### šŸŽØ Design System
- **Colors** — Primary, Secondary, Semantic, Neutral palettes with shades
- **Typography** — 8-level font scale with weights and line-heights
- **Spacing** — 24-step spacing system (4px base)
- **Radius** — 9-level border radius scale
- **Shadows** — 5-level elevation system
- **Responsive** — Mobile-first 12-column grid with breakpoints

### šŸ¤– Prompt Strategies
- **Chain-of-Thought** — Structured step-by-step reasoning
- **Few-Shot Learning** — Pattern recognition with examples
- **Role-Play Persona** — Expert advice from specific roles
- **Tree-of-Thought** — Multiple parallel solution paths
- **Meta-Reasoning** — Self-validation and reflection

### āœ… Validation
- **Schema Validator** — JSON schema compliance
- **Layer Contract** — Figma structure validation
- **Content Quality** — Clarity, specificity, token estimation
- **Strategy-Specific** — Rules per prompting strategy

### šŸ”„ Integration
- **Figma API** — Direct import from Figma files
- **Webhooks** — Auto-sync on file changes
- **GitHub** — Native git integration
- **CI/CD** — GitHub Actions workflows

## šŸ“¦ Project Structure

```
hermes-figma-prompt-hub-nuxt/
ā”œā”€ā”€ pages/                    # Nuxt pages
│   ā”œā”€ā”€ index.vue            # Dashboard
│   └── prompts/
│       ā”œā”€ā”€ index.vue        # Prompts list
│       └── [id].vue         # Prompt detail
ā”œā”€ā”€ components/              # Vue components
ā”œā”€ā”€ stores/                   # Pinia stores
ā”œā”€ā”€ server/
│   ā”œā”€ā”€ api/                 # Nuxt API routes
│   └── middleware/          # Server middleware
ā”œā”€ā”€ scripts/                 # Python & Bash scripts
│   ā”œā”€ā”€ figma_importer.py    # Figma API client
│   ā”œā”€ā”€ figma_webhook.py     # Webhook handler
│   ā”œā”€ā”€ schema_validator.py  # Validation
│   ā”œā”€ā”€ css_generator.py     # CSS generation
│   └── figma_sync.sh        # CLI orchestrator
ā”œā”€ā”€ data/                    # Design system JSON
│   ā”œā”€ā”€ figma_design_system_extended.json
│   └── integration_guide.json
ā”œā”€ā”€ css/                     # Generated CSS
ā”œā”€ā”€ scss/                    # Generated SCSS
└── docs/                    # Documentation
```

## šŸš€ Quick Start

### Prerequisites
- Node.js 18+
- Python 3.10+
- Git

### Installation

```bash
# Clone repository
git clone https://github.com/jozrftamson/hermes-figma-prompt-hub-nuxt
cd hermes-figma-prompt-hub-nuxt

# Install dependencies
npm install

# Setup environment
cp .env.example .env.local
# Edit .env.local with your Figma credentials
```

### Environment Variables

```bash
# .env.local
NUXT_FIGMA_API_TOKEN=figd_xxxx...
NUXT_FIGMA_FILE_ID=ABC123DEF456
NUXT_FIGMA_TEAM_ID=optional_team_id
NUXT_FIGMA_WEBHOOK_SECRET=your_webhook_secret
```

### Running Locally

```bash
# Development server
npm run dev
# Visit http://localhost:3000

# Import from Figma
npm run figma:import

# Validate prompts
npm run validate:prompts

# Generate CSS/SCSS
npm run styles:build
```

## šŸ“š Documentation

- [Figma Integration Guide](./docs/FIGMA_INTEGRATION_GUIDE.md) — Setup Figma API
- [CSS/SCSS Guide](./docs/CSS_SCSS_GUIDE.md) — Generate styles
- [Validation Guide](./docs/VALIDATION_GUIDE.md) — Validate prompts
- [API Reference](./docs/API_REFERENCE.md) — API endpoints

## šŸ”— API Endpoints

### Prompts
- `GET /api/prompts` — List all prompts
- `POST /api/prompts` — Create prompt
- `GET /api/prompts/:id` — Get prompt detail
- `PUT /api/prompts/:id` — Update prompt
- `DELETE /api/prompts/:id` — Delete prompt

### Figma Integration
- `POST /api/figma/sync` — Trigger sync from Figma
- `POST /api/figma/import` — Import prompts
- `GET /api/figma/status` — Check sync status

## šŸ”§ Scripts

### Figma Operations
```bash
./scripts/figma_sync.sh import          # Import from Figma
./scripts/figma_sync.sh validate        # Validate prompts
./scripts/figma_sync.sh webhook-setup   # Setup webhook
./scripts/figma_sync.sh sync            # Watch mode
```

### CSS Generation
```bash
./scripts/generate_styles.sh css        # Generate CSS
./scripts/generate_styles.sh scss       # Generate SCSS
./scripts/generate_styles.sh build      # Build + minify
./scripts/generate_styles.sh watch      # Watch mode
```

### Validation
```bash
python3 scripts/validate_all.py prompts/
python3 scripts/schema_validator.py prompts/my-prompt.json
python3 scripts/figma_layer_validator.py figma_export.json
```

## 🌐 Deployment

### Vercel

```bash
vercel link
vercel env add NUXT_FIGMA_API_TOKEN
vercel deploy
```

### Docker

```bash
docker build -t hermes-prompt-hub .
docker run -p 3000:3000 \
  -e NUXT_FIGMA_API_TOKEN=... \
  -e NUXT_FIGMA_FILE_ID=... \
  hermes-prompt-hub
```

### GitHub Actions

Auto-sync from Figma:

```yaml
name: Sync Prompts

on:
  schedule:
    - cron: '0 * * * *'  # Hourly
  workflow_dispatch:

jobs:
  sync:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
      - run: pip install requests
      - run: python3 scripts/figma_importer.py
      - run: git add prompts/ && git commit -m "šŸ¤– Sync from Figma" || exit 0
      - run: git push
```

## šŸ“Š Quality Metrics

- **Code Coverage**: >85%
- **Bundle Size**: ~200KB (gzipped)
- **Performance**: Lighthouse >90
- **Accessibility**: WCAG AA compliance

## šŸ¤ Contributing

Contributions welcome! See [CONTRIBUTING.md](./CONTRIBUTING.md)

## šŸ“ License

MIT Ā© 2025 Hermes Figma Prompt Hub

## šŸ”— Links

- [Figma API Docs](https://www.figma.com/developers/api)
- [Nuxt 3](https://nuxt.com)
- [Pinia](https://pinia.vuejs.org)

---

**Built with ā¤ļø for prompt engineers and design systems teams**

## šŸ“‹ Figma Layer Contract

The importer expects Figma PROMPT frames with the following layer structure:

```
PROMPT/example-v1
ā”œā”€ā”€ METADATA (group)
│   ā”œā”€ā”€ title (text)
│   ā”œā”€ā”€ description (text)
│   ā”œā”€ā”€ category (text)
│   ā”œā”€ā”€ strategy (text)
│   └── version (text)
ā”œā”€ā”€ CONTENT (group)
│   ā”œā”€ā”€ system (text)
│   ā”œā”€ā”€ user_template (text)
│   ā”œā”€ā”€ guardrails (text)
│   └── output_format (text)
ā”œā”€ā”€ EXAMPLES (group)
│   └── example_N (frame)
│       ā”œā”€ā”€ input (text)
│       ā”œā”€ā”€ output (text)
│       └── explanation (text)
└── STRATEGY_CONFIG (group)
    ā”œā”€ā”€ num_steps (text)
    └── step_structure (text)
```

### Test Fixtures

Example test fixtures are available in `evals/cases/`:
- `figma_prompt_example_v1.json` — Complete Figma PROMPT frame fixture

Use these fixtures to test the importer without real Figma data:

```bash
python3 scripts/figma_importer.py --fixture evals/cases/figma_prompt_example_v1.json
```

## šŸ¤– MCP Server Integration

Hermes includes a Model Context Protocol (MCP) server for integration with MCP clients like Claude Desktop, Cursor, and other AI assistants.

### Available Tools

- **list_prompts** — Enumerate all prompts in `prompts/raw/`
- **validate_prompt** — Validate a specific prompt against schema
- **get_prompt_stats** — Get collection statistics (strategies, categories, validity)

### Quick Setup

```bash
# Copy config to Claude Desktop
mkdir -p ~/.config/Claude/
cp mcp/claude_desktop_config.json ~/.config/Claude/claude_desktop_config.json

# Edit config with absolute path to your installation
# Restart Claude Desktop
```

### Usage

```bash
# Test from CLI
python3 mcp/server.py list
python3 mcp/server.py validate --filename prompt-1.json
python3 mcp/server.py stats

# In Claude Desktop: "List my prompts" or "Validate prompt-1.json"
```

See [mcp/README.md](mcp/README.md) for detailed documentation.