Skip to main content
Glama

UI Preset MCP Server

MCP server for auto-configuring React UI against a swappable design preset system. Integrates with your Monaco IDE to enforce design uniformity across all business builds. Supports glassmorphism, neumorphism, neon cyberpunk, brutalism, soft pastels, aurora gradients, plus new flat/material/healthcare/editorial/minimal styles — a baby Canva for frontend development.

Design precision + JEV decision process (v1.1)

Every project gets a deep, per-project design decision grounded in awesome-design principles and current frontend practice:

Tool

What it does

decide_design_direction

JEV decides style, palette strategy, graphics treatment, precision level, and dark/light over bounded questions whose criteria encode awesome-design + current-practice standards. Offline JEV falls back to a deterministic keyword classifier with the real error reported (never a fabricated decision).

design_brief

The full process: JEV direction → resolve preset on disk → run the deterministic quality gate → export a DESIGN.md contract. "Adheres each time" = decision + quality.passed=true + DESIGN.md emitted.

validate_preset

Deterministic precision gate: valid colors, WCAG AA text contrast vs base bg, spacing on the 4pt grid, strictly increasing type scale, zero unresolved {{token:}} refs. Returns score 0-100 + every finding.

list_preset_quality

Quality score for every preset, sorted. Use it to pick the most precise preset for a project.

export_design_markdown

Exports a preset's tokens as a Stitch/awesome-design-md DESIGN.md (palette, typography, spacing, depth, components, do's/don'ts, agent prompt guide). Deterministic.

Math-enhanced refinement (JEV decides, math improves)

Presets are templates, not final output. design_brief returns both:

  • design_md — the template as-is

  • refined — the template creatively improved by math: JEV picks the strategy (decideRefinement: golden-ratio / perfect-fourth / major-third spacing+type, analogous / complementary / triadic / split-complementary / monochrome harmony, precision, detail), then a deterministic engine applies it:

    • Spacing → golden-ratio scale round4(4·φ^i) kept on the 4pt grid

    • Type → modular scale 0.8125rem · ratio^i (strictly increasing)

    • Color → harmonic accent family derived from the primary hue (HSL offsets)

    • Radius → proportional to the refined scale

