Skip to main content
MCP Apps SDK An MCP App View runs inside a host iframe. The View does not talk directly to the MCP server or the chat UI. It uses the SDK App instance, and the host decides which requests it supports. Use this guide when you are choosing which client API to call from the View.

Quick Choice

Check Host Capabilities First

Hosts may implement only part of the MCP Apps API. Read capabilities after app.connect(), then hide or disable UI that depends on missing host support.
Use modality fields when sending content. For example, message.text does not mean the host accepts images in sendMessage(), and updateModelContext.image does not mean it accepts structured content.

Server Tool or Server Resource?

Use a server tool when the View needs computation, authorization, mutation, search, filtering, pagination, or fresh data:
Use a server resource when the View needs named content that exists apart from an action, such as a PDF, image, transcript, saved report, or static config:
If a button mutates server state, make it an app-visible tool and call it with callServerTool(). If a menu lists files, call listServerResources() and then readServerResource().

Model Context or Chat Message?

Use updateModelContext() when the model should know what the user is viewing next time, but should not respond yet.
Use sendMessage() when a user action should continue the conversation immediately.
For large state, update model context first, then send a short message. This keeps the user-visible chat clean while still giving the model the facts it needs.

Sampling or Conversation?

Use createSamplingMessage() for work that belongs inside the View, such as generating a short label, grouping visible rows, or summarizing a selected passage before the user commits it.
Use sendMessage() when the output should become part of the chat transcript or when the model should decide which server tools to call next.

App-side Tool or Server Tool?

Use an app-side tool when the host needs information that only exists inside the rendered View.
Use a server tool when the action needs backend data, credentials, audit logging, writes, or any source of truth outside the iframe. App-side tools can read UI state, but they should not become a hidden backend.

Errors and Fallbacks

Tool execution errors come back as results, so check isError. Protocol, transport, and host rejection failures may throw.
For host-mediated actions such as links, messages, and downloads, also check returned isError when the method returns it.

Requests

Full method signatures for View-to-host requests.

Event Handlers

Incoming notifications and host-to-View requests.

App Tools

Expose View-local tools to the host and model.

Core Types

Host capabilities, context, metadata, display modes, and content types.