UI Preset MCP Server
Enables auto-configuration and validation of React components against a glassmorphic design token system using an AST correction engine. It supports managing UI presets, enforcing design uniformity in Monaco IDE, and exporting tokens as CSS, Tailwind, or JavaScript variables.
README
UI Preset MCP Server
MCP server for auto-configuring React UI against a swappable glassmorphic preset system. Integrates with your Monaco IDE to enforce design uniformity across all business builds.
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
│ ├── routes/
│ │ └── uiRoutes.ts # REST API + Design Studio dashboard (GET /, /api/*)
│ └── ui/
│ └── dashboardHtml.ts # Embedded glassmorphic Design Studio HTML (7 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
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 |
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 |
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 glassmorphic 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 |
| 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 } |
Typical Workflow
1. load_preset("glassmorphic-base") # Activate base preset
2. autocorrect_component(code) # Fix component on save
3. validate_ui(code) # Get conformance score
4. generate_tokens({ format: "css" }) # Export CSS variables
5. swap_template("client-fintech") # Switch to client variant
6. scaffold_preset({ preset_id: "client-x" })# Create new client preset
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",
"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);
}
});
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。