Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

mcp-apps-protocol

БесплатноБез исполняемых скриптовНе проверен

This skill should be used when implementing or debugging the MCP Apps extension — ui:// resource URIs, the text/html;profile=mcp-app mimeType, every _meta.ui…

TheLobbiот TheLobbi★ 22 звезды на GitHub

Об этом скилле

MCP Apps — the extension specification

MCP Apps lets an MCP server ship an interactive UI alongside its tools. The UI renders in a sandboxed iframe inside the host (Claude, ChatGPT, M365 Copilot) and talks to the host over JSON-RPC 2.0 carried on postMessage.

Three entities, always:

  • Server — registers the tool and the UI resource.
  • Host — the chat client. Owns the iframe, mediates every call.
  • View (also called the App) — your HTML/JS running inside the iframe.

The View never talks to the server directly. Every server call is proxied by the host, which is what makes the security model auditable.

1. The two registrations

A working MCP App is always exactly two registrations tied by one URI.

The resource

uri:      ui://<anything>/<anything>      e.g. ui://weather/forecast.html
mimeType: text/html;profile=mcp-app       (exported as RESOURCE_MIME_TYPE)
text:     the complete HTML document

The ui:// scheme is the signal to the host that this resource is renderable UI rather than model-readable content. The path after the scheme is arbitrary — organize it however you like, but see Versioning below.

The tool

{
  "name": "render_forecast",
  "title": "Render forecast",
  "description": "…",
  "inputSchema": { "…": "…" },
  "_meta": { "ui": { "resourceUri": "ui://weather/forecast.html" } }
}

When the host calls a tool carrying _meta.ui.resourceUri, it fetches that resource, mounts the iframe, and pushes the tool result into it.

2. Every _meta.ui field

_meta.ui appears in two places with different valid keys. Putting a resource field on a tool (or vice versa) silently does nothing — this is the single most common wiring bug.

On the tool descriptor

Field Type Meaning
resourceUri string The ui:// resource to render for this tool.
visibility string[] Who may call this tool. ["model","app"] (default), ["app"] (UI-only, hidden from the model), ["model"] (never callable from the View).

On the resource contents

Field Type Meaning
csp.connectDomains string[] Origins the View may fetch/WebSocket to.
csp.resourceDomains string[] Origins for scripts, styles, images, fonts.
csp.frameDomains string[] Origins the View may nest in a child iframe. Blocked by default.
csp.baseUriDomains string[] Allowed <base href> origins.
permissions object Host-mediated capability requests (camera, clipboard, …).
prefersBorder boolean Ask the host to draw a container border.
domain string The origin the View is served as, for APIs that allowlist by Origin.

CSP goes in the resource contents _meta, not in the third config argument of registerAppResource. Getting this wrong produces a View that loads but whose every network call is blocked with no obvious error.

App-only tools

visibility: ["app"] is the mechanism for UI-driven side effects that should not pollute the model's tool list or context — cart mutations, pagination, polling, chunked file transfer. Use it liberally; a View that calls a model-visible tool on every keystroke will wreck the conversation.

3. The bridge — every method

JSON-RPC 2.0 messages on window.parent.postMessage(msg, "*"), responses delivered back on the View's message event. Ignore any message whose event.source !== window.parent and whose jsonrpc !== "2.0".

View → Host (requests)

Method Params Returns
ui/initialize app name/version, supported capabilities host context (see below)
tools/call { name, arguments } the full CallToolResult
resources/read { uri } the resource contents
ui/message { … } message to inject into the conversation ack
ui/update-model-context structured context the model should now see ack
ui/size-changed { width, height } ack
ui/open-link { url } ack — the host navigates, not the View
ui/request-display-mode { mode } granted mode (may differ from requested)

Host → View (notifications)

Method Params
ui/notifications/tool-input the arguments the tool was called with
ui/notifications/tool-input-partial streaming, JSON-healed partial arguments
ui/notifications/tool-result { content, structuredContent, _meta }
ui/notifications/initialized handshake complete
ui/notifications/tool-cancelled the in-flight call was aborted
ui/notifications/teardown unmount imminent — flush and clean up
ui/notifications/host-context-changed theme, display mode, or viewport changed

tool-input arrives before tool-result. Render a skeleton from the input, then fill it from the result — that is the whole latency story for an MCP App.

Host context

Returned from ui/initialize and refreshed by host-context-changed:

{
  t
Полный SKILL.md на GitHub

Установить mcp-apps-protocol в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл mcp-apps-protocol?

This skill should be used when implementing or debugging the MCP Apps extension — ui:// resource URIs, the text/html;profile=mcp-app mimeType, every _meta.ui field, the full ui/* JSON-RPC bridge over postMessage, tool visibility, host context, display modes, and the five lifecycle phases.

Как установить скилл mcp-apps-protocol?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл mcp-apps-protocol запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить mcp-apps-protocol с