McpApps extends AbstractExtension
The MCP Apps extension (io.modelcontextprotocol/ui).
MCP Apps allows servers to expose interactive HTML UI applications as resources. Clients that support the extension render these in sandboxed iframes.
Enable on the server via Builder::enableExtension() and on the client (host) via Builder::enableExtension().
Tags
Table of Contents
Constants
- EXTENSION_ID : mixed = 'io.modelcontextprotocol/ui'
- MIME_TYPE : mixed = 'text/html;profile=mcp-app'
- URI_SCHEME : mixed = 'ui'
Methods
- getCapabilities() : array{mimeTypes: string[]}
- The capability payload announced for this extension.
- getId() : ExtensionIdentifier
- The reverse-DNS identifier used as the key under `capabilities.extensions`.
- getMessages() : array<int, Request>|Notification>>
- Every message class this extension defines.
- getRequestHandlers() : iterable<string|int, RequestHandlerInterface<string|int, ResultInterface>>
- The handlers serving those methods.
- resourceMarker() : stdClass
- The marker value for the `_meta.ui` field on a UI resource *descriptor* (its `resources/list` entry), flagging the resource as an MCP App.
Constants
EXTENSION_ID
public
mixed
EXTENSION_ID
= 'io.modelcontextprotocol/ui'
MIME_TYPE
public
mixed
MIME_TYPE
= 'text/html;profile=mcp-app'
URI_SCHEME
public
mixed
URI_SCHEME
= 'ui'
Methods
getCapabilities()
The capability payload announced for this extension.
public
getCapabilities() : array{mimeTypes: string[]}
Return values
array{mimeTypes: string[]}getId()
The reverse-DNS identifier used as the key under `capabilities.extensions`.
public
getId() : ExtensionIdentifier
Return values
ExtensionIdentifiergetMessages()
Every message class this extension defines.
public
getMessages() : array<int, Request>|Notification>>
These are registered with the MessageFactory, without which an extension's method cannot be decoded off the wire at all, and their method names are what let a server distinguish an extension it does not serve from a method that does not exist. An extension with no methods of its own returns an empty array.
Return values
array<int, Request>|Notification>>getRequestHandlers()
The handlers serving those methods.
public
getRequestHandlers() : iterable<string|int, RequestHandlerInterface<string|int, ResultInterface>>
Return values
iterable<string|int, RequestHandlerInterface<string|int, ResultInterface>>resourceMarker()
The marker value for the `_meta.ui` field on a UI resource *descriptor* (its `resources/list` entry), flagging the resource as an MCP App.
public
static resourceMarker() : stdClass
The structured CSP/permissions metadata instead belongs on the resource
content (the resources/read payload) via UiResourceContentMeta.