Skip to content

@maxhealth.tech/prefab / mcp

mcp

Interfaces

InterfaceDescription
DisplayA2uiOptions-
A2uiResourceOptions-
DisplayOptions-
DisplayFormOptions-
StateUpdate-
DisplayUpdateOptions-
DisplayErrorOptions-
DisplaySuccessOptions-
FormInputRequestOptions-
McpAppCspCSP configuration for MCP Apps resources.
McpAppPermissionsPermission Policy requests for MCP Apps resources.
ResourceMetaOptions-
RendererHtmlOptions-
ViewerResourceOptions-
ResourceConfigRegistration config accepted by both SDK generations.
McpServerLikeMCP server interface expected by registerViewerResource.
ToolResultOptions-
VsCodeTokenSourceHow one prefab token is sourced from the VS Code webview.

Type Aliases

Type AliasDescription
PrefabUpdateWireThe $prefab state-delta payload, sent as structuredContent.
FormValueValues a client may return for one field.
ResourceReadHandlerresources/read handler shape passed to the server — the viewer is always HTML text.
ThemeBridgeSupported theme bridges.
McpTextContentMCP text content block (compatible with SDK's TextContent)
McpImageContentMCP image content block (compatible with SDK's ImageContent)
McpTextResourceContentsText resource contents (has text, never blob).
McpBlobResourceContentsBlob resource contents (has blob, never text). See McpTextResourceContents on the alias.
McpResourceContentMCP embedded resource content block (compatible with SDK's EmbeddedResource)
McpContentAny MCP content block
McpToolResultMCP tool result — returned from tool handlers.
McpDisplayResultA tool result whose structuredContent is guaranteed present.
McpCacheScopeCache scopes defined for cacheable results.
McpCacheHintCache fields required on results from the cacheable operations (tools/list, prompts/list, resources/list, resources/templates/list, resources/read, server/discover).
McpResourceReadResultA resources/read result carrying the required cache fields.
McpStringSchemaThe restricted JSON Schema an elicitation may request.
McpNumberSchema-
McpBooleanSchema-
McpEnumSchemaSingle selection: a string constrained to a fixed set of values.
McpMultiEnumSchemaMultiple selection: an array of values drawn from a fixed set.
McpPrimitiveSchema-
McpRestrictedSchemaThe flat object schema an elicitation/create request asks the client to fill.
McpElicitFormRequestForm-mode elicitation: the client renders the schema and returns the values.
McpElicitUrlRequestURL-mode elicitation: the client sends the user out of band and reports back.
McpElicitRequest-
McpInputRequestsServer-issued requests the client must fulfil before retrying the call.
McpElicitResultWhat the client sends back for one request, keyed the same way.
McpInputResponses-
McpInputRequiredResultA result asking the client for input before the call can complete.

Variables

VariableDescription
A2UI_RESOURCE_URIDefault URI for a server that serves a single A2UI surface.
displayA2uicamelCase alias, matching the other display helpers.
displayFormMCP display helpers — return prefab UIs as MCP tool results.
displayUpdateMCP display helpers — return prefab UIs as MCP tool results.
displayErrorMCP display helpers — return prefab UIs as MCP tool results.
displaySuccessMCP display helpers — return prefab UIs as MCP tool results.
PREFAB_CDN_METADefault CSP meta for prefab apps using jsDelivr CDN.
PREFAB_RESOURCE_URIDefault URI for the prefab viewer resource.
MCP_APP_MIMEMIME type required by MCP Apps hosts.
APPS_EXTENSIONCapability key for the MCP Apps extension (versioned independently of core).
DEFAULT_VIEWER_CACHEDefault cache hint for the viewer resource.
VSCODE_BRIDGEprefab tokens that VS Code can supply, with the same variables and static fallbacks prefab.css uses. Tokens VS Code has no equivalent for (--success, --warning, shadows, radii) are deliberately absent: the bridge only overrides what the editor can actually provide.

Functions

FunctionDescription
a2uiPayloadWrap messages in the list envelope A2UI defines for non-streaming transports.
display_a2uiReturn a view as an A2UI tool result.
registerA2uiResourceRegister a static A2UI surface as an a2ui:// resource.
displayMCP display helpers — return prefab UIs as MCP tool results.
display_formMCP display helpers — return prefab UIs as MCP tool results.
display_updateMCP display helpers — return prefab UIs as MCP tool results.
display_errorMCP display helpers — return prefab UIs as MCP tool results.
display_successMCP display helpers — return prefab UIs as MCP tool results.
formSchemaDerive the restricted elicitation schema from form fields.
formInputRequestAsk the client to collect these fields, then retry the call.
inputResponseA client's answer for one key, or undefined when it has not arrived yet.
acceptedFormInputRead and check an accepted form answer.
resourceMetaGenerate the _meta object for MCP Apps ui:// resource registration.
rendererHtmlGenerate the HTML page for a prefab MCP Apps viewer resource.
resolveCacheFill in and validate the CacheableResult fields, rejecting values the SDK would silently discard in favour of ttlMs: 0.
registerViewerResourceRegister the prefab viewer as a ui:// resource on an MCP server.
toolResultWrap a JSON payload as an MCP tool result.
themeBridgeCssGenerate the theme-bridge CSS (the contents of a <style> element).

Released under the MIT License.