Documentation
¶
Overview ¶
Package capabilities provides UI extension capability helpers for the MCP UI extension proposed by SEP-1865 (MCP Apps).
All identifiers used here are sourced byte-for-byte from the upstream MCP Apps spec commit pinned in the module README.
Index ¶
Constants ¶
const ExtensionName = "io.modelcontextprotocol/ui"
ExtensionName is the capability key used to advertise UI extension support in the experimental capability slot of both client and server capabilities. The value is pinned to the upstream MCP Apps spec.
const ResourceMimeType = "text/html;profile=mcp-app"
ResourceMimeType is the MIME type that identifies an MCP UI / MCP Apps HTML resource. The value is pinned byte-for-byte to the upstream MCP Apps spec commit recorded in the module README.
Variables ¶
This section is empty.
Functions ¶
func SetClientCapability ¶
func SetClientCapability(caps *schema.ClientCapabilities, capability Capability)
SetClientCapability declares UI extension support on the given client capabilities by writing cap under Experimental[ExtensionName].
The function preserves any other Experimental entries already present and allocates the Experimental map if it is nil. It panics if caps is nil because there is no sensible behavior for a missing capabilities holder.
func SetServerCapability ¶
func SetServerCapability(caps *schema.ServerCapabilities, capability Capability)
SetServerCapability declares UI extension support on the given server capabilities by writing cap under Experimental[ExtensionName].
Behavior mirrors SetClientCapability.
Types ¶
type Capability ¶
type Capability struct {
// ProtocolVersion is the semantic version of the producer's MCP UI
// implementation.
ProtocolVersion string `json:"protocolVersion"`
// MimeTypes is the set of UI resource MIME types the producer supports.
MimeTypes []string `json:"mimeTypes"`
}
Capability is the negotiated payload that producers place under Experimental[ExtensionName] in client and server capabilities.
The shape is intentionally minimal and matches the initial payload described by the enhancement plan:
{"protocolVersion":"1.0.0","mimeTypes":["text/html;profile=mcp-app"]}
func GetClientCapability ¶
func GetClientCapability(caps *schema.ClientCapabilities) (Capability, bool)
GetClientCapability reads the UI extension capability from the given client capabilities. It returns the parsed Capability and true if the entry exists; otherwise it returns the zero Capability and false.
caps may be nil; that case returns the zero value and false.
func GetServerCapability ¶
func GetServerCapability(caps *schema.ServerCapabilities) (Capability, bool)
GetServerCapability reads the UI extension capability from the given server capabilities. Semantics mirror GetClientCapability.