<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/generative-ui-in-python-jeremiah-lowin-prefect-mrje0dxxc" -->

---
title: Generative UI... in Python? — Jeremiah Lowin, Prefect
description: Jeremiah Lowin, creator of FastMCP, presents Prefab, an open-source Python DSL for building UIs that render as MCP apps — HTML/CSS/JS interfaces that let users...
canonical: https://daily.dev/posts/generative-ui-in-python-jeremiah-lowin-prefect-mrje0dxxc
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Generative UI... in Python? — Jeremiah Lowin, Prefect | daily.dev
og:description: Jeremiah Lowin, creator of FastMCP, presents Prefab, an open-source Python DSL for building UIs that render as MCP apps — HTML/CSS/JS interfaces that let users...
og:url: https://daily.dev/posts/generative-ui-in-python-jeremiah-lowin-prefect-mrje0dxxc
og:image: https://api.daily.dev/og/posts/mrJe0Dxxc.png
og:image:alt: Generative UI... in Python? — Jeremiah Lowin, Prefect
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Generative UI... in Python? — Jeremiah Lowin, Prefect

**[AI Engineer](https://daily.dev/sources/aidotengineer)** · 17 min read · 1 upvotes · 0 comments

## Summary

Jeremiah Lowin, creator of FastMCP, presents Prefab, an open-source Python DSL for building UIs that render as MCP apps — HTML/CSS/JS interfaces that let users interact directly with an MCP server rather than routing everything through an agent's context window. Prefab uses Python context managers to compose pre-built components (tables, forms, charts) into a JSON protocol that a React renderer displays. It ships with 130+ components, supports reactive client-side interactivity without writing JavaScript, and is built into FastMCP. The talk also covers a fully generative UI use case where an agent streams UI definitions on the fly, and reveals that streaming the Python representation instead of JSON cuts payload size by about 70%, improving token efficiency, cost, and latency.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=Krzs8GeiWTc>

## Questions this post answers

### What is an MCP app and how does it differ from a regular MCP tool call?

An MCP app is an extension of the MCP protocol that lets a tool response bypass the agent and send a full interactive UI (HTML, CSS, JavaScript) directly to the user, instead of returning data into the agent's context window. This lets users interact directly with forms, tables, or charts — for example booking a table or uploading a file — rather than only receiving text mediated by the agent.

_Track protocol extensions like MCP apps as they reshape agent-to-user interaction on daily.dev._

### How does the Prefab framework let Python developers build UIs for MCP servers without writing JavaScript?

Prefab is an open-source Python DSL that uses context managers to compose pre-built, world-class UI components (tables, forms, charts) into a declarative structure, which is then serialized to a JSON protocol and rendered by a React app hosted as the MCP app. It ships around 130-140 components and includes reactive variables for client-side interactivity, all without writing JavaScript.

_Python developers weighing frontend options for agent tooling can follow frameworks like Prefab on daily.dev._

### Why did FastMCP switch from streaming JSON to streaming Python for generative UI over MCP?

The Python representation of a UI turned out to be about 70% smaller than the equivalent JSON representation, so FastMCP now streams Python code over the wire, executes it in a sandbox, converts it to JSON server-side, and renders it — yielding significant token efficiency, cost, and latency benefits compared to streaming raw JSON.

_Engineers optimizing token costs for streaming agent UIs can find implementation details like this on daily.dev._

## Similar posts on daily.dev

- [Finally, MCP Servers Can Deliver UI-rich Experiences\!](https://daily.dev/posts/finally-mcp-servers-can-deliver-ui-rich-experiences--0hjhcck0j) · Daily Dose of Data Science \| Avi Chawla \| Substack · 53 upvotes · 0 comments
- [Episode \#285: Exploring MCP Apps & Adding Interactive UIs to Clients – The Real Python Podcast](https://daily.dev/posts/episode-285-exploring-mcp-apps-adding-interactive-uis-to-clients-the-real-python-podcast-nt7idmpa0) · Real Python · 1 upvotes · 0 comments
- [Medium](https://daily.dev/posts/medium-avonr6rrx) · Medium · 0 upvotes · 0 comments

---

Tags: [#python](https://daily.dev/tags/python), [#mcp](https://daily.dev/tags/mcp), [#generative-ui](https://daily.dev/tags/generative-ui)

[View this post on daily.dev](https://daily.dev/posts/generative-ui-in-python-jeremiah-lowin-prefect-mrje0dxxc)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Generative UI... in Python? — Jeremiah Lowin, Prefect","url":"https://daily.dev/posts/generative-ui-in-python-jeremiah-lowin-prefect-mrje0dxxc","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/generative-ui-in-python-jeremiah-lowin-prefect-mrje0dxxc"},"datePublished":"2026-09-10T16:32:34.101Z","dateModified":"2026-10-15T02:22:58.144Z","description":"Jeremiah Lowin, creator of FastMCP, presents Prefab, an open-source Python DSL for building UIs that render as MCP apps — HTML/CSS/JS interfaces that let users...","image":"https://i.ytimg.com/vi/Krzs8GeiWTc/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/Krzs8GeiWTc/sddefault.jpg","isAccessibleForFree":true,"articleSection":"AI Engineer","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"AI Engineer","logo":"https://media.daily.dev/image/upload/s--u5PucxNT--/f_auto/v1724338940/logos/aidotengineer","url":"https://daily.dev/sources/aidotengineer"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/generative-ui-in-python-jeremiah-lowin-prefect-mrje0dxxc","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"python,mcp,generative-ui","timeRequired":"PT17M","video":{"@type":"VideoObject","name":"Generative UI... in Python? — Jeremiah Lowin, Prefect","description":"Jeremiah Lowin, creator of FastMCP, presents Prefab, an open-source Python DSL for building UIs that render as MCP apps — HTML/CSS/JS interfaces that let users...","thumbnailUrl":"https://i.ytimg.com/vi/Krzs8GeiWTc/sddefault.jpg","uploadDate":"2026-09-10T16:32:34.101Z","duration":"PT17M","url":"https://api.daily.dev/r/mrJe0Dxxc","embedUrl":"https://www.youtube.com/embed/Krzs8GeiWTc"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"AI Engineer","item":"https://daily.dev/sources/aidotengineer"},{"@type":"ListItem","position":3,"name":"Generative UI... in Python? — Jeremiah Lowin, Prefect"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/generative-ui-in-python-jeremiah-lowin-prefect-mrje0dxxc#faq","mainEntity":[{"@type":"Question","name":"What is an MCP app and how does it differ from a regular MCP tool call?","acceptedAnswer":{"@type":"Answer","text":"An MCP app is an extension of the MCP protocol that lets a tool response bypass the agent and send a full interactive UI (HTML, CSS, JavaScript) directly to the user, instead of returning data into the agent's context window. This lets users interact directly with forms, tables, or charts — for example booking a table or uploading a file — rather than only receiving text mediated by the agent. Track protocol extensions like MCP apps as they reshape agent-to-user interaction on daily.dev."}},{"@type":"Question","name":"How does the Prefab framework let Python developers build UIs for MCP servers without writing JavaScript?","acceptedAnswer":{"@type":"Answer","text":"Prefab is an open-source Python DSL that uses context managers to compose pre-built, world-class UI components (tables, forms, charts) into a declarative structure, which is then serialized to a JSON protocol and rendered by a React app hosted as the MCP app. It ships around 130-140 components and includes reactive variables for client-side interactivity, all without writing JavaScript. Python developers weighing frontend options for agent tooling can follow frameworks like Prefab on daily.dev."}},{"@type":"Question","name":"Why did FastMCP switch from streaming JSON to streaming Python for generative UI over MCP?","acceptedAnswer":{"@type":"Answer","text":"The Python representation of a UI turned out to be about 70% smaller than the equivalent JSON representation, so FastMCP now streams Python code over the wire, executes it in a sandbox, converts it to JSON server-side, and renders it — yielding significant token efficiency, cost, and latency benefits compared to streaming raw JSON. Engineers optimizing token costs for streaming agent UIs can find implementation details like this on daily.dev."}}]}
```

