Dynamic MCP UI Generator

Dynamic MCP UI Generator

A sophisticated server that enables users to create, customize, and generate interactive UI components with features like dynamic form building, dashboard creation, and chart generation through a modern glassmorphism interface.

Category
访问服务器

README

Dynamic MCP UI Generator

A comprehensive full-stack application that demonstrates the power of MCP (Model Context Protocol) UI components with dynamic generation capabilities. This application allows users to create, customize, and generate interactive UI components through a sophisticated MCP server with a modern glassmorphism design.

🚀 Features

Core MCP UI Components

  • Dynamic UI Generation: Create custom forms, dashboards, and charts on-the-fly
  • Real-time Communication: PostMessage API integration for seamless parent-child communication
  • Notification System: Toast notifications for user feedback and system events
  • Modern Glassmorphism Design: Beautiful glass-like UI with backdrop blur effects

Dynamic UI Generation

  • Form Builder: Create custom forms with various field types (text, email, number, select, textarea)
  • Dashboard Builder: Generate analytics dashboards with metrics, lists, and charts
  • Chart Builder: Create bar charts and pie charts with custom data
  • Real-time Preview: See generated components immediately after creation

Advanced MCP Server Features

  • Component Management: Track and manage generated UI components
  • User Data Storage: Store and retrieve user-specific data
  • Dynamic HTML Generation: Server-side HTML generation with embedded JavaScript
  • Responsive Design: All generated components are mobile-friendly

Modern Design System

  • Glassmorphism: Translucent glass-like components with backdrop blur
  • Animated Background: Subtle animated gradient background
  • Modern Typography: Inter font family for clean, readable text
  • Smooth Animations: Fluid transitions and hover effects
  • Responsive Layout: Optimized for all device sizes

🏗️ Project Structure

mcp-ui-poc/
├── client/                 # React frontend
│   ├── src/
│   │   ├── App.jsx        # Main React component with UI builders
│   │   ├── App.css        # Modern glassmorphism styling
│   │   ├── index.css      # Global styles and utilities
│   │   └── main.jsx       # React entry point
│   ├── package.json       # Frontend dependencies
│   └── vite.config.js     # Vite configuration
├── server/                 # Node.js backend
│   ├── index.js           # Express server with API endpoints
│   ├── mcp-server.js      # MCP server for dynamic UI generation
│   └── mcp-ui-example.js  # Static MCP UI example
├── package.json           # Backend dependencies
└── README.md             # Project documentation

🛠️ Installation

  1. Clone the repository

    git clone <repository-url>
    cd mcp-ui-poc
    
  2. Install dependencies

    npm install
    npm run install-all
    
  3. Start the development servers

    # Terminal 1: Start backend server
    npm run dev
    
    # Terminal 2: Start frontend development server
    npm run client
    
  4. Access the application

    • Frontend: http://localhost:3000
    • Backend API: http://localhost:3001

📊 API Endpoints

Health Check

  • GET /api/health - Server status and health information

MCP UI Components

  • GET /api/mcp-ui-example - Get the static MCP UI demo component

Dynamic UI Generation

  • POST /api/generate-form - Generate a custom form UI
  • POST /api/generate-dashboard - Generate a dashboard UI
  • POST /api/generate-chart - Generate a chart UI

Data Management

  • POST /api/store-data - Store user data
  • GET /api/get-data/:userId - Retrieve user data
  • GET /api/component-info/:componentId - Get component information

🎨 UI Components

Form Builder

Create dynamic forms with:

  • Field Types: Text, email, number, select dropdown, textarea
  • Validation: Required field support
  • Customization: Placeholder text, labels, submit button text
  • Real-time Preview: See form changes immediately

Dashboard Builder

Generate analytics dashboards with:

  • Metric Widgets: Display key performance indicators
  • List Widgets: Show activity feeds and data lists
  • Chart Widgets: Embedded data visualizations
  • Responsive Layout: Auto-adjusting grid system

Chart Builder

Create data visualizations:

  • Bar Charts: Horizontal bar charts with custom data
  • Pie Charts: Circular charts with color-coded segments
  • Custom Data: Input values and labels via comma-separated format
  • Export Functionality: Chart export capabilities

🎨 Design System

Glassmorphism Components

  • Translucent Backgrounds: Semi-transparent glass-like surfaces
  • Backdrop Blur: Modern blur effects for depth
  • Subtle Borders: Light borders for definition
  • Soft Shadows: Layered shadow system for depth

