Skip to main content
MCP specifications supports returning resources along with a tool result. We leveraged this mechanism and defined a resource schema for UI resources. When a tool returns a UI resource, the client will render an iframe that embeds the UI described by this UI resource.

UI Resource Schema

Here’s the UI resource schema:

MCP UI Example

Here’s an example of an UI app that can be returned as a Nuwa-Compatible UI resource. You can find the full example here: mcp-ui-demo
app.tsx

createUIResource

The @nuwa-ai/ui-kit provides a helper function for constructing a UI resource to return it as part of the MCP content:

Nuwa Client Functions in MCP UI Resource

When your UI app is rendered as a Nuwa-Compatible UI resource, returned by the MCP server, some of the Nuwa Client functions are not supported: Supported
  • auto connection
  • auto height adjustment
  • theme sync
  • sendPrompt
NOT Supported
  • addSelection
  • saveState/getState
  • createAIStream