Why Use FrontMCP UI?
When your MCP tools return data, AI platforms typically display it as raw text or JSON. FrontMCP UI lets you create visual widgets that make your tool outputs more useful and engaging.Plain Text Response
With FrontMCP UI
A beautifully styled weather card with icons, formatted temperatures, and visual humidity indicators.
Key Features
Multi-Framework Support
Build widgets with HTML strings, React components, or MDX (Markdown + JSX). The renderer auto-detects your template type.
Platform-Aware
Works across OpenAI, Claude, and Gemini with automatic platform detection and fallbacks for different capabilities.
Built-in Components
Pre-built components for buttons, cards, badges, alerts, forms, tables, and more with consistent styling.
Theming System
Customize colors, typography, and spacing. Includes dark mode support and CSS variable integration.
Zod Validation
All component inputs are validated with Zod schemas. Invalid options render helpful error boxes instead of crashing.
HTMX Integration
Add dynamic interactions without JavaScript using HTMX attributes for server-driven updates.
OpenAI Resource Widgets
Render App SDK-ready cards, lists, and previews for documents, tasks, and media without rebuilding layouts.
Platform Support
FrontMCP UI adapts to different AI platform capabilities:| Platform | Network | Widget Display | Response Format |
|---|---|---|---|
| OpenAI | Full | Inline, Fullscreen, PiP | _meta['ui/html'] |
| ext-apps | Full | Inline, Fullscreen, PiP | _meta['ui/html'] |
| Cursor | Full | Inline | _meta['ui/html'] |
| Claude | Blocked | Artifacts | Dual-payload |
| Gemini | Limited | Basic | JSON only |
With
servingMode: 'auto' (default), unsupported platforms automatically receive JSON-only responses—no broken widgets.Architecture
Tool UI metadata at a glance
Every@Tool exposes a ui block that describes how the widget should render across hosts. Configure these settings once and the renderer keeps your UX consistent everywhere.
| Setting | Controls | Use it when |
|---|---|---|
displayMode | Whether the widget renders inline, fullscreen, or picture-in-picture | Highlight dashboards inline or promote immersive flows into fullscreen/PiP. |
servingMode | How HTML is delivered (auto, inline, static, hybrid, URL-based). Default: 'auto' | Let FrontMCP select the best format per platform, or force a specific mode. |
htmlResponsePrefix | Text shown before HTML in Claude’s dual-payload format | Customize the artifact description for better Claude UX. |
widgetAccessible | Allows widgets to call tools through the MCP Bridge | Create follow-up actions (retry, escalate, schedule) directly from the UI. |
csp | Allowed domains for scripts, images, fonts, and network calls | Restrict remote dependencies per platform and satisfy Claude’s strict CSP. |
hydrate | Ships the React runtime for client-side interactivity | Power forms, tabs, and charts that need local state or event handlers. |
OpenAI App SDK resource widgets
Need a richer layout than a single card?@frontmcp/ui ships resourceWidget, resourceList, resourceItem, codePreview, and imagePreview helpers so your responses match OpenAI Apps SDK expectations without manual HTML.
/docs/ui/components/resource-widgets for the full API surface plus preview helpers.
Quick Example
Add a visual widget to your tool in just a few lines:src/tools/weather.tool.ts
Installation
@frontmcp/ui has a peer dependency on react for React/MDX templates.
If you only use HTML templates, React is optional.
