render-ui tool that renders model-generated A2UI layouts inside an MCP App. The model writes the component layout and initial data as tool arguments, and the stock A2UI React renderer displays them in the view.
The server needs no model API key or agent runtime. The host’s chat model generates the tool arguments.
Try the live example
Ask the chat for a UI. Pick a suggestion or describe your own layout, then edit the inputs, sliders, and checkboxes in the result. Open the example in a new tab.Prerequisites
- A working mcp-use server that can build MCP App views.
- Node.js 22.22.2 or later.
Add the integration
The integration has three files:Install A2UI
Install the A2UI React renderer and its core message processor:overrides block to package.json so npm gives the A2UI packages their own Zod 3 copy:
package.json
npm install again after adding the overrides.
Define the component catalog
The catalog is a subset of A2UI’s basic catalog: Text, Row, Column, Card, Divider, TextField, CheckBox, Slider, and ChoicePicker. The refinement rejects specs the renderer cannot display, such as duplicate IDs, unreachable components, missing bindings, and initial values of the wrong type.views/generative-ui/catalog.ts
Register the tool
The tool description is the model’s only guide to the catalog, so it lists every component, the binding rules, and a small example. The callback returns the validated spec instructuredContent, and view attaches the generative-ui view to the result.
src/index.ts
Render the spec in the view
The view waits for the completed tool result, then passes three standard A2UI v0.9 messages to aMessageProcessor: createSurface, updateComponents, and updateDataModel. <A2uiSurface> renders the resulting surface and keeps its bound values in local state.
views/generative-ui/view.tsx
view.css from the example for the theme, or remove the ./view.css import to use A2UI’s default styles.
Try it
Start your server:render-ui, and the view appears when the tool result completes. To test without a model, select Tools → render-ui and enter:
Adapt it to your app
- Local state only: inputs, checkboxes, sliders, and choices edit the view’s data model. Components that share a
/keybinding update together. Edits are not sent back to the server and reset when the host recreates the view. - Add components: add the A2UI component shape to the
componentunion incatalog.ts, then describe it in the tool description so the model knows when to use it. - Add actions: this recipe has no submit buttons or server actions. To act on user input, call a server tool from the view with
useCallTool. - Other hosts: the view carries its own A2UI renderer, so any MCP Apps host can display it without registering an A2UI catalog.