Overview
Resource_meta.ui controls security, rendering, and sandbox behavior for MCP App Views. All fields are optional.
This metadata is set on resources registered via registerAppResource.
Where to Set _meta
Set _meta.ui on resources registered via registerAppResource. The SDK passes it through to both the resources/list and resources/read responses automatically.
Advanced: listing-level vs content-item
Advanced: listing-level vs content-item
When using
registerAppResource, you can set _meta in two places:- Listing-level — in the config object. Hosts see this in the
resources/listresponse at connection time. - Content-item level — on individual
contents[]items returned by the read callback. Content-item values take precedence.
Fields
csp — Content Security Policy
Declares which external origins your View needs. The host uses these to build CSP headers for the sandboxed iframe.
| Field | CSP Directive | Purpose |
|---|---|---|
connectDomains | connect-src | fetch, XHR, and WebSocket origins |
resourceDomains | img-src, script-src, style-src, font-src, media-src | Static resource origins (images, scripts, stylesheets, fonts, media) |
frameDomains | frame-src | Nested iframe origins (e.g., YouTube embeds) |
baseUriDomains | base-uri | Allowed base URIs for the document |
https://*.example.com). Empty or omitted fields default to no external access — this is the secure default.
connectDomains
Origins for network requests — fetch(), XMLHttpRequest, and WebSocket connections. Maps to the CSP connect-src directive.
If omitted, no network connections are allowed from the View (secure default).
resourceDomains
Origins for static resources — images, scripts, stylesheets, fonts, and media files. Maps to CSP img-src, script-src, style-src, font-src, and media-src directives.
If omitted, no external resources can be loaded (secure default).
frameDomains
Origins for nested iframes within your View. Maps to the CSP frame-src directive. Use this for embedding third-party content like YouTube or Vimeo players.
If omitted, nested iframes are blocked (frame-src 'none').
baseUriDomains
Allowed base URIs for the document. Maps to the CSP base-uri directive.
If omitted, only the same origin is allowed (base-uri 'self').
permissions — Sandbox Permissions
Requests browser capabilities for the View’s iframe. Each permission is declared as an empty object
{} — its presence requests the capability.| Field | Permission Policy | Purpose |
|---|---|---|
camera | camera | Camera access (e.g., for photo capture, video calls) |
microphone | microphone | Microphone access (e.g., for voice input, audio recording) |
geolocation | geolocation | Location access (e.g., for maps, local search) |
clipboardWrite | clipboard-write | Clipboard write access (e.g., for “copy to clipboard” buttons) |
Hosts MAY honor these permissions by setting appropriate iframe
allow attributes, but are not required to. Your View should use JavaScript feature detection as a fallback and degrade gracefully when permissions are not granted.domain — Stable Sandbox Origin
Requests a stable, dedicated origin for the View’s sandbox iframe. The value is not your server’s domain — it’s a subdomain within the host’s sandbox domain space.
domain tells the host to use a stable, deterministic origin instead — useful when external services need to recognize your app by origin.
Use cases:
- OAuth callbacks — redirect URIs require a stable origin on the allowlist
- CORS policies — API servers that check
Originheaders need a known value to allowlist - API key restrictions — external services that restrict by origin
prefersBorder — Visual Boundary
Controls whether the host renders a visible border and background around the View.
| Value | Behavior |
|---|---|
true | Request visible border and background from the host |
false | Request no visible border or background (seamless appearance) |
| omitted | Host decides — defaults vary by platform |