Color Palette

  • Primary Gradient: Purple to blue gradient (#667eea to #764ba2)
  • Success Gradient: Blue to cyan (#4facfe to #00f2fe)
  • Warning Gradient: Green to teal (#43e97b to #38f9d7)
  • Danger Gradient: Pink to yellow (#fa709a to #fee140)

Typography

  • Font Family: Inter (Google Fonts)
  • Font Weights: 300, 400, 500, 600, 700
  • Responsive: Fluid typography scaling

Animations

  • Smooth Transitions: 0.3s cubic-bezier easing
  • Hover Effects: Subtle lift and glow effects
  • Loading States: Pulse animations for feedback
  • Background Animation: Subtle gradient shifts

🔧 Technologies Used

Frontend

  • React 18: Modern React with hooks and functional components
  • Vite: Fast build tool and development server
  • CSS3: Advanced styling with glassmorphism effects
  • Inter Font: Modern, readable typography

Backend

  • Node.js: JavaScript runtime
  • Express.js: Web framework for API endpoints
  • CORS: Cross-origin resource sharing
  • @mcp-ui/server: MCP UI server SDK

Development Tools

  • Nodemon: Automatic server restart on file changes
  • ES6 Modules: Modern JavaScript module system

🚀 Scripts

Development

  • npm run dev - Start backend server with nodemon
  • npm run client - Start frontend development server
  • npm run build - Build frontend for production

Installation

  • npm run install-all - Install both frontend and backend dependencies
  • npm run install-client - Install only frontend dependencies
  • npm run install-server - Install only backend dependencies

🎯 Usage Examples

Creating a Custom Form

  1. Navigate to the "Form Builder" tab
  2. Set the form title and submit button text
  3. Add fields with desired types and validation
  4. Click "Generate Form" to create the UI component
  5. The generated form will appear below with full functionality

Building a Dashboard

  1. Go to the "Dashboard Builder" tab
  2. Configure the dashboard title
  3. Add widgets (metrics, lists, charts)
  4. Generate the dashboard to see the interactive component

Creating Charts

  1. Select the "Chart Builder" tab
  2. Choose chart type (bar or pie)
  3. Enter data values and labels
  4. Generate the chart for visualization

🔄 Real-time Features

Form Submission

  • Forms automatically send data to the parent application
  • Real-time notifications show submission results
  • Data can be stored and retrieved via API

Dashboard Interactions

  • Refresh buttons update dashboard data
  • Widget interactions trigger notifications
  • Component state is managed by the MCP server

Chart Export

  • Export functionality for generated charts
  • Notification system for export events
  • Customizable chart appearance and data

🎨 Styling and Design

Modern UI Design

  • Glassmorphism: Translucent glass-like components
  • Animated Background: Subtle gradient animations
  • Responsive Design: Works on all screen sizes
  • Interactive Elements: Hover effects and transitions

Component Styling

  • Custom CSS Variables: Consistent design tokens
  • Grid-based Layouts: Flexible field management
  • Toast Notifications: Different types with animations
  • Tab Navigation: Active states with smooth transitions

🔒 Security and Best Practices

Data Handling

  • User data is stored securely on the server
  • Form submissions are validated and sanitized
  • API endpoints include proper error handling

Component Isolation

  • Generated components run in isolated iframes
  • PostMessage API ensures secure communication
  • No cross-site scripting vulnerabilities

Accessibility

  • Focus States: Clear focus indicators
  • High Contrast: Support for high contrast mode
  • Reduced Motion: Respects user motion preferences
  • Screen Reader: Proper ARIA labels and structure

🚀 Future Enhancements

Planned Features

  • More Chart Types: Line charts, scatter plots, area charts
  • Advanced Form Validation: Custom validation rules and error messages
  • Component Templates: Pre-built templates for common use cases
  • Real-time Collaboration: Multi-user editing and sharing
  • Export Options: PDF, image, and code export capabilities

Technical Improvements

  • Database Integration: Persistent storage for user data
  • Authentication: User accounts and session management
  • Component Library: Reusable UI component system
  • Performance Optimization: Lazy loading and code splitting

Design Enhancements

  • Dark/Light Mode: Theme switching capability
  • Custom Themes: User-defined color schemes
  • Animation Library: Advanced motion design
  • Micro-interactions: Delightful user experience details

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


Built with ❤️ using React, Node.js, and MCP UI technology with modern glassmorphism design

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选