ui

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package ui serves the interactive task board that hosts render inside the conversation.

It implements the MCP Apps extension (spec 2026-01-26): the server advertises the ui extension capability, exposes an HTML document under the ui:// scheme, and points a tool at that document through _meta.ui.resourceUri. The host then renders the HTML in a sandboxed iframe and proxies the view's own tool calls back to this server — which is what lets the board keep refreshing after the tool call that opened it has already returned.

Hosts that do not implement the extension ignore all of this and fall back to the tool's text result, so registering it costs nothing on those clients.

Index

Constants

View Source
const ExtensionName = "io.modelcontextprotocol/ui"

ExtensionName is the capability key hosts look for to decide whether this server can render views.

View Source
const MIMEType = "text/html;profile=mcp-app"

MIMEType is the only content type the spec permits for a UI resource; other values are reserved for future extensions.

View Source
const ResourceURI = "ui://cli-agent-mcp/task-board.html"

ResourceURI addresses the board. It is both the resource's own URI and the value tools carry in _meta.ui.resourceUri.

Variables

View Source
var BoardHTML string

BoardHTML is the whole view — markup, styles and script in a single file. It has to be self-contained: the host renders it under a deny-by-default CSP that blocks external origins, and this server declares no csp allowances.

Functions

func Capability

func Capability() map[string]any

Capability is the settings object advertised under ExtensionName during initialize.

func ResourceMeta

func ResourceMeta() map[string]any

ResourceMeta carries the board's own rendering preferences.

func ToolMeta

func ToolMeta() map[string]any

ToolMeta is the _meta payload that links a tool to the board, telling the host to render the view in place of the tool's text result.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL