Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions scripts/generate-schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const EXTERNAL_TYPE_SCHEMAS = [
"ContentBlockSchema",
"CallToolResultSchema",
"EmbeddedResourceSchema",
"IconSchema",
"ImplementationSchema",
"RequestIdSchema",
"ResourceLinkSchema",
Expand Down
51 changes: 51 additions & 0 deletions specification/draft/apps.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,8 @@ interface HostCapabilities {
openLinks?: {};
/** Host supports file downloads via ui/download-file. */
downloadFile?: {};
/** Host may label the View with its document title and icon (ui/notifications/document-info-changed). */
documentInfo?: {};
/** Host can proxy tool calls to the MCP server. */
serverTools?: {
/** Host supports tools/list_changed notifications. */
Expand Down Expand Up @@ -908,6 +910,39 @@ Hosts notify views of display mode changes via `ui/notifications/host-context-ch
- If the requested mode is not available, Host SHOULD return the current display mode in the response.
- Host MAY decline display mode requests from Views that did not declare said modes in their capabilities.

### View Title and Icon

Hosts that show a View in their own chrome, such as a tab, a panel header or a window title, need a label and an icon for it. A View already names itself the way any web page does, with `document.title` and `<link rel="icon">`, but the Host cannot read them from a sandboxed cross-origin iframe. Hosts get them in two ways:

- **From the resource HTML.** A Host MAY take the `<title>` element and the first `<link rel="icon">` from the HTML returned by `resources/read`, to label the View before it runs.
- **From the View.** A View MAY send `ui/notifications/document-info-changed` with its current `title` and `icons`, after initialization and whenever they change.

```typescript
// View -> Host, e.g. after the user opens a document in the View
{
jsonrpc: "2.0",
method: "ui/notifications/document-info-changed",
params: {
title: "Q3 board deck",
icons: [{ src: "data:image/svg+xml;base64,...", mimeType: "image/svg+xml" }]
}
}
```

For the label, the Host SHOULD use, in order: the latest title from `ui/notifications/document-info-changed`, the `<title>` of the resource HTML, the tool's display name (`title`, then `annotations.title`, then `name`), the UI resource's `title` or `name`, then the server's name. For the icon: the latest notified icon, the resource HTML's icon, the tool's icon, then the server's icon.

**Host behavior:**
- Host MAY use the View's title and icon wherever it shows the View in its own chrome.
- Host MUST render the title as plain text. Host SHOULD truncate it (for example to 80 characters) and strip control and bidirectional-override characters.
- Host MUST keep the server's identity, taken from information the Host controls (such as the server's name and icon), visible next to the View's label. The View's title and icon MUST NOT replace that identity in permission prompts, consent dialogs, or anywhere else the user decides whom to trust.
- Host SHOULD rate-limit updates, for example to one per second, and MAY ignore a title that copies the Host's own UI strings.
- Host SHOULD only load icons from `data:` URIs or from origins in the resource's `csp.resourceDomains`, MUST fetch them without credentials, and MAY rasterize or size-limit them.
- Host that does not support this omits `hostCapabilities.documentInfo` and ignores the notification.

**View behavior:**
- View SHOULD keep its `<title>` meaningful, since Hosts may show it without a notification.
- View SHOULD NOT use a title or icon that imitates the Host or another app.

### Theming

Hosts can optionally pass CSS custom properties via `HostContext.styles.variables` for visual cohesion with the host environment.
Expand Down Expand Up @@ -1510,6 +1545,21 @@ The View MAY send this notification to request that the host tear it down. This
- Host MAY defer or ignore the teardown request.
- If the Host accepts the request, it MUST follow the graceful termination process by sending `ui/resource-teardown` to the View. The Host SHOULD wait for a response before tearing down the resource (to prevent data loss).

`ui/notifications/document-info-changed` - View's document title or icon changed

```typescript
{
jsonrpc: "2.0",
method: "ui/notifications/document-info-changed",
params: {
title?: string, // The View's document title, as plain text. "" clears it.
icons?: Icon[] // MCP Icon objects (src, mimeType, sizes, theme). [] clears them.
}
}
```

The View MAY send this notification after `ui/notifications/initialized`, and whenever its title or icon changes. Omitted fields leave the previous value unchanged. Views SHOULD only send it when `hostCapabilities.documentInfo` is present. See [View Title and Icon](#view-title-and-icon) for how Hosts use it.

`ui/notifications/host-context-changed` - Host context has changed

```typescript
Expand Down Expand Up @@ -2705,6 +2755,7 @@ App tools MUST be tied to the app's lifecycle:
### Other risks

- **Social engineering:** UI can still display misleading content. Hosts should clearly indicate sandboxed UI boundaries.
- **View titles and icons:** A View can name itself after the Host or another app ("Settings", "Sign in"). Hosts that show a View's title or icon keep the server's identity visible next to it and never use them in trust decisions. See [View Title and Icon](#view-title-and-icon).
- **Resource consumption:** Malicious View can consume CPU/memory. Hosts should implement resource limits.

## Reservations in MCP
Expand Down
61 changes: 61 additions & 0 deletions src/generated/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/generated/schema.test.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions src/generated/schema.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions src/spec.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type {
CallToolResult,
ContentBlock,
EmbeddedResource,
Icon,
Implementation,
RequestId,
ResourceLink,
Expand Down Expand Up @@ -487,6 +488,21 @@ export interface McpUiRequestTeardownNotification {
params?: {};
}

/**
* @description Notification of the View's document title and icon (View -> Host).
* Hosts that show the View in their own chrome (a tab, panel header or window title) may use them as its label.
* Omitted fields leave the previous value unchanged.
*/
export interface McpUiDocumentInfoChangedNotification {
method: "ui/notifications/document-info-changed";
params: {
/** @description The View's current document title, as plain text. An empty string clears it. */
title?: string;
/** @description Icons for the View. An empty array clears them. */
icons?: Icon[];
};
}

/**
* @description Capabilities supported by the host application.
* @see {@link McpUiInitializeResult `McpUiInitializeResult`} for the initialization result that includes these capabilities
Expand All @@ -498,6 +514,8 @@ export interface McpUiHostCapabilities {
openLinks?: {};
/** @description Host supports file downloads via ui/download-file. */
downloadFile?: {};
/** @description Host may label the View with its document title and icon (ui/notifications/document-info-changed). */
documentInfo?: {};
/** @description Host can proxy tool calls to the MCP server. */
serverTools?: {
/** @description Host supports tools/list_changed notifications. */
Expand Down Expand Up @@ -833,6 +851,8 @@ export const HOST_CONTEXT_CHANGED_METHOD: McpUiHostContextChangedNotification["m
"ui/notifications/host-context-changed";
export const REQUEST_TEARDOWN_METHOD: McpUiRequestTeardownNotification["method"] =
"ui/notifications/request-teardown";
export const DOCUMENT_INFO_CHANGED_METHOD: McpUiDocumentInfoChangedNotification["method"] =
"ui/notifications/document-info-changed";
export const RESOURCE_TEARDOWN_METHOD: McpUiResourceTeardownRequest["method"] =
"ui/resource-teardown";
export const INITIALIZE_METHOD: McpUiInitializeRequest["method"] =
Expand Down
5 changes: 5 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import type {
ToolListChangedNotification,
} from "@modelcontextprotocol/client";
import type {
McpUiDocumentInfoChangedNotification,
McpUiDownloadFileRequest,
McpUiDownloadFileResult,
McpUiHostContextChangedNotification,
Expand Down Expand Up @@ -73,6 +74,7 @@ export {
TOOL_CANCELLED_METHOD,
HOST_CONTEXT_CHANGED_METHOD,
REQUEST_TEARDOWN_METHOD,
DOCUMENT_INFO_CHANGED_METHOD,
RESOURCE_TEARDOWN_METHOD,
INITIALIZE_METHOD,
INITIALIZED_METHOD,
Expand Down Expand Up @@ -103,6 +105,7 @@ export {
type McpUiResourceTeardownRequest,
type McpUiResourceTeardownResult,
type McpUiRequestTeardownNotification,
type McpUiDocumentInfoChangedNotification,
type McpUiHostCapabilities,
type McpUiAppCapabilities,
type McpUiInitializeRequest,
Expand Down Expand Up @@ -144,6 +147,7 @@ export {
McpUiResourceTeardownRequestSchema,
McpUiResourceTeardownResultSchema,
McpUiRequestTeardownNotificationSchema,
McpUiDocumentInfoChangedNotificationSchema,
McpUiHostCapabilitiesSchema,
McpUiAppCapabilitiesSchema,
McpUiInitializeRequestSchema,
Expand Down Expand Up @@ -202,6 +206,7 @@ export type AppNotification =
| McpUiSizeChangedNotification
| McpUiSandboxProxyReadyNotification
| McpUiRequestTeardownNotification
| McpUiDocumentInfoChangedNotification
| LoggingMessageNotification;

/**
Expand Down