MCP UI
xmcp is compatible with MCP UI, which can be used to build interactive interfaces for your MCP server.
Installation
In your current xmcp project, install the following dependency:
pnpm i @mcp-ui/serverCreate a UI resource
You can create a UI resource for your MCP server using the createUIResource function. It allows you to define UI snippets on the server-side, which can then be seamlessly and securely rendered on the client.
Direct HTML (Text Encoding)
Direct HTML content delivered as plain text:
Output:
Direct HTML (Base64 Blob)
Direct HTML content delivered as a Base64-encoded blob:
Output:
External URL (Text Encoding)
External URL delivered as plain text for iframe embedding:
Output:
External URL (Blob Encoding)
External URL delivered as a Base64-encoded blob:
Output:
Remote DOM Script
Remote DOM script for building interactive components:
Output:
Usage
UI resources are served through tools in your MCP server. This works with both standalone applications and projects where xmcp is integrated, like Next.js or Express.
In xmcp, simply return the UI resource in your tool's content array: