MCP app widget blocked by CSP: declare every origin in resourceDomains and connectDomains
A widget that loads scripts, images or fetches from an origin missing from its declared CSP will be blocked. Add each origin or stop using it.
Add every external origin your widget HTML uses to _meta.ui.csp. The rule apps.csp-undeclared-domain is a major finding for ChatGPT and Claude. It runs when a CSP is declared and the template references an origin the CSP does not cover.
What you see
- A scan reports
Not declared: resourceDomains https://cdn.acme.example; connectDomains https://api.acme.example. - In the host, the widget renders partly or blank. Browser developer tools show a Content Security Policy violation. The exact console wording depends on the browser and is not verified here.
Why it happens
The MCP Apps specification gives a restrictive default and says hosts "MUST NOT allow undeclared domains". Each list controls one kind of request:
connectDomains: fetch, XHR and WebSocket origins.resourceDomains: images, scripts, stylesheets, fonts and media.frameDomains: nested iframes.
OpenAI's UI guide says the same split: connectDomains for API requests and resourceDomains for scripts, styles, images and other assets. Authors often add the API origin and forget a font, an image CDN or a stylesheet.
The scan finds origins from <script src>, <link>, <img>, <source>, <video>, <audio>, <iframe>, CSS url() and @import, and from literal fetch, WebSocket, EventSource and sendBeacon calls. Origins built at runtime are not seen.
Check it yourself
curl -s -X POST https://mcp.acme.example/mcp \
-H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
-H "Authorization: Bearer $TOKEN" \
-d '{"jsonrpc":"2.0","id":1,"method":"resources/read","params":{"uri":"ui://widget/orders.html"}}' \
| jq -r '.result.contents[0] | ._meta.ui.csp, .text' | grep -Eo 'https?://[^"'"'"' )]+' | sort -u
Compare the origins in the HTML with the lists printed from _meta.ui.csp.
Fix
_meta: { ui: { csp: {
connectDomains: ["https://api.acme.example"],
resourceDomains: ["https://cdn.acme.example"],
} } }
Declare each origin once under the right list, with scheme and port where non-default. Prefer bundling assets into the template so fewer origins are needed. Do not widen with wildcards (apps.csp-wildcard).
Verify
Open the widget with browser developer tools and confirm no CSP violations. Re-scan. If the scan reports no CSP at all, see apps.csp-missing.
Which clients care
ChatGPT and Claude, per the rule. OpenAI's guide adds that review checks the declared policy against UI behaviour.
Source
OpenAI UI guide: https://developers.openai.com/plugins/build/chatgpt-ui
MCP Apps specification: https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx
Run a free scan at https://mcpshipyard.com/scan to check every rule at once.
Check every rule at once
A free scan runs this check and the other 152 against your live URL.