Skip to main content

@leanmcp/ui

Build rich, interactive MCP Apps with React components designed for the Model Context Protocol. Features first-class tool integration, streaming support, and automatic host theming.

Features

MCP-Native Components

ToolButton, ToolDataGrid, ToolForm - components that directly integrate with MCP tools

Dual Platform Support

Works with ext-apps hosts (Claude Desktop) and ChatGPT GPT Actions

Host Theming

Automatic theme sync with host application (light/dark mode)

Testing Utilities

MockAppProvider for unit testing MCP App components

Installation

Import the styles in your app entry point:

Two App Paradigms

@leanmcp/ui supports two different host environments:

ext-apps (Claude Desktop, MCP Hosts)

Uses the @modelcontextprotocol/ext-apps protocol for iframe-based communication.

ChatGPT GPT Actions

Uses ChatGPT’s native window.openai SDK.

Quick Start Example

Here’s a complete example showing a tool-linked UI component:

Server-Side Integration

Link UI components to tools using the @UIApp decorator (for ext-apps) or @GPTApp decorator (for ChatGPT):
When the tool is called, the host will render the linked UI component with the tool result.

Testing

Use MockAppProvider for unit testing:

What’s Next

Components

ToolButton, ToolDataGrid, ToolForm, and more

Hooks

useTool, useResource, useMessage, useHostContext

GPT Apps & Decorators

ChatGPT integration, @UIApp, @GPTApp decorators

Examples

Complete working examples