fastmcp.apps.config
MCP Apps support — extension negotiation and typed UI metadata models.
Provides constants and Pydantic models for the MCP Apps extension
(io.modelcontextprotocol/ui), enabling tools and resources to carry
UI metadata for clients that support interactive app rendering.
Functions
app_config_to_meta_dict
meta["ui"].
Classes
ResourceCSP
Content Security Policy for MCP App resources.
Declares which external origins the app is allowed to connect to or
load resources from. Hosts use these declarations to build the
Content-Security-Policy header for the sandboxed iframe.
ResourcePermissions
Iframe sandbox permissions for MCP App resources.
Each field, when set (typically to {}), requests that the host
grant the corresponding Permission Policy feature to the sandboxed
iframe. Hosts MAY honour these; apps should use JS feature detection
as a fallback.
AppConfig
Configuration for MCP App tools and resources.
Controls how a tool or resource participates in the MCP Apps extension.
On tools, resource_uri and visibility specify which UI resource
to render and where the tool appears. On resources, those fields must
be left unset (the resource itself is the UI).
All fields use exclude_none serialization so only explicitly-set
values appear on the wire. Aliases match the MCP Apps wire format
(camelCase).
PrefabAppConfig
App configuration for Prefab tools with sensible defaults.
Like app=True but customizable. Auto-wires the Prefab renderer
URI and merges the renderer’s CSP with any additional domains you
specify. The renderer resource is registered automatically.
Example::
@mcp.tool(app=PrefabAppConfig()) # same as app=True
@mcp.tool(app=PrefabAppConfig(
csp=ResourceCSP(frame_domains=[“https://example.com”]),
))
Methods:

