MCP App CSP Explained: Why Your Widget Won't Render
You built an MCP App. The tool works. The server returns data. But the widget renders as a blank iframe. You've hit the #1 problem in MCP App development: Content Security Policy. This post explain...

Source: DEV Community
You built an MCP App. The tool works. The server returns data. But the widget renders as a blank iframe. You've hit the #1 problem in MCP App development: Content Security Policy. This post explains exactly how CSP works in MCP Apps, what the three domain arrays do, the mistakes that cause silent failures, and how to debug them. By the end, you'll never stare at a blank widget again. The sandbox model Every MCP App widget runs inside a sandboxed iframe. On ChatGPT, that iframe lives at a domain like yourapp.web-sandbox.oaiusercontent.com. On Claude, it's computed from a hash of your server URL. On VS Code, it's host-controlled. The sandbox blocks everything by default. No external API calls. No CDN images. No Google Fonts. No WebSocket connections. Nothing leaves the iframe unless you explicitly declare it. You declare allowed domains in _meta.ui.csp on your MCP resource. The host reads this and sets the iframe's Content Security Policy. If a domain isn't declared, the browser blocks t