Module

mcp_apps

Typed contracts for the stable MCP Apps UI extension.

Classes

MCPAppCSP 5
Origins requested by an MCP App resource's Content Security Policy.

Origins requested by an MCP App resource's Content Security Policy.

Attributes

Name Type Description
connect_domains tuple[str, ...]
resource_domains tuple[str, ...]
frame_domains tuple[str, ...]
base_uri_domains tuple[str, ...]

Methods

Internal Methods 1
__init__ 4
def __init__(self, connect_domains: tuple[str, ...] | list[str] = (), resource_domains: tuple[str, ...] | list[str] = (), frame_domains: tuple[str, ...] | list[str] = (), base_uri_domains: tuple[str, ...] | list[str] = ()) -> None
Parameters
Name Type Description
connect_domains Default:()
resource_domains Default:()
frame_domains Default:()
base_uri_domains Default:()
MCPAppPermissions 4
Browser capabilities requested by an MCP App resource.

Browser capabilities requested by an MCP App resource.

Attributes

Name Type Description
camera bool
microphone bool
geolocation bool
clipboard_write bool
MCPAppResourceMeta 4
Security and presentation metadata attached to an MCP App resource.

Security and presentation metadata attached to an MCP App resource.

Attributes

Name Type Description
csp MCPAppCSP | None
permissions MCPAppPermissions | None
domain str
prefers_border bool | None
MCPAppToolMeta 3
Link an MCP tool to a UI resource and declare its visibility.

Link an MCP tool to a UI resource and declare its visibility.

Attributes

Name Type Description
resource_uri str
visibility tuple[MCPAppVisibility, ...]

Methods

Internal Methods 1
__init__ 2
def __init__(self, resource_uri: str, visibility: tuple[MCPAppVisibility, ...] | list[MCPAppVisibility] = ('model', 'app')) -> None
Parameters
Name Type Description
resource_uri
visibility Default:('model', 'app')
MCPAppResourceDef 7
A registered HTML resource for the MCP Apps extension.

A registered HTML resource for the MCP Apps extension.

Attributes

Name Type Description
uri str
name str
description str
handler Callable[..., str | bytes]
meta MCPAppResourceMeta
mime_type str

Methods

Internal Methods 1
__post_init__ 0
def __post_init__(self) -> None

Functions

_resource_meta_to_protocol 1 dict[str, Any]
Serialize immutable resource metadata with stable MCP field names.
def _resource_meta_to_protocol(meta: MCPAppResourceMeta) -> dict[str, Any]
Parameters
Name Type Description
meta MCPAppResourceMeta
Returns
dict[str, Any]
_tool_meta_to_protocol 1 dict[str, Any]
Serialize a tool-to-resource link using the stable nested shape.
def _tool_meta_to_protocol(meta: MCPAppToolMeta) -> dict[str, Any]
Parameters
Name Type Description
meta MCPAppToolMeta
Returns
dict[str, Any]