fastmcp/examples
Jeremiah Lowin 3ff1472ea9
Add Prefab Apps integration for MCP tool UIs (#3316)
* Add prefab auto-wiring for MCP Apps (#3119)

Tools that return prefab types (UIResponse, Component) automatically get
wired to the shared prefab renderer resource. Works via app=True,
return type inference, or both.

* Prefab compatibility updates

* Use published prefab-ui >=0.6.0, remove local source override

* Migrate UIResponse to PrefabApp for Prefab UI integration

PrefabApp is a pure data object with to_json(), html(), and csp()
methods. Tools can return PrefabApp, bare Components, or
ToolResult with structured_content for custom LLM fallback text.

* Add Prefab UI apps documentation

* Add mini apps and full apps documentation pages

Mini apps covers the common single-screen patterns: charts (bar, line,
area, pie), data tables with sorting/search/pagination, forms (manual
and Pydantic-generated), status displays, conditional content, and
layout composition with tabs and accordions.

Full apps covers multi-page applications using Pages/Page components,
shared state across pages, and using ToolCall with result_key for
server-driven state updates.

* Reframe apps docs around motivation, add generative UIs page

The docs now lead with the problem — MCP tools stuff data into the LLM
context window, and building HTML/JS/CSS frontends is a non-starter for
Python developers — before introducing Prefab as the solution. Mini apps
are framed as the primary use case: focused, single-purpose UIs that
present data visually and collect structured input.

New generative UIs page covers the concept of LLMs producing component
JSON directly, enabling adaptive dashboards, tailored forms, and
exploratory workflows.

* Tag Prefab docs pages as SOON instead of NEW

* Rename Low-Level API to Custom HTML Apps

The page is about using the MCP Apps extension directly, not a FastMCP
or Prefab internal API. Reframed to make clear this is the open MCP
protocol with FastMCP providing convenience wrappers.

* Tighten apps docs and widen content area

Strip editorial motivation from all app doc pages — let code examples
do the talking. Add content-area max-width override (44rem) to style.css.

* Restructure apps docs, fix code issues

Rename Prefab UI → Prefab Apps, mini-apps → patterns, remove
generative-uis and full-apps pages. Rewrite prefab page to lead with
what users do (declare a UI, return it) before explaining internals.
Patterns page now has fully self-contained copy-pasteable examples with
explicit imports and links to prefab docs. Forms show the two-tool
pattern (form + handler). Add patterns_server.py example.

Code fixes: move get_args to module-level import, remove dead
AuthCheckCallable type alias, fix ToolCall→CallTool in all docs.

* Remove unused ToolResult import from chart_server

* Handle composite Prefab types in type inference and schema suppression

_has_prefab_return_type and the output schema suppression logic only
checked bare classes, missing unions (Column | None) and Annotated
wrappers (Annotated[PrefabApp | None, ...]). Recurse through Union,
types.UnionType, and Annotated to detect Prefab types in composite
annotations.
2026-02-27 14:37:57 -05:00
..
apps Add Prefab Apps integration for MCP tool UIs (#3316) 2026-02-27 14:37:57 -05:00
atproto_mcp Normalize repo references to PrefectHQ/fastmcp casing (#3218) 2026-02-18 14:51:18 -05:00
auth Add JWT audience validation and RFC 8707 warnings to auth providers (#3204) 2026-02-17 18:16:05 -05:00
code_mode Add experimental CodeMode transform (#3297) 2026-02-27 12:14:03 -05:00
diagnostics Address CodeRabbit suggestions 2026-01-14 09:48:07 -05:00
fastmcp_config Implement typed source system for FastMCP configuration (#1607) 2025-08-24 16:32:37 -04:00
fastmcp_config_demo Internal refactor: fastmcp config to mcp server config (#1672) 2025-08-29 21:37:39 -04:00
filesystem-provider Add standalone decorators and eliminate fastmcp.fs module (#2832) 2026-01-10 12:16:35 -05:00
namespace_activation Rename Enabled transform to Visibility (#2950) 2026-01-19 20:46:58 -05:00
persistent_state Add session-scoped state persistence (#2873) 2026-01-16 14:11:21 -05:00
prompts_as_tools Add PromptsAsTools transform (#2946) 2026-01-19 18:19:53 -05:00
providers/sqlite Use ergonomic provider initialization pattern (#2675) 2025-12-22 14:49:39 -05:00
resources_as_tools Add ResourcesAsTools transform (#2943) 2026-01-19 17:40:31 -05:00
sampling [Doc]: fixing spelling issues in multiple files 2026-01-23 07:17:38 +01:00
search Narrate search example clients (#3321) 2026-02-27 12:17:31 -05:00
skills Add client utilities for downloading skills (#2948) 2026-01-19 20:10:39 -05:00
smart_home Normalize repo references to PrefectHQ/fastmcp casing (#3218) 2026-02-18 14:51:18 -05:00
tasks Remove enable_tasks setting, enable task protocol by default 2025-12-09 09:34:42 -05:00
testing_demo chore(deps): bump cryptography (#3140) 2026-02-11 10:19:38 -05:00
versioning Add version discovery and calling a certain version for components (#2897) 2026-01-17 08:27:39 -05:00
complex_inputs.py Remove empty parens 2025-06-04 15:37:55 -04:00
config_server.py Remove empty parens 2025-06-04 15:37:55 -04:00
custom_tool_serializer_decorator.py Deprecate tool_serializer parameter (#2753) 2025-12-26 16:03:04 -05:00
desktop.py Remove empty parens 2025-06-04 15:37:55 -04:00
echo.py Remove empty parens 2025-06-04 15:37:55 -04:00
elicitation.py Add fastmcp list and fastmcp call CLI commands (#3054) 2026-02-01 18:30:14 -05:00
get_file.py Add "High Value" Ruff Rules (#2255) 2025-10-26 10:20:31 -04:00
in_memory_proxy_example.py Add as_proxy improvements and tests 2025-05-17 12:23:48 -04:00
memory.fastmcp.json Update schema path (#1595) 2025-08-23 09:47:58 -04:00
memory.py 2.14 deprecation removals (#2329) 2025-12-01 14:11:00 -05:00
mount_example.fastmcp.json Update schema path (#1595) 2025-08-23 09:47:58 -04:00
mount_example.py docs: fix stale get_* references, now list_* (#3168) 2026-02-12 13:45:49 -06:00
run_with_tracing.py Address CodeRabbit suggestions 2026-01-14 09:48:07 -05:00
screenshot.fastmcp.json Update schema path (#1595) 2025-08-23 09:47:58 -04:00
screenshot.py 2.14 deprecation removals (#2329) 2025-12-01 14:11:00 -05:00
simple_echo.py Remove empty parens 2025-06-04 15:37:55 -04:00
tags_example.py docs: fix stale get_* references, now list_* (#3168) 2026-02-12 13:45:49 -06:00
task_elicitation.py Relay task elicitation through standard MCP protocol 2026-02-10 14:58:19 -05:00
text_me.py Basic cleanup 2025-04-05 17:39:51 -04:00
tool_result_echo.py Improve ToolResult and structured output documentation (#2349) 2025-11-02 17:07:48 -05:00