Skip to main content
Add a 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

Add the integration

The integration has three files:

Install A2UI

Install the A2UI React renderer and its core message processor:
A2UI depends on Zod 3, while mcp-use tool schemas use Zod 4. Add an overrides block to package.json so npm gives the A2UI packages their own Zod 3 copy:
package.json
Run 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 in structuredContent, 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 a MessageProcessor: createSurface, updateComponents, and updateDataModel. <A2uiSurface> renders the resulting surface and keeps its bound values in local state.
views/generative-ui/view.tsx
Copy 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:
Open the Inspector URL printed by the CLI, select Chat, and sign in with Manufact or configure a model provider. Try:
The model calls 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 /key binding 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 component union in catalog.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.
See the complete A2UI example for the runnable project and catalog tests, the A2UI React renderer, and A2UI inside MCP Apps. For streaming partial specs into the view while the model writes them, see Generative UI.