mcp-ui-server Overview
The mcp-ui-server package provides utilities to generate UI resources (UIResource) on your MCP server. It allows you to define UI snippets on the server-side, which can then be seamlessly and securely rendered on the client.
MCP Apps Compatibility
The create_ui_resource function creates UIResource objects that work with both MCP Apps hosts (via _meta.ui.resourceUri) and legacy MCP-UI hosts.
For the recommended MCP Apps pattern with TypeScript, see Getting Started.
For a complete example, see the python-server-demo.
Key Exports
create_ui_resource(options_dict: dict[str, Any]) -> UIResource: The primary function for creating UI snippets. It takes a dictionary of options to define the URI, content (direct HTML or external URL), and encoding method (text or blob).
Purpose
- Ease of Use: Simplifies the creation of valid
UIResourceobjects. - Validation: Includes basic validation (e.g., URI prefixes matching content type).
- Encoding: Handles Base64 encoding when
encoding: 'blob'is specified. - MCP Integration: Proper integration with the MCP Python SDK using
EmbeddedResource.
Installation
Install the package using pip or your preferred package manager:
pip install mcp-ui-serverOr with uv:
uv add mcp-ui-serverBuilding
This package is built using Python's standard build tools and distributed via PyPI. It includes full type annotations and is compatible with Python 3.10+.
To build the package from source:
uv buildSee the Server SDK Usage & Examples page for practical examples.

