prefab serve renders a PrefabApp as a self-contained HTML page and serves it locally. This lets you iterate on layouts, styling, and client-side interactions (state, forms, conditionals) without wiring up an MCP server or host application.
Quick Start
Create a Python file that defines aPrefabApp:
app.py
http://127.0.0.1:5175 with the rendered UI. All client-side behavior works — state binding, SetState/ToggleState actions, ForEach loops, conditional rendering, form submissions. The only thing that won’t work is CallTool, since there’s no MCP server to call back to.
Auto-Discovery
If your file has a singlePrefabApp instance, prefab serve finds it automatically. If there are multiple, point to the one you want:
Live Reload
Pass--reload to watch for file changes and regenerate the page on save:
.py files in the same directory as your target file. When a change is detected, it re-executes the module and regenerates the HTML. Refresh your browser to see the update.
Options
If the requested port is in use,
prefab serve automatically finds the next available one.
See PrefabApp for the full API reference.