flutter_mcp_ui_generator

JSON generation toolkit for the Flutter MCP UI runtime. Programmatically create UI definitions with templates, helpers, and a fluent API. Implements the MCP UI DSL 1.3 specification.

Features

  • Widget builders — fluent API for all 77+ widget types in MCP UI DSL.
  • Material 3 theme helpersthemeDefinition, themeColors (28-role + 6 semantic + seed + state layer), themeTypography (15-role), themeSpacing (9-step 8pt grid + layout aliases), themeShape (7-family), themeElevation (6-level with shadow + tint).
  • Binding helpersthemeColor, themeShapeValue, themeElevationValue, plus state and bundle binding helpers.
  • Pre-built patterns — forms, dashboards, lists.
  • Light/dark mode support out of the box.

Quick Start

import 'package:flutter_mcp_ui_generator/flutter_mcp_ui_generator.dart';

final ui = MCPUIJsonGenerator.application(
  metadata: {'title': 'My App'},
  theme: MCPUIJsonGenerator.themeDefinition(
    color: MCPUIJsonGenerator.themeColors(seed: '#3F51B5'),
    typography: MCPUIJsonGenerator.themeTypography(),
    spacing: MCPUIJsonGenerator.themeSpacing(),
  ),
  pages: {
    'home': MCPUIJsonGenerator.page(
      title: 'Home',
      content: MCPUIJsonGenerator.linear(
        direction: 'vertical',
        children: [
          MCPUIJsonGenerator.text(value: 'Hello'),
          MCPUIJsonGenerator.button(label: 'Click', click: () { /* ... */ }),
        ],
      ),
    ),
  },
);

Support

License

MIT — see LICENSE.

Libraries

flutter_mcp_ui_generator
Flutter MCP UI Generator