Skip to main content

MCP UI Components Tool

Renders interactive HTML components that display inside the chat interface. Uses a template system with versioned templates for emails, tickets, demos, and more.

  • Tech: TypeScript, MCP SDK, React + Vite (for building template bundles)
  • Port: 3004

Tools

ToolDescription
ui_renderRender any registered template with data
ui_list_templatesList all available templates
ui_demo_interactiveRender an interactive demo component
show_weatherRender a weather widget (fetches from OpenWeatherMap)
show_last_emailRender last email viewer (mock Outlook data)

ui_render

Renders a template by ID with provided data.

Input:

FieldTypeRequiredDescription
templateIdstringYesTemplate identifier (e.g., email/compose@v1)
dataobjectYesData to populate the template

Available Templates

Template IDDescription
email/compose@v1Email composition form
email/sent@v1Email sent confirmation
tickets/list@v1Ticket list display
demo/interactive@v1Interactive demo component
common/error@v1Error display
common/people-list@v1People list display

UI Actions

Templates can emit actions via postMessage that route back through the system:

Action TypeDescription
toolTrigger another MCP tool call
promptSend a prompt back to the LLM
linkOpen an external URL
notifyShow a notification

Example Flow (Email Compose)

User asks to compose an email
--> LLM calls ui_render with email/compose@v1 template
--> HTML form rendered in chat interface
--> User fills in and clicks Send
--> postMessage action triggers Outlook MCP tool
--> Email sent via Microsoft Graph API
--> ui_render shows email/sent@v1 confirmation

Rendering

Templates are built as React + Vite apps, compiled to self-contained HTML bundles. They render inside sandboxed iframes in the chat interface. Communication between the iframe and the host is done via postMessage.