You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your server returns a `ui://` resource URI, goose fetches the HTML and renders it in an iframe. The app communicates back via `postMessage`—requesting theme info, sending messages to chat, or resizing itself.
534
536
535
-
MCP Apps run sandboxed with CSP restrictions. See the [MCP Apps Specification](https://github.com/modelcontextprotocol/ext-apps) for details on security and the full protocol.
537
+
MCP Apps run in a sandboxed iframe with strict Content Security Policy restrictions.
538
+
539
+
### Content Security Policy Configuration
540
+
541
+
By default, apps can only load resources from their own origin. If your app needs to interact with external domains—such as loading resources from a CDN, making API calls, or embedding maps—you can configure which domains are allowed through the `csp` object in the resource's `_meta.ui` section.
542
+
543
+
```javascript
544
+
_meta: {
545
+
ui: {
546
+
csp: {
547
+
connectDomains: [], // Domains for fetch/XHR requests
548
+
resourceDomains: [], // Domains for scripts, styles, images, fonts, media
549
+
frameDomains: [], // Origins allowed for nested iframes
550
+
baseUriDomains: [], // Additional allowed base URIs
551
+
},
552
+
},
553
+
}
554
+
```
555
+
556
+
| Option |CSP Directive | Purpose | Default |
557
+
|--------|---------------|---------|---------|
558
+
|`connectDomains`|`connect-src`| Domains your app can make network requests to | Same-origin only |
559
+
|`resourceDomains`|`script-src`, `style-src`, `img-src`, `font-src`, `media-src`| Domains for loading external resources | Same-origin only |
560
+
|`frameDomains`|`frame-src`| Origins allowed for nested `<iframe>` elements |`'none'` (no iframes) |
561
+
|`baseUriDomains`|`base-uri`| Additional domains allowed for`<base>` element |`'self'` only |
See the [MCP Apps Specification](https://github.com/modelcontextprotocol/ext-apps) for details on security and the full protocol.
587
+
588
+
:::warning Security Consideration
589
+
Only add domains you trust. Each domain you add expands what external content can be loaded or embedded in your app. Keep the list minimal and specific to reduce security risks.
0 commit comments