MCP Shipyard
← Rules catalog

Very large MCP app widget template: keep the HTML small and load bundles from a declared origin

Widget templates over 1 MB trigger a warning and are not scanned for CSP problems. Inline only what must be inline.

minorapps.template-sizeChatGPT, Claude

Keep each widget template well under 1 MB. The rule apps.template-size is a minor finding for ChatGPT and Claude, reported as a warning. The 1,000,000 byte threshold is a heuristic in the scanner; no host documents a limit on the pages this rule cites.

What you see

  • A scan reports Template is 1.42 MB; its HTML was not scanned.
  • The other template checks that read the HTML (undeclared origins, inline CSP, pinned scripts, hardcoded origins) are skipped for that template, and the findings say the HTML was not scanned. A clean result for a huge template therefore proves less.

Why it happens

A bundler inlined everything into one HTML string: a charting library, fonts as base64, images as data URIs, and source maps. The whole file is sent through resources/read as text, then loaded by the host each time the widget opens.

The MCP Apps specification says hosts use resources/read to fetch the template, and that without a declared CSP the default blocks external connections and resources, which is why authors inline everything. A declared resourceDomains list is the supported alternative. OpenAI's UI guide also tells you to treat the resource URI as a cache key and publish a new URI for breaking changes, so a large file that changes often costs more.

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].text' | wc -c

Fix

  1. Split the bundle: keep the HTML shell and small script inline, and serve large static assets from a CDN origin.
  2. Declare that origin in _meta.ui.csp.resourceDomains with an exact https:// entry (apps.csp-undeclared-domain, apps.csp-wildcard).
  3. Pin versions in the URL and add an integrity hash for third-party scripts.
  4. Drop source maps and unused locales from the production build, and replace base64 images with files.

Verify

The wc -c result is comfortably below 1,000,000 and the scan can read the HTML (no "not scanned" note). Also check the first-open time in the host.

Which clients care

ChatGPT and Claude, per the rule.

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.

Scan a server