FastestMCP.Apps (fastest_mcp v0.3.0)

Copy Markdown View Source

MCP-facing helpers for the MCP Apps extension.

These helpers describe tools and ui:// HTML resources. Rendering, iframe sandboxing, CSP enforcement, consent, and View-to-Host postMessage traffic belong to the consuming browser/native Host and are intentionally outside FastestMCP's server and connected-client transports.

HTML is intentionally opaque here. The caller must supply a complete, valid HTML5 document; FastestMCP does not add a doctype or implement an HTML parser. CSP source strings are likewise preserved for the consuming Host to enforce.

Summary

Functions

Builds client capability settings for MCP Apps.

Builds one opaque HTML5 resource content item suitable for resources/read.

Returns the Apps extension identifier.

Returns the stable MCP Apps HTML resource media type.

Returns whether a MIME value identifies an MCP Apps document.

Builds resource metadata for CSP, permissions, origin, and presentation.

Reads canonical or deprecated Apps tool linkage metadata.

Builds a resource result containing one MCP App document.

Builds canonical _meta linking a tool to a UI resource.

Functions

client_settings(mime_types \\ ["text/html;profile=mcp-app"])

Builds client capability settings for MCP Apps.

content(resource_uri, html, opts \\ [])

Builds one opaque HTML5 resource content item suitable for resources/read.

extension_id()

Returns the Apps extension identifier.

mime_type()

Returns the stable MCP Apps HTML resource media type.

mime_type?(value)

Returns whether a MIME value identifies an MCP Apps document.

resource_meta(opts \\ [])

Builds resource metadata for CSP, permissions, origin, and presentation.

resource_uri(meta)

Reads canonical or deprecated Apps tool linkage metadata.

result(resource_uri, html, opts \\ [])

Builds a resource result containing one MCP App document.

tool_meta(resource_uri, opts \\ [])

Builds canonical _meta linking a tool to a UI resource.