MCP Shipyard
← Rules catalog

MCP app widget inline CSP with unsafe-eval or unsafe-inline

A meta Content-Security-Policy tag in widget HTML that allows unsafe-eval fails the rule; unsafe-inline warns. Bundle scripts instead.

majorapps.inline-csp-unsafeChatGPT, Claude

Remove 'unsafe-eval' from any CSP meta tag in the widget HTML, and avoid 'unsafe-inline'. The rule apps.inline-csp-unsafe is a major finding for ChatGPT and Claude. A 'unsafe-eval' entry fails. A 'unsafe-inline' entry on its own is a warning.

What you see

  • A scan reports Inline CSP allows 'unsafe-eval' (fail) or Inline CSP allows 'unsafe-inline' (warning), with the first 300 characters of the policy in the evidence.
  • The widget works, but the policy you wrote in the HTML undermines the one the host enforces.

Why it happens

Some frameworks and chart or template libraries evaluate strings at runtime, so authors add <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-eval'"> to make errors disappear. Others add 'unsafe-inline' to keep inline event handlers.

The MCP Apps specification defines the host's CSP from _meta.ui.csp, with a restrictive default. It lists script-src 'self' 'unsafe-inline' in that default, so inline scripts are part of the baseline, and it states hosts "MUST NOT allow undeclared domains." The specification excerpt we fetched does not say how a meta tag in your HTML is combined with the host policy; the scanner rule treats 'unsafe-eval' as a defect regardless.

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' | grep -io '<meta[^>]*content-security-policy[^>]*>'

Fix

  1. Delete the meta tag and declare origins in _meta.ui.csp instead (apps.csp-undeclared-domain).
  2. If a library needs eval or new Function, switch to a build of that library that does not, or pre-compile templates at build time.
  3. Replace inline event attributes (onclick="...") with addEventListener in a bundled script.

Verify

The grep prints nothing or a policy without the unsafe keywords. Test the widget with developer tools open, then re-scan.

Which clients care

ChatGPT and Claude, per the rule.

Source

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