mcp-apps-builder
Skill2.1k starsChanged 7 months agoMITView on GitHub
Build MCP Apps with interactive React UIs using the Leanmcp UI SDK. Use this skill when users ask for "MCP with UI", "MCP App", "interactive MCP", "leanmcp UI", "MCP dashboard", or want to create rich visual interfaces for their MCP tools. This skill covers @UIApp decorator, React components with useTool/useResource hooks, ToolDataGrid, ToolForm, ToolButton, and ChatGPT Apps support.
7 other projects use a version of this.
Trending
Quiet since April.thin dataabout the whole repository
Most recently taken up by
- awslabs/cli-agent-orchestratortheir own version, first seen Nov 6, 2026
- mcp-use/mcp-usetheir own version, first seen Nov 6, 2026
- Leanmcp/superview.shword for word, first seen Oct 13, 2026
- chatgptprojects/claude-codeword for word, first seen Oct 8, 2026
- Leanmcp/gateway-skillsword for word, first seen Oct 8, 2026
- TommyKisly/f1-mcptheir own version, first seen Jul 10, 2026
Who's talking about chatgptprojects/clear-code
- karthink/gptel-agent“The Claude Code source code has leaked, probably bringing a massive boost to open source projects such as …”GitHub · Mar 31, 2026 · 1 reactions
- ProSkillsMD/proskills“[SUBMISSION] clear-code”GitHub · Apr 20, 2026
The biggest 2 of 2 mentions linking to the repository that our crawl found. Each line is their own headline.
Other versions7 projects use a version of this.
Word for word · 3
- Leanmcp/superview.sh★ 2.1k100% same
- chatgptprojects/claude-code★ 2.1k100% same
- Leanmcp/gateway-skills★ 2.1k100% same
Edited · 0
None found.
Wrote their own version · 4
- mcp-use/mcp-use★ 11ksame name
- awslabs/cli-agent-orchestrator★ 1.5ksame name
- kstonekuan/splatter-mcp-app★ 11same name
- TommyKisly/f1-mcp★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository16 other files it gives its agents.
- claude-code-devSkill
- analyze-exportsSkill
- code-explanationSkill
- fireworks-inferenceSkill
- godot-city-game-3dSkill
- ios-bootstrap-testflightSkill
- leanmcp-builderSkill
- mcp-builderSkill
- posthog-adblock-bypassSkill
- publicity-distributionSkill
- research-observabilitySkill
- research-paper-integritySkill
- security-reproSkill
- tinker-training-inferenceSkill
- translate-explanationSkill
- vuln-reproSkill
The file
We split this skill into the rules it gives an agent
12 rules. 0 are common, 3 are distinctive, and 9 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 263
Use dataTool not toolName
- Very specific: line 264
Use key/header not field/headerName
- Distinctive: line 304
Call MCP tools programmatically:
- Very specific: line 582
Create .tsx files alongside service index.ts files
- Very specific: line 583
Use @UIApp on methods paired with @Tool
- Very specific: line 584
Import from @leanmcp/ui/server in service files
- Very specific: line 585
Import from @leanmcp/ui in component files
- Very specific: line 586
Always wrap content in RequireConnection
- Very specific: line 592
Put @UIApp on class
- Very specific: line 593
Use direct imports in @UIApp({ component: ...
- Distinctive: line 594
Use wrong prop names (toolName, field, autoRefresh)
- Distinctive: line 595
Add terminal commands in responses
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
MCP Apps Builder Skill
This skill guides you in building MCP Apps - MCP servers with interactive React UIs using the Leanmcp UI SDK.
When to Use This Skill
- User asks for "MCP with UI"
- User wants "interactive MCP server"
- User mentions "MCP App" or "leanmcp UI"
- User needs "dashboard for MCP tools"
- User wants "visual interface for AI tools"
- User mentions "@leanmcp/ui" or "@UIApp"
- User asks for "ChatGPT App" or "GPT App"
What is an MCP App?
MCP Apps extend MCP servers to deliver interactive UIs. Apps run in sandboxed iframes and communicate via JSON-RPC over postMessage. When a tool is called, the UI can be displayed alongside the tool response.
Core Architecture
- Service file (
mcp/*/index.ts) - Tool methods decorated with@ToolAND@UIApp - Component file (
mcp/*/*.tsx) - React component using@leanmcp/uicomponents - CLI handles the rest -
leanmcp devbuilds and wraps components with AppProvider
Required Dependencies
{
"dependencies": {
"@leanmcp/core": "^0.4.7",
"@leanmcp/ui": "^0.3.7",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"dotenv": "^16.5.0"
},
"devDependencies": {
"@leanmcp/cli": "latest",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@types/node": "^20.0.0",
"typescript": "^5.6.3"
}
}TypeScript Configuration
{
"compilerOptions": {
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "node",
"jsx": "react-jsx",
"jsxImportSource": "react",
"outDir": "./dist",
"strict": true
},
"include": ["**/*.ts", "**/*.tsx", "mcp/**/*.ts", "mcp/**/*.tsx"]
}Project Structure
my-mcp-app/
├── main.ts # Entry point
├── mcp/
│ └── products/
│ ├── index.ts # Service with @Tool + @UIApp
│ └── ProductsDashboard.tsx # React component
├── package.json
└── tsconfig.jsonTwo Import Paths (Critical)
| Import | Use In | Contents |
@leanmcp/ui/server | Service files (index.ts) | UIApp, GPTApp decorators only |
@leanmcp/ui | Component files (.tsx) | React components, hooks, styles |
@UIApp Decorator
CRITICAL: @UIApp is a METHOD decorator, not a class decorator!
Correct Usage
// mcp/products/index.ts
import { Tool } from '@leanmcp/core';
import { UIApp } from '@leanmcp/ui/server'; // Server import!
export class ProductsService {
@Tool({ description: 'List products' })
@UIApp({ component: './ProductsDashboard' }) // On method with @Tool
async listProducts(args: { page?: number }) {
return { products: [...], total: 100 };
}
}WRONG - Never do this
// WRONG: @UIApp on class
@UIApp({ component: './Dashboard' }) // WRONG!
export class MyService { ... }@UIApp Options
@UIApp({
component: './ComponentName', // Required: relative path (string, not import)
uri: 'ui://custom/path', // Optional: custom URI
title: 'Page Title', // Optional
styles: 'body { ... }' // Optional: additional CSS
})React Component Development
Basic Component
// mcp/products/ProductsDashboard.tsx
import { RequireConnection, ToolDataGrid } from '@leanmcp/ui';
import '@leanmcp/ui/styles.css';
export function ProductsDashboard() {
return (
<RequireConnection loading={<div>Loading...</div>}>
<div style={{ padding: '20px' }}>
<h1>Products</h1>
<ToolDataGrid
dataTool="listProducts"
columns={[
{ key: 'name', header: 'Name', sortable: true },
{ key: 'price', header: 'Price' }
]}
transformData={(result) => ({
rows: result.products,
total: result.total
})}
pagination
/>
</div>
</RequireConnection>
);
}Critical Rules
- NEVER wrap with AppProvider - CLI does this automatically
- Always use RequireConnection - Shows loading until host connects
- Import styles -
import '@leanmcp/ui/styles.css' - Export matching name - File
Foo.tsxexportsfunction Foo() - Use string paths -
'./Component'not direct import
Core Components
ToolButton
Button that calls a tool with loading state and confirmation:
import { ToolButton } from '@leanmcp/ui';
<ToolButton
tool="delete-item"
args={{ id: item.id }}
confirm={{
title: 'Delete Item?',
description: 'This action cannot be undone.'
}}
variant="destructive"
resultDisplay="toast"
onToolSuccess={() => refetch()}
>
Delete
</ToolButton>Props:
tool- Tool name to callargs- Arguments to passconfirm- Confirmation dialog configvariant-default,destructive,outline,ghostresultDisplay-toast,inline,noneonToolSuccess/onToolError- Callbacks
ToolForm
Form that submits to a tool:
import { ToolForm } from '@leanmcp/ui';
<ToolForm
toolName="create-product"
fields={[
{ name: 'name', label: 'Product Name', type: 'text', required: true },
{ name: 'price', label: 'Price', type: 'number', min: 0 },
{ name: 'category', label: 'Category', type: 'select', options: [
{ value: 'electronics', label: 'Electronics' },
{ value: 'clothing', label: 'Clothing' }
]},
{ name: 'inStock', label: 'In Stock', type: 'switch' }
]}
submitText="Create Product"
showSuccessToast
resetOnSuccess
onSuccess={(result) => console.log('Created:', result)}
/>Field types: text, number, email, textarea, select, switch, slider, date
ToolDataGrid
Server-paginated table with sorting and row actions:
import { ToolDataGrid } from '@leanmcp/ui';
<ToolDataGrid
dataTool="listProducts" // NOT 'toolName'!
columns={[
{ key: 'name', header: 'Name', sortable: true }, // NOT 'field'/'headerName'!
{ key: 'price', header: 'Price', render: (v) => `$${v.toFixed(2)}` }
]}
transformData={(r) => ({ rows: r.products, total: r.total })}
pagination
pageSize={20}
refreshInterval={30000} // NOT 'autoRefresh'!
rowActions={[
{
label: 'Edit',
tool: 'edit-product',
getArgs: (row) => ({ id: row.id })
},
{
label: 'Delete',
tool: 'delete-product',
getArgs: (row) => ({ id: row.id }),
variant: 'destructive',
confirm: { title: 'Delete?', description: 'Cannot undo' }
}
]}
/>Common Mistakes to Avoid:
- Use
dataToolnottoolName - Use
key/headernotfield/headerName - Use
refreshIntervalnotautoRefresh - Always provide
transformData
ToolSelect
Select dropdown with tool-based options:
import { ToolSelect } from '@leanmcp/ui';
<ToolSelect
optionsTool="list-categories"
transformOptions={(r) => r.categories.map(c => ({ value: c.id, label: c.name }))}
onSelectTool="set-category"
argName="categoryId"
placeholder="Select category"
/>ResourceView
Display MCP resources with auto-refresh:
import { ResourceView } from '@leanmcp/ui';
<ResourceView
uri="config://settings"
refreshInterval={5000}
render={(data) => (
<pre>{JSON.stringify(data, null, 2)}</pre>
)}
/>Core Hooks
useTool
Call MCP tools programmatically:
import { useTool } from '@leanmcp/ui';
function MyComponent() {
const { call, result, loading, error } = useTool('get-data', {
retry: 3,
transform: (r) => r.data
});
useEffect(() => {
call({ filter: 'active' });
}, []);
if (loading) return <div>Loading...</div>;
if (error) return <div>Error: {error.message}</div>;
return <div>{result?.value}</div>;
}useResource
Read MCP resources:
import { useResource } from '@leanmcp/ui';
function ConfigView() {
const { data, loading, refresh } = useResource('config://settings', {
refreshInterval: 5000
});
return (
<div>
{loading && <p>Loading...</p>}
{data && <pre>{JSON.stringify(data, null, 2)}</pre>}
<button onClick={refresh}>Refresh</button>
</div>
);
}useHostContext
Access host environment (theme, viewport):
import { useHostContext } from '@leanmcp/ui';
function ThemedComponent() {
const { theme, viewport } = useHostContext();
return (
<div className={theme === 'dark' ? 'dark-mode' : 'light-mode'}>
Content
</div>
);
}GPT Apps SDK Hooks
For ChatGPT Apps integration:
useToolOutput
Access structuredContent from tool response:
import { useToolOutput } from '@leanmcp/ui';
function ChannelsView() {
const toolOutput = useToolOutput<{ channels: Channel[] }>();
if (!toolOutput?.channels) return <div>No channels</div>;
return (
<ul>
{toolOutput.channels.map(ch => <li key={ch.id}>{ch.name}</li>)}
</ul>
);
}useWidgetState
Persistent state across sessions:
import { useWidgetState } from '@leanmcp/ui';
function FilteredView() {
const [state, setState] = useWidgetState<{ filter: string }>({ filter: 'all' });
return (
<select
value={state.filter}
onChange={(e) => setState({ filter: e.target.value })}
>
<option value="all">All</option>
<option value="active">Active</option>
</select>
);
}@GPTApp Decorator
For ChatGPT Apps specifically:
import { Tool } from '@leanmcp/core';
import { GPTApp } from '@leanmcp/ui/server';
export class SlackService {
@Tool({ description: 'Compose Slack message' })
@GPTApp({
component: './SlackComposer',
name: 'slack-composer'
})
async composeMessage() {
return { channels: [...] };
}
}Complete Example
Service File
// mcp/dashboard/index.ts
import { Tool, Resource, SchemaConstraint } from '@leanmcp/core';
import { UIApp } from '@leanmcp/ui/server';
class CreateItemInput {
@SchemaConstraint({ description: 'Item name', minLength: 1 })
name!: string;
@SchemaConstraint({ description: 'Item value', minimum: 0 })
value!: number;
}
export class DashboardService {
private items: any[] = [];
@Tool({ description: 'View dashboard with items' })
@UIApp({ component: './Dashboard' })
async viewDashboard() {
return { items: this.items, total: this.items.length };
}
@Tool({ description: 'Create a new item', inputClass: CreateItemInput })
async createItem(input: CreateItemInput) {
const item = { id: crypto.randomUUID(), ...input, createdAt: new Date().toISOString() };
this.items.push(item);
return { success: true, item };
}
@Tool({ description: 'Delete an item' })
async deleteItem(args: { id: string }) {
this.items = this.items.filter(i => i.id !== args.id);
return { success: true };
}
@Resource({ description: 'Dashboard statistics' })
async stats() {
return {
contents: [{
uri: 'dashboard://stats',
mimeType: 'application/json',
text: JSON.stringify({
total: this.items.length,
totalValue: this.items.reduce((sum, i) => sum + i.value, 0)
})
}]
};
}
}Component File
// mcp/dashboard/Dashboard.tsx
import { RequireConnection, ToolDataGrid, ToolForm, ToolButton, useResource } from '@leanmcp/ui';
import '@leanmcp/ui/styles.css';
export function Dashboard() {
const { data: stats, refresh } = useResource('dashboard://stats');
return (
<RequireConnection loading={<div>Connecting...</div>}>
<div style={{ padding: '20px', fontFamily: 'system-ui' }}>
<h1>Dashboard</h1>
{/* Stats */}
{stats && (
<div style={{ marginBottom: '20px', padding: '10px', background: '#f5f5f5', borderRadius: '8px' }}>
<p>Total Items: {stats.total}</p>
<p>Total Value: ${stats.totalValue}</p>
</div>
)}
{/* Create Form */}
<div style={{ marginBottom: '20px' }}>
<h2>Create Item</h2>
<ToolForm
toolName="createItem"
fields={[
{ name: 'name', label: 'Name', type: 'text', required: true },
{ name: 'value', label: 'Value', type: 'number', min: 0, required: true }
]}
submitText="Create"
showSuccessToast
resetOnSuccess
onSuccess={() => refresh()}
/>
</div>
{/* Items Table */}
<h2>Items</h2>
<ToolDataGrid
dataTool="viewDashboard"
columns={[
{ key: 'name', header: 'Name', sortable: true },
{ key: 'value', header: 'Value', render: (v) => `$${v}` },
{ key: 'createdAt', header: 'Created', render: (v) => new Date(v).toLocaleDateString() }
]}
transformData={(r) => ({ rows: r.items, total: r.total })}
rowActions={[
{
label: 'Delete',
tool: 'deleteItem',
getArgs: (row) => ({ id: row.id }),
variant: 'destructive',
confirm: { title: 'Delete item?', description: 'This cannot be undone.' }
}
]}
pagination
showRefresh
getRowKey={(row) => row.id}
/>
</div>
</RequireConnection>
);
}Theming
Apps automatically adapt to host theme via CSS variables:
:root {
--color-background-primary: #ffffff;
--color-text-primary: #171717;
}
.dark {
--color-background-primary: #0a0a0a;
--color-text-primary: #fafafa;
}Access in React:
const { theme } = useHostContext();
const isDark = theme === 'dark';Editing Guidelines
DO
- Create
.tsxfiles alongside serviceindex.tsfiles - Use
@UIAppon methods paired with@Tool - Import from
@leanmcp/ui/serverin service files - Import from
@leanmcp/uiin component files - Always wrap content in
RequireConnection - Import
@leanmcp/ui/styles.css
DON'T
- Wrap components with AppProvider
- Put
@UIAppon class - Use direct imports in
@UIApp({ component: ... }) - Use wrong prop names (toolName, field, autoRefresh)
- Add terminal commands in responses
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

