Skip to content

A manager-focused web app to build, manage, and deploy custom dynamic forms for class action lawsuit payouts. Built with Next.js, PrimeReact, and React Hook Form.

Notifications You must be signed in to change notification settings

XYIAN/form-flow

Repository files navigation

Form Flow - MCP-Powered Form Builder

A revolutionary form builder application built on the Model Context Protocol (MCP) architecture. Form Flow demonstrates advanced MCP implementation patterns for form creation, field management, and data processing.

πŸ—οΈ MCP Architecture Overview

Form Flow is built around a sophisticated MCP (Model Context Protocol) system that separates business logic from UI components, providing:

  • Centralized Business Logic: All form operations handled by dedicated MCP implementations
  • Performance Tracking: Built-in execution time monitoring and performance metrics
  • Comprehensive Logging: Detailed console logging for debugging and monitoring
  • Error Handling: Standardized error reporting and recovery mechanisms
  • Type Safety: Full TypeScript support with strict type checking

πŸ”§ MCP Implementations

Core MCPs

FormMCP - Form Management

// Create, validate, and manage forms
const result = FormMCP.createForm(formData, userId)
const validation = FormMCP.validateFormData(data)
const sanitized = FormMCP.sanitizeFormData(data)

FieldMCP - Field Operations

// Render, validate, and manage form fields
const renderResult = FieldMCP.render(fieldProps)
const validation = FieldMCP.validateField(field)
const component = FieldMCP.getComponent(fieldType)

SubmissionMCP - Data Processing

// Process form submissions with validation
const result = SubmissionMCP.processSubmission(submissionData, formId)
const validation = SubmissionMCP.validateSubmission(data, form)

Advanced MCPs

CSVParserMCP - Intelligent CSV Processing

  • Smart delimiter detection and quote handling
  • Data type analysis with confidence scoring
  • Pattern recognition for emails, phones, dates, URLs
  • Data quality metrics (completeness, consistency, validity)

FieldTypeDetectorMCP - AI-Powered Field Detection

  • Multi-strategy detection (pattern, semantic, statistical, contextual)
  • Semantic analysis of column names
  • Statistical analysis for data distribution
  • Confidence scoring and alternative suggestions

FormGeneratorMCP - Automated Form Creation

  • Coordinates CSV processing MCPs
  • Intelligent field type selection
  • Automatic validation rule generation
  • Form preview and complexity analysis

🎨 Component Architecture

Modular Design

  • FormBuilderTabs: Main tab container with clean separation of concerns
  • ManualFormTab: Dedicated manual form building interface
  • CSVUploadTab: Specialized CSV processing and template management
  • MCPStatusIndicator: Real-time MCP operation status
  • MCPPerformanceDisplay: Performance metrics visualization
  • MCPHealthDashboard: System health monitoring

CSV Template System

Professional template library with 5 pre-built templates:

  • Contact Information Form: Name, email, phone, company, address
  • Event Registration Form: Attendee info, dietary restrictions, emergency contacts
  • Customer Satisfaction Survey: Rating scales, feedback, permission tracking
  • Job Application Form: Complete application with experience, education, references
  • Product Feedback Form: Bug reports, feature requests, technical details

πŸš€ Key Features

MCP-Powered Form Creation

  • Manual Builder: Drag-and-drop interface with 25+ field types
  • CSV Import: Upload CSV files with intelligent field type detection
  • Template System: Pre-built templates with one-click downloads
  • Real-time Processing: Live preview with MCP status indicators

Advanced Field Types

  • Basic Inputs: text, email, password, number, url, search
  • Date & Time: date, datetime, time, month, week, year
  • Advanced Text: textarea, rich-text, markdown
  • Selection: select, multiselect, checkbox, radio, yesno, toggle
  • Financial: money, percentage, currency
  • Contact: phone, address, country, state, zipcode
  • File & Media: file, image, signature, audio, video
  • Rating & Scale: rating, slider, range, likert
  • Specialized: color, tags, autocomplete, location, matrix

MCP Logging & Monitoring

// Enhanced console logging with detailed MCP information
console.log('πŸ”§ MCP: createForm βœ…')
console.log('πŸ“₯ Input Data:', sanitizedInput)
console.log('πŸ“€ Result Data:', result)
console.log('⏱️ Performance Metrics:', executionTime)
console.log('πŸ” MCP Metadata:', metadata)

πŸ› οΈ Tech Stack

  • Frontend: Next.js 15.3.4, React 19.0.0
  • UI Framework: PrimeReact 10.9.6 with Lara Dark Purple theme
  • Form Handling: React Hook Form 7.58.1
  • Styling: Tailwind CSS + PrimeFlex
  • State Management: React Context API
  • Type Safety: TypeScript 5
  • MCP Architecture: Custom Model Context Protocol implementation

πŸ“¦ Installation & Setup

  1. Clone the repository:
git clone <repository-url>
cd form-flow-mcp
  1. Install dependencies:
npm install
  1. Run the development server:
npm run dev
  1. Open your browser to http://localhost:3000

πŸ” MCP Development

Adding New MCPs

// 1. Create MCP implementation
export class NewMCP {
  static operation(data: any): MCPResult<any> {
    const tracker = MCPLogger.createPerformanceTracker('operation')
    
    try {
      // Your business logic here
      const result: MCPResult<any> = {
        success: true,
        data: processedData,
        metadata: {
          executionTime: tracker.end(),
          operation: 'operation',
          timestamp: new Date(),
        },
      }
      
      MCPLogger.log('operation', data, result)
      return result
    } catch (error) {
      // Error handling
    }
  }
}

MCP Logging Configuration

// Configure MCP logging
MCPLogger.configure({
  debug: true,
  logLevel: 'debug',
  enablePerformanceTracking: true,
  onLog: (level, operation, message, data, executionTime) => {
    // Custom logging callback
  }
})

πŸ“Š Performance Monitoring

The MCP system includes comprehensive performance tracking:

  • Execution Time Monitoring: Track operation performance
  • Memory Usage: Monitor resource consumption
  • Error Rate Tracking: Monitor system health
  • Real-time Metrics: Live performance dashboard

πŸ§ͺ Testing MCPs

// Test MCP operations
import { FormMCP, FieldMCP } from '@/lib/mcp'

// Test form creation
const formResult = FormMCP.createForm(testData, userId)
console.assert(formResult.success, 'Form creation should succeed')

// Test field rendering
const fieldResult = FieldMCP.render(fieldProps)
console.assert(fieldResult.success, 'Field rendering should succeed')

πŸ“ˆ Browser Console Logging

Form Flow provides extensive console logging for MCP operations:

  • πŸ”§ MCP Operations: Detailed operation logs with status indicators
  • πŸ“₯ Input Data: Sanitized input data logging
  • πŸ“€ Result Data: Complete result information
  • ⏱️ Performance Metrics: Execution time and performance data
  • ❌ Error Details: Comprehensive error information
  • ⚠️ Warnings: System warnings and recommendations

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/new-mcp
  3. Implement your MCP following the established patterns
  4. Add comprehensive logging and error handling
  5. Test your implementation thoroughly
  6. Submit a pull request

πŸ“„ License

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

πŸ™ Acknowledgments

  • Built with the Model Context Protocol (MCP) architecture
  • Powered by Next.js and React
  • UI components from PrimeReact
  • Form handling by React Hook Form

Form Flow - Demonstrating the power of MCP architecture in modern web applications.

About

A manager-focused web app to build, manage, and deploy custom dynamic forms for class action lawsuit payouts. Built with Next.js, PrimeReact, and React Hook Form.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages