60e0ffc959
Upgrade checks / Notify on failure (push) Has been cancelled
Upgrade checks / Close issue on success (push) Has been cancelled
Schema Crash Test / Real-world schema crash test (232K schemas) (push) Has been cancelled
Run static analysis / static_analysis (push) Has been cancelled
Tests / Tests: Python 3.10 on ubuntu-latest (push) Has been cancelled
Tests / Tests: Python 3.13 on ubuntu-latest (push) Has been cancelled
Tests / Tests: Python 3.10 on windows-latest (push) Has been cancelled
Tests / Tests with lowest-direct dependencies (push) Has been cancelled
Tests / MCP conformance tests (push) Has been cancelled
Tests / Integration tests (push) Has been cancelled
Tests / Package install smoke (push) Has been cancelled
Upgrade checks / Static analysis (push) Has been cancelled
Upgrade checks / Tests: Python 3.10 on ubuntu-latest (push) Has been cancelled
Upgrade checks / Tests: Python 3.13 on ubuntu-latest (push) Has been cancelled
Upgrade checks / Tests: Python 3.10 on windows-latest (push) Has been cancelled
Upgrade checks / Integration tests (push) Has been cancelled
Update MCPServerConfig Schema / update-config-schema (push) Has been cancelled
Update SDK Documentation / update-sdk-docs (push) Has been cancelled
23 lines
737 B
Python
23 lines
737 B
Python
"""Generative UI — let the LLM build custom Prefab UIs on the fly.
|
|
|
|
The GenerativeUI provider registers two tools:
|
|
- generate_prefab_ui: the LLM writes Prefab Python code, it runs in a sandbox, the result renders
|
|
- search_prefab_components: the LLM searches the Prefab component library
|
|
|
|
The generative renderer supports streaming: as the LLM writes code into
|
|
the `code` argument, the host forwards partial arguments to the app via
|
|
ontoolinputpartial, and the user watches the UI build up in real time.
|
|
|
|
Usage:
|
|
uv run python generative_ui.py
|
|
"""
|
|
|
|
from fastmcp import FastMCP
|
|
from fastmcp.apps.generative import GenerativeUI
|
|
|
|
mcp = FastMCP("Prefab Studio")
|
|
mcp.add_provider(GenerativeUI())
|
|
|
|
if __name__ == "__main__":
|
|
mcp.run()
|