MCP tools usually send results back through the agent, using its context window. MCP Apps can instead return an HTML, CSS, and JavaScript interface for the user to interact with directly, such as a restaurant booking or airline seat selection.
Generative UI... in Python?
Speaker
Jeremiah Lowin of Prefect speaks at AI Engineer about building interactive MCP apps for Python developers with Prefab.
Lowin says FastMCP’s users are mostly Python engineers, many working in enterprises. Their common needs are tables, forms, and charts for sharing and collecting information, so Prefab focuses on composing those interfaces from existing components rather than building arbitrary frontends.
Prefab lets developers create interfaces with Python context managers, component classes, and reactive variables. Its Python DSL becomes a serializable JSON representation, which a React app renders; the JSON format also lets agents generate or modify interfaces.
A FastMCP tool can return a Prefab component, such as a searchable, filterable, sortable, paginated data table. Developers can compose it with a pie chart, or build a full app whose UI calls backend methods on the MCP server. A file upload component sends files directly to the server, avoiding the agent-mediated copy and retransmission of file contents.
Lowin demonstrates an agent streaming a UI as it generates it, using Prefab’s component protocol and a skill that teaches the agent to compose interfaces. He says the Python representation is about 70% smaller than the JSON representation, so the current approach streams Python, executes it in a sandbox, and converts it to JSON for rendering.
Takeaways
- Start with the UI tasks users repeatedly need, such as forms, tables, and charts, and provide components for those tasks.
- A serializable UI representation can make interfaces easier for agents to generate, transmit, and modify.
- Returning a UI component from an MCP tool can give users direct interaction without routing every result through the agent.
- For file uploads, let the user send files through the app directly to the server instead of making the agent relay their contents.
- Measure representation size and latency: Lowin reports that streaming Python reduced payload size by about 70% compared with JSON.
Mentioned in this talk
Search inside this talk
What was claimed 10
- built
“my company maintains, called FastMCP.”
YouTube Verified5 sources· Talk, GitHub, Web· archived
- builtJeremiah Lowin built
Prefab
“A few months ago, we released something ... Prefab.”
YouTube Verified3 sources· Talk, Web· archived
- built
“we released something ... Prefab.”
YouTube Unverified1 source· Talk
- feature
Prefab: Python DSL composes reusable UI components into interactive interfaces
“we use a context manager to build an entire UI.”
YouTube Unverified1 source· Talk
- feature
Prefab: Supports reactive client-side interactivity without writing JavaScript
“create client-side interactivity and bind data between components.”
YouTube Unverified1 source· Talk
- uses
“rendered by a React app hosted as the actual MCP app.”
YouTube Unverified1 source· Talk
- feature
Prefab: Provides about 130 or 140 composable components
“there are 130 or 140 components that we ship.”
YouTube Unverified1 source· Talk
- feature
FastMCP: Automatically detects returned Prefab components and sets up an MCP app“FastMCP will automatically detect that and infer that you want to return an MCP app.”
YouTube Unverified1 source· Talk











