explaingit

aisurfer/mcp_ui_app_example

0TypeScriptAudience · developerComplexity · 3/5ActiveSetup · moderate

TLDR

Worked example of an AI chat that embeds interactive forms via the MCP UI extension. Four Docker services show a booking flow where the model returns HTML the React frontend renders inline.

Mindmap

mindmap
  root((mcp-ui-app-example))
    Inputs
      User chat message
      OpenAI API key
      Mock colleague data
    Outputs
      Embedded booking form
      Confirmation card
      Streamed chat text
    Use Cases
      Demo MCP UI flow
      Learn tool-call UI patterns
      Prototype in-chat forms
    Tech Stack
      React
      Vite
      Express
      Docker
      OpenAI

Things people build with this

USE CASE 1

Study a reference implementation of the MCP UI extension end to end

USE CASE 2

Prototype chat agents that render embedded forms instead of plain text replies

USE CASE 3

Wire an Express backend to OpenAI streaming plus MCP tool dispatch

USE CASE 4

Adapt the booking demo into another in-chat workflow such as ticketing

Tech stack

TypeScriptReactViteExpressDockerOpenAIMCP

Getting it running

Difficulty · moderate Time to first run · 30min

Requires Docker Compose and an OpenAI API key in .env before docker compose up will start the four services.

In plain English

This repository is a worked example of an AI chat assistant that can show small interactive forms inside the chat window, not just text. The use case the author picked is booking a meeting with a colleague. You type something like book a meeting with Maria tomorrow, the assistant shows a booking form embedded in the conversation, you pick a time slot and submit, and then the assistant shows a read-only confirmation card with the booking result. The point of the project is to demonstrate the user interface extension to the Model Context Protocol, often shortened to MCP, which is a way for AI agents to call external tools and resources. The code is split into four services that run together with Docker Compose. A React frontend served by Vite on port 5173 shows the chat thread, streams text from the model, and renders the booking form inside an iframe. An Express backend on port 3000 talks to OpenAI in streaming mode, dispatches tool calls over MCP, and pushes events to the browser using server sent events. A separate MCP UI server provides the HTML for the booking form and the result card as MCP resources. A booking service exposes both a small REST API for the form to load colleagues and time slots, and an MCP endpoint that the agent calls to actually create the booking. To run it you need Docker, Docker Compose, and an OpenAI API key in a .env file. After docker compose build and docker compose up, the chat opens at http://localhost:5173. The model defaults to gpt-4o. Source folders are mounted as volumes so edits are picked up without a rebuild. The README is detailed and includes an architecture diagram, a sequence diagram of the booking flow, and tables of REST endpoints, SSE event types, MCP tools, and the five mock colleagues. The repository has 0 stars and reads as a reference implementation rather than a finished product.

Copy-paste prompts

Prompt 1
Walk me through the SSE event flow from the Express backend to the React frontend when a booking form is rendered.
Prompt 2
Help me replace OpenAI with a local model server while keeping the MCP tool dispatch intact.
Prompt 3
Show me how to add a second MCP UI resource, for example an availability calendar, alongside the booking form.
Prompt 4
Swap the mock booking service for a real Google Calendar integration without breaking the iframe contract.
Prompt 5
Add authentication so each chat session sees only its own colleagues and bookings.
Open on GitHub → Explain another repo

Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.