Skip to content

[BUG]: MCP Apps: spec-compliant ui:// resources are rejected (requires non-standard sandbox metadata) #7628

Open

Description

@Ishwor-ach12

Summary

With MCPGATEWAY_MCP_APPS_ENABLED=true, ContextForge rejects the UI resource of a federated MCP server that follows the MCP Apps spec, so the app can't be rendered through the gateway. validate_ui_resource requires a non-empty sandbox list in _meta.ui, but sandbox is not a field of McpUiResourceMeta in the spec, so compliant servers never send it.

Versions

  • ContextForge v1.0.8 (same code on main at 7d6d7e2 / v1.1.1)
  • Upstream server: jgraph/drawio-mcp App Server 1.5.0 (ui://drawio/mcp-app.html)

Details

mcpgateway/services/mcp_apps.py, validate_ui_resource:

ui = mcp_ui_metadata(extension_metadata)
if not ui:
raise MCPAppsValidationError("ui:// resources require MCP Apps metadata")
...
sandbox = _as_string_list(ui.get("sandbox"), field_name="sandbox")
if not sandbox:
raise MCPAppsValidationError("ui:// resources require a non-empty MCP Apps sandbox policy")

MCP Apps spec (modelcontextprotocol/ext-apps, specification/2026-01-26 and draft/apps.mdx):

  1. McpUiResourceMeta defines csp, permissions, domain and prefersBorder. There is no sandbox field. Iframe sandbox flags are the host's responsibility ("Rendering the MCP App": the host's iframe MUST have allow-scripts, allow-same-origin).
  2. _meta.ui may be on the resources/list entry or on the resources/read content item: "Hosts MUST check both locations, preferring the content item and falling back to the listing entry". The server guidance prefers the content item.

drawio-mcp 1.5.0 follows the spec: resources/list has only mimeType: text/html;profile=mcp-app, and resources/read returns _meta.ui.csp (resourceDomains, connectDomains) with no sandbox. When the gateway syncs it, validation fails on both checks above. If the listing entry has no _meta.ui, it fails with "require MCP Apps metadata" before the read-time CSP is ever seen.

Steps to reproduce

  1. Set MCPGATEWAY_MCP_APPS_ENABLED=true.
  2. Register jgraph/drawio-mcp:1.5.0 (Streamable HTTP, /mcp) as a gateway and add its tools to a virtual server.
  3. The ui://drawio/mcp-app.html resource is rejected, so MCP Apps-capable clients (e.g. Cursor, VS Code Copilot Chat) get only the tool's text and link, not the app.

Expected

A spec-compliant UI resource is accepted:

  • sandbox optional: the gateway applies its own default sandbox when absent. This matches [FEATURE]: Enforce MCP Apps CSP, sandbox, and permissions policy #4971, where the gateway enforces policy instead of requiring each server to declare it.
  • CSP/metadata validated from resources/read content as well as from the listing, preferring the content item, as the spec requires.

Related: #4971 (enforce MCP Apps CSP, sandbox, and permissions policy).

Activity

  1. added theissue type on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageIssues / Features awaiting triage

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions