🛠️ Developer Tools

Why Your MCP App Widget Goes Blank: The Content Security Policy Trap

You built an MCP App. The server returns data. The widget is still blank. Here's why—and how to fix it in five minutes.

Code snippet showing MCP App CSP configuration with connectDomains, resourceDomains, and frameDomains arrays

⚡ Key Takeaways

  • CSP blocks all external requests by default—you must explicitly declare trusted domains in three arrays: connectDomains, resourceDomains, and frameDomains 𝕏
  • The #1 mistake is putting API domains in resourceDomains instead of connectDomains; runtime connections like fetch() require connectDomains 𝕏
  • Google Fonts and multi-domain services require both fonts.googleapis.com AND fonts.gstatic.com declared; missing one causes silent failures 𝕏
  • WebSocket connections use wss:// not https://; scheme mismatches cause silent blocking with minimal error messages 𝕏
  • ChatGPT's published mode enforces stricter CSP than dev mode and requires _meta.ui.domain; always test in production before shipping 𝕏
Published by

Open Source Beat

Community-driven. Code-first.

Worth sharing?

Get the best Open Source stories of the week in your inbox — no noise, no spam.

Originally reported by Dev.to

Stay in the loop

The week's most important stories from Open Source Beat, delivered once a week.