Every change is logged in a math_report ({field, before, after, math}), the refined preset passes the quality gate, and a refined DESIGN.md is emitted. This is the deterministic math core (same substance as math-x's Pyodide/SymPy subsystems) computed in-process — no LLM, and math-x's LLM-routed API is not called.

{ "strategy": { "ratio": "golden", "harmony": "complementary", "precision": 1, "detail": 1 },
  "math_report": { "steps": [ { "field": "spacing.scale", "math": "round4(4 × φ^i)" } ] },
  "refined_quality": { "passed": true, "score": 100 },
  "refined_design_md": "# DESIGN.md — Flat Corporate (refined)" }

refine_design tool refines any preset; REST: POST /api/design-brief returns the same shape.

Design grade — the measurable "high-end" bar

grade_design (tool + GET /api/presets/:id/grade) scores every preset S/A/B/C across eight categories: token completeness, WCAG contrast, 4pt spacing, type scale, elevation depth, motion system, component depth (breadth + variants + a11y coverage), and token validity. Deterministic — same preset, same grade.

Full UI-kit generation

generate_ui_kit (tool + GET /api/presets/:id/kit) emits a complete, runnable React + CSS-variables kit from a preset (template or refined): a complete tokens.css (every token flattened, including nested spacing/typography/ animation), every component + variant with tokens resolved to var(--…), an index.ts barrel, and a README. Deterministic, zero LLM.

The component library now ships 22 components with variants, states, and accessibility (aria/role/focus/disabled): Button, Select, Checkbox, Switch, Tabs, Alert, Skeleton, Tooltip, ProgressBar, Badge, EmptyState, Avatar, Pagination, DataTable, StatCard, FormField, Modal, Toast, Sidebar, GlassCard, OptionGroup, NavGroup.

The quality gate is the prerequisite: all 14 presets pass it (muted text in the legacy dark presets was darkened to reach AA — the gate caught the failures).

Marketing creative tokens + design recipes

export_creative_tokens (tool + GET /api/presets/:id/creative-tokens) turns a preset into the numbers a campaign renderer needs: 17 deliverable canvases with a column grid, safe inset and optical type scale; 14 art-direction palettes; 10 display/text pairings; 23 art directions; a gradient recipe and the glass alphas. format=kotlin emits the compiled token object for GrowthOS, and format=looks emits the generated art-direction Kotlin, so the Android renderer and the MCP cannot drift.

design_recipe (tool + GET /api/creative/recipes) turns a plain-language brief into a complete direction: the concept and rationale, look, palette, type pairing with bundled font ids, column grid and safe areas, copy hierarchy with sizes and line limits, visual devices, per-format adaptations, copy rules and anti-patterns. It is deterministic and returns up to four alternates.

curl -s http://127.0.0.1:3101/api/presets/glassmorphic-base/creative-tokens
curl -s "http://127.0.0.1:3101/api/presets/glassmorphic-base/creative-tokens?format=kotlin"
curl -s "http://127.0.0.1:3101/api/presets/glassmorphic-base/creative-tokens?format=looks"
curl -s http://127.0.0.1:3101/api/creative/catalog
curl -s "http://127.0.0.1:3101/api/creative/recipes?goal=autumn%20menu%20for%20a%20bakery&deliverable=menu"

GrowthOS export (writes the generated Kotlin, the test snapshot and the worked recipe kit):

npm run build
GROWTHOS_DIR="C:/Users/tap45/Downloads/phone-apps/marketing-studio" \
  node scripts/export-growthos.mjs

The exporter is deterministic and offline: no LLM, no network, same input -> same bytes. The craft rules and the reference list live in docs/DESIGN-REFERENCES.md in the GrowthOS repo.

New style presets (beyond glassmorphism)

style-flat-corporate, style-material, style-healthcare, style-editorial, style-minimal-light — each extends glassmorphic-base, overrides tokens (palette, type, radius, depth), and inherits components. New base components: DataTable, StatCard, FormField, Modal, Toast.

Env

OG_GLASS_JEV_URL      # default http://127.0.0.1:8080 (System One)
OG_GLASS_JEV_ENABLED  # set 0 to force the offline classifier
OG_GLASS_JEV_TIMEOUT  # seconds per request

Tests

npm test    # build + node --test (11 tests: color math, quality gate, DESIGN.md, JEV)

Related MCP server: @manansiingh/figma-react-mcp-server

Architecture

ui-preset-mcp-server/
├── src/
│   ├── index.ts                    # Server entry point (stdio + HTTP transports)
│   ├── constants.ts                # Shared constants and paths
│   ├── types/
│   │   └── index.ts                # All TypeScript types (tokens, presets, corrections)
│   ├── schemas/
│   │   └── toolSchemas.ts          # Zod validation schemas for every tool
│   ├── services/
│   │   ├── presetLoader.ts         # Reads + deep-merges preset files with caching
│   │   ├── sessionState.ts         # Active preset session management + overrides
│   │   ├── uiCorrector.ts          # AST correction engine (10 correction passes)
│   │   ├── tokenResolver.ts        # Resolves {{token:x.y.z}} placeholders + export generators
│   │   └── fileWatcher.ts          # Hot-reload presets on disk changes (dev mode)
│   ├── tools/
│   │   ├── presetTools.ts          # load_preset, swap_template, list_presets, diff_presets, scaffold_preset
│   │   ├── correctionTools.ts      # autocorrect_component, validate_ui, generate_component, generate_tokens, apply_token_overrides
│   │   └── styleTools.ts           # generate_color_palette, suggest_style, list_style_categories
│   ├── routes/
│   │   └── uiRoutes.ts             # REST API + Design Studio dashboard (GET /, /api/*)
│   └── ui/
│       └── dashboardHtml.ts        # Embedded Design Studio HTML (9 sections)
└── presets/
    ├── glassmorphic-base/          # Core preset (all others inherit from this)
    │   ├── manifest.json
    │   ├── tokens.json             # Full design token system
    │   ├── components/
    │   │   ├── shell/Sidebar.json
    │   │   ├── surfaces/GlassCard.json
    │   │   ├── settings/OptionGroup.json
    │   │   └── navigation/NavGroup.json
    │   └── layouts/DashboardLayout.json
    ├── client-fintech/             # Blue accent, dense spacing
    ├── client-saas/                # Purple accent, wider cards
    ├── client-dark-minimal/        # Monochrome, reduced glass intensity
    ├── style-neumorphic/           # Light soft UI, extruded shadows, no blur
    ├── style-neon-cyberpunk/       # Pitch-dark + neon accents, monospace type
    ├── style-brutalist/            # Raw B&W, zero radius, heavy typography
    ├── style-soft-pastel/          # Lavender background, pastel accents, generous rounding
    └── style-aurora/               # Deep navy + iridescent aurora purple/teal accents

MCP Tools

Preset Management

Tool

Description

load_preset

Activate a preset bundle by ID

swap_template

Hot-swap active preset without restart

list_presets

List all available presets

diff_presets

Compare token/component differences between two presets

scaffold_preset

Generate a new preset directory from a parent

get_session_state

Check active preset and runtime overrides

export_creative_tokens

Export deliverable sizes, grid, type scale, palettes, pairings and looks as JSON/Kotlin

design_recipe

Turn a brief into a deterministic art direction with grid, hierarchy and format rules

Correction & Generation

Tool

Description

autocorrect_component

Auto-fix React component against active preset

validate_ui

Validate component and get conformance score (0–100)

generate_component

Generate a component from a preset template

generate_tokens

Export tokens as CSS vars, JS, JSON, or Tailwind config

apply_token_overrides

Layer runtime token overrides on the active preset

Style & Color

Tool

Description

generate_color_palette

Generate a harmonious color palette from a seed hex color using color theory (complementary, triadic, analogous, monochromatic, split-complementary, tetradic)

suggest_style

Get preset + token override suggestions from a natural-language aesthetic description (e.g. "dark hacker terminal", "friendly pastel kids app")

list_style_categories

List all available design style categories with principles, descriptions, and associated presets

Style Categories

Category

Preset

Description

Glassmorphic

glassmorphic-base, client-*

Frosted-glass with backdrop blur, dark substrate

Neumorphic

style-neumorphic

Soft extruded shapes, dual shadows, light background

Neon Cyberpunk

style-neon-cyberpunk

Pitch-dark + vivid neon accents, monospace type

Brutalist

style-brutalist

Raw B&W, zero border-radius, maximum contrast

Soft Pastel

style-soft-pastel

Lavender base, pastel accents, generous rounding

Aurora Gradient

style-aurora

Deep navy + iridescent aurora purple/teal accents

Installation

npm install
npm run build

Usage

stdio (for Monaco IDE integration)

node dist/index.js

HTTP server

TRANSPORT=http PORT=3001 node dist/index.js

Dev mode with hot-reload

WATCH_PRESETS=true node dist/index.js

Design Studio UI

When running in HTTP mode, a Design Studio mini UI is served at GET /.

UI Sections

Section

Description

Dashboard

Active preset overview with component/layout stats and color palette preview

Presets

Browse all presets in cards; click Load to activate any preset instantly

Style Gallery

Visual style category browser — each card shows design principles and a color preview strip; load any style with one click

Palette

Color palette generator — pick a seed color, choose a color harmony rule, and generate a full palette with shades and semantic aliases; apply directly to active preset

Tokens

Visual token viewer — color swatches, typography scale, blur, spacing, animation

Validate

Paste React code and get a conformance score (0–100) with issue list

Correct

Auto-correct React code against the active preset; choose context and mode

Export

Generate CSS custom properties, TypeScript const, JSON, or Tailwind config

Scaffold

Form to create a new preset from any parent with optional accent color

The UI communicates with the server via a REST API also available at /api/*.

REST API (HTTP mode)

Endpoint

Method

Description

/api/presets

GET

List all presets with metadata

/api/presets/load

POST

Load and activate a preset { preset_id }

/api/session

GET

Get active preset and override state

/api/tokens

GET

Get effective tokens for the active preset

/api/tokens/export

POST

Export tokens `{ format: 'css'

/api/tokens/overrides

POST

Apply runtime token overrides { overrides }

/api/validate

POST

Validate React code { code, include_suggestions }

/api/correct

POST

Autocorrect React code { code, context, dry_run }

/api/scaffold

POST

Create new preset { preset_id, name, description, extends, accent_color }

/api/styles

GET

List all design style categories with metadata

/api/palette

POST

Generate color palette { seed_color, harmony, include_shades }

/api/creative/catalog

GET

Full creative catalog: palettes, deliverables, pairings, looks, concepts

/api/creative/recipes?goal=&deliverable=&seed=

GET

Deterministic art directions and alternates

Typical Workflow

1. list_style_categories()                    # Discover available aesthetics
2. suggest_style("dark sci-fi dashboard")     # Get preset recommendation
3. load_preset("style-neon-cyberpunk")        # Activate chosen style
4. const palette = generate_color_palette({ seed_color: "#00ff88", harmony: "triadic" })
5. apply_token_overrides({
     overrides: {
       colors: {
         accent: {
           primary: palette.semantic.accent,
           highlight: palette.semantic.highlight
         }
       }
     }
   })
6. autocorrect_component(code)               # Fix component on save
7. validate_ui(code)                         # Get conformance score
8. generate_tokens({ format: "css" })        # Export CSS variables
9. scaffold_preset({ preset_id: "client-x", extends: "style-aurora" })

Creating New Presets

New presets only need to override tokens that differ from the parent:

// presets/client-newbrand/tokens.json
{
  "colors": {
    "accent": {
      "primary": "#e11d48"
    }
  }
}
// presets/client-newbrand/manifest.json
{
  "id": "client-newbrand",
  "name": "New Brand",
  "extends": "glassmorphic-base",
  "version": "1.0.0",
  "styleCategory": "glassmorphic",
  "designPrinciples": ["backdrop-blur", "dark-substrate"],
  "tags": ["custom"],
  "components": [],
  "layouts": []
}

All base tokens, components, and layouts are inherited automatically.

Correction Rules

The correction engine enforces these rules on every component:

  • no-hardcoded-colors (error): All color values must use CSS custom properties

  • no-hardcoded-spacing (warning): Spacing should use the token scale

  • enforce-glass-surface (error): Surface elements must have backdropFilter + semi-transparent bg

  • no-hardcoded-font-family (error): Font families must use typography tokens

  • use-animation-tokens (warning): Transitions must use animation tokens

  • enforce-sidebar-components (error): Sidebar content must use NavGroup/NavItem

  • enforce-settings-components (error): Settings UI must use OptionGroup/OptionRow

  • a11y-img-alt (warning): Images must have alt attributes

  • a11y-icon-button-label (warning): Icon buttons need aria-label

Monaco Integration

In your Monaco editor, call autocorrect_component on the save event:

editor.onDidSaveModel(async () => {
  const code = editor.getValue();
  const result = await mcpClient.callTool('autocorrect_component', {
    code,
    context: 'auto',
    dry_run: false
  });
  if (result.corrected !== code) {
    editor.setValue(result.corrected);
  }
});

Available Tools

14 tools
apply_token_overridesApply Token OverridesA

Apply runtime token overrides on top of the active preset (deep merged). Overrides are applied in memory only unless persist: true writes them to disk. Useful for per-client accent color changes without creating a full preset.

Args:

  • overrides (object): Partial DesignTokens object (deeply merged over active tokens)

  • persist (boolean): Write overrides to preset/overrides.json on disk (default: false)

Example overrides: { "colors": { "accent": { "primary": "#2563eb" } } }

Returns: Confirmation of applied override paths. Requires active preset.

Inputs: overrides (required), persist.

autocorrect_componentAutocorrect ComponentA

Analyze a React component and auto-correct it against the active preset. Corrects: hardcoded colors, missing glass treatment, wrong typography tokens, wrong animation tokens, non-conforming sidebar/settings structure.

Args:

  • code (string): React component source code (max 10,000 chars)

  • context ('sidebar'|'settings'|'dashboard'|'surface'|'navigation'|'form'|'auto'): Component context hint for targeted rules (default: 'auto')

  • dry_run (boolean): Return issues without changing code (default: false)

Returns:

  • corrected: Fixed component code

  • issues: Array of UIIssue objects with severity, rule, message, fix

  • appliedFixes: List of changes made

  • score: Conformance score before correction (0-100)

Requires active preset (run load_preset first).

Inputs: code (required), context, dry_run.

diff_presetsDiff PresetsA
Read-onlyIdempotent

Compare two presets and return what changed between them. Useful for understanding what a client override changes vs the base.

Args:

  • preset_a (string): First preset ID

  • preset_b (string): Second preset ID

  • scope ('tokens' | 'components' | 'layouts' | 'all'): What to compare (default: 'all')

Returns: Object with added, removed, and changed keys with before/after values.

Inputs: preset_a (required), preset_b (required), scope.

generate_color_paletteGenerate Color PaletteA
Read-onlyIdempotent

Generate a harmonious color palette from a seed hex color using color theory.

Args:

  • seed_color (string): 6-digit hex color (e.g. '#6366f1')

  • harmony ('complementary'|'triadic'|'analogous'|'monochromatic'|'split-complementary'|'tetradic'): Color harmony rule (default: 'complementary')

  • include_shades (boolean): Include 10-step lightness shades 50–900 (default: true)

Returns:

  • seed: Input color

  • hsl: Hue, saturation, lightness of seed

  • harmony: Harmony type used

  • colors: Named harmony colors (primary, complement, etc.)

  • semantic: foreground, background, muted, surface aliases

  • shades: 50–900 shade scale (if include_shades is true)

Use the result to populate apply_token_overrides or scaffold_preset.

Inputs: seed_color (required), harmony, include_shades.

generate_componentGenerate ComponentA
Read-onlyIdempotent

Generate a React component from a preset template, with tokens resolved. Templates come from the active preset's component library.

Args:

  • template_name (string): Component template to generate (e.g. 'GlassCard', 'Sidebar', 'OptionGroup')

  • props (object): Props to inject into the template (default: {})

  • variant (string, optional): Template variant (e.g. 'compact', 'wide', 'collapsible')

Returns:

  • code: Generated React component with tokens resolved

  • templateUsed: Name of the resolved template

  • availableProps: Schema of props the template accepts

Run list_presets with include_metadata to see available templates. Requires active preset.

Inputs: template_name (required), props, variant.

generate_tokensGenerate TokensA
Read-onlyIdempotent

Export the active preset's design tokens in various formats for use in your project.

Args:

  • format ('css'|'js'|'json'|'tailwind'): Output format (default: 'css')

    • css: :root { --color-surface: ...; } CSS custom properties

    • js: TypeScript const export for use with style objects

    • json: Raw token JSON

    • tailwind: theme.extend config for tailwind.config.js

  • include_comments (boolean): Add section headers in output (default: true)

Returns: Token file content as a string. Requires active preset.

Inputs: format, include_comments.

get_session_stateGet Session StateA
Read-onlyIdempotent

Returns the current session state including active preset ID, load time, and any runtime token overrides.

Returns:

  • activePresetId: Currently loaded preset

  • loadedAt: When the preset was activated

  • hasOverrides: Whether runtime overrides are applied

  • overrideKeys: Top-level override keys

Inputs: no named parameters.

list_presetsList PresetsA
Read-onlyIdempotent

List all available presets in the presets directory. Optionally includes full manifest metadata for each preset.

Args:

  • include_metadata (boolean): Include full manifest for each preset (default: false)

Returns: Array of preset IDs, or array of preset manifests if include_metadata is true.

Inputs: include_metadata.

list_style_categoriesList Style CategoriesA
Read-onlyIdempotent

List all available design style categories with descriptions, design principles, and associated presets.

Args:

  • include_presets (boolean): Include preset IDs for each category (default: true)

Returns: Array of style categories with metadata. Use with suggest_style and load_preset to explore the design system.

Inputs: include_presets.

load_presetLoad PresetA
Idempotent

Activate a UI preset bundle by ID. Loads all tokens, component templates, and layout templates. Resolves inheritance (extends) chain automatically, deep-merging parent tokens. Must be called before any correction, validation, or generation tools.

Args:

  • preset_id (string): Folder name in /presets (e.g. 'glassmorphic-base', 'client-fintech')

  • force_reload (boolean): Bypass cache and re-read from disk (default: false)

Returns: Preset manifest summary and token count confirmation. Error: "Preset 'x' not found" if the preset directory doesn't exist.

Inputs: preset_id (required), force_reload.

scaffold_presetScaffold PresetA

Create a new preset directory with manifest and token override scaffold, inheriting from a parent preset. Generates a ready-to-customize preset structure on disk.

Args:

  • preset_id (string): Kebab-case ID for the new preset (e.g. 'client-banking')

  • extends (string): Parent preset to inherit from (default: 'glassmorphic-base')

  • name (string): Human-readable display name

  • description (string): Short description

  • accent_color (string, optional): Override accent color in the scaffolded tokens

Returns: Path to new preset directory and files created.

Inputs: preset_id (required), name (required), description (required), extends, +1 more.

suggest_styleSuggest StyleA
Read-onlyIdempotent

Get a style preset and token override suggestions based on a natural-language aesthetic description.

Args:

  • description (string): Describe the desired look and feel (e.g. 'dark hacker terminal', 'friendly pastel kids app', 'professional fintech dashboard')

  • output_format ('preset_id'|'tokens'|'full'): What to return (default: 'full')

    • preset_id: Just the best matching preset ID

    • tokens: Just the suggested token overrides

    • full: Preset ID, token overrides, category info, and reasoning

Returns matching preset and style suggestions.

Inputs: description (required), output_format.

swap_templateSwap TemplateA

Hot-swap the active preset without restarting the server. Useful for switching between client presets while building. Optionally preserves any runtime token overrides applied in the current session.

Args:

  • preset_id (string): The preset to switch to

  • preserve_overrides (boolean): Keep current overrides after swap (default: false)

Returns: New active preset summary.

Inputs: preset_id (required), preserve_overrides.

validate_uiValidate UIA
Read-onlyIdempotent

Validate a React component against the active preset rules without modifying code. Returns a conformance score (0–100) and detailed issue list.

Args:

  • code (string): React component source code

  • include_suggestions (boolean): Include info-level suggestions (default: true)

Returns:

  • valid (boolean): No errors found

  • score (number): 0–100 conformance score

  • issues: Array of { severity, rule, message, fix } objects

  • presetUsed: Which preset was applied

Requires active preset.

Inputs: code (required), include_suggestions.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 14 tools

    Disambiguation4/5

    Most tools have distinct purposes, but there is some overlap between autocorrect_component and validate_ui, as both analyze React components for conformance. However, autocorrect_component focuses on auto-correction while validate_ui is for validation only, and their descriptions clarify this difference. All other tools target clearly separate operations like preset management, token generation, and style suggestion.

    Naming Consistency5/5

    All tool names follow a consistent snake_case pattern with clear verb_noun structures, such as apply_token_overrides, generate_color_palette, and load_preset. There are no deviations in naming conventions, making the set predictable and easy to understand.

    Tool Count5/5

    With 14 tools, the server covers a comprehensive scope for UI preset management, including preset loading, token manipulation, component generation, correction, validation, and style suggestion. Each tool serves a specific function without redundancy, fitting well within the typical 3-15 tool range for a focused domain.

    Completeness5/5

    The tool set provides complete coverage for UI preset workflows, including CRUD-like operations for presets (list, load, scaffold, swap), token handling (apply, generate, diff), component interaction (generate, autocorrect, validate), and auxiliary functions like style suggestion and session state. There are no obvious gaps, enabling agents to perform end-to-end tasks without dead ends.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers