---
title: FastMCP
sidebarTitle: FastMCP
description: Build MCP Apps that render inside Claude Desktop, ChatGPT, and other hosts.
icon: rocket
---

<Info>
MCP App support will be available in [FastMCP 3.1](https://github.com/PrefectHQ/fastmcp). This page will be updated with full documentation when it ships.
</Info>

Prefab integrates with [FastMCP](https://github.com/PrefectHQ/fastmcp) to build [MCP Apps](https://modelcontextprotocol.io/docs/extensions/apps) — interactive UIs that render directly inside the conversation. Mark any tool with `app=True` and return a component tree or a `PrefabApp`:

<CodeGroup>
```python Component Tree
from prefab_ui import FastMCP
from prefab_ui.components import Card, CardContent, Column, H3, Input, Button
from prefab_ui.actions import CallTool

mcp = FastMCP("My Server")

@mcp.tool(app=True)
async def search(query: str = "") -> Card:
    results = find_items(query) if query else []
    with Card() as view:
        with CardContent():
            with Column(gap=3):
                Input(name="q", placeholder="Search...")
                Button(
                    "Go",
                    on_click=CallTool("search", arguments={"query": "{{ q }}"}),
                )
    return view
```
```python PrefabApp
from prefab_ui import FastMCP
from prefab_ui.app import PrefabApp
from prefab_ui.components import Card, CardContent, Column, H3, Muted, Input

mcp = FastMCP("My Server")

@mcp.tool(app=True)
async def greeting() -> PrefabApp:
    with Card() as view:
        with CardContent():
            with Column(gap=3):
                H3("Hello, {{ name }}!")
                Muted("Type below and watch this update.")
                Input(name="name", placeholder="Your name...")
    return PrefabApp(view=view, state={"name": "world"})
```
</CodeGroup>

Returning a component tree is the simplest option — FastMCP wraps it in a `PrefabApp` automatically. Return a `PrefabApp` directly when you need initial state, reusable definitions, or external assets.

When a host like Claude Desktop or Prefect Horizon calls this tool, the user sees a fully interactive UI instead of plain text. Client-side [actions](/actions) like `SetState` and `ShowToast` work immediately in the browser, while `CallTool` makes a round-trip through MCP back to your server for fresh data and server-side logic.
