Skip to content

fix: use McpUseProvider autoSize for proper iframe height auto-sizing - #1

Open
tonxxd wants to merge 1 commit into
mainfrom
fix/widget-auto-resize
Open

tonxxd wants to merge 1 commit into
mainfrom
fix/widget-auto-resize

Conversation

@tonxxd

@tonxxd tonxxd commented Feb 16, 2026

Copy link
Copy Markdown

Summary

  • Wrap the remotion-player widget with McpUseProvider autoSize for proper iframe height auto-sizing
  • Remove the broken notifyIntrinsicHeight() call which silently no-ops on MCP Apps bridge

Problem

The widget calls appRef.current?.notifyIntrinsicHeight?.(height) to notify the host about its content height. However, notifyIntrinsicHeight is an OpenAI Apps SDK method that doesn't exist on the MCP Apps bridge (@modelcontextprotocol/ext-apps). The ?. optional chain silently no-ops, so the iframe host never receives correct height information and the widget appears stuck at a tiny auto-detected height (~110px).

Fix

Use McpUseProvider from mcp-use/react with the autoSize prop, which:

  1. Wraps the widget in a container with a ResizeObserver
  2. Detects content height changes automatically
  3. Sends them via the correct bridge method (bridge.sendSizeChanged({ height }))

This is the recommended approach for mcp-use widgets and works with both MCP Apps and ChatGPT Apps SDK protocols.

Changes

  • resources/remotion-player/widget.tsx:
    • Import McpUseProvider from mcp-use/react
    • Create wrapper component with <McpUseProvider autoSize>
    • Remove manual notifyIntrinsicHeight useEffect (replaced by ResizeObserver auto-sizing)

The widget was calling `notifyIntrinsicHeight()` which is an OpenAI Apps
SDK method that doesn't exist on the MCP Apps bridge
(@modelcontextprotocol/ext-apps). This caused the height notification to
silently no-op, leaving the iframe stuck at a tiny auto-detected height.

Wrap the widget with `McpUseProvider autoSize` which uses ResizeObserver
to detect content height changes and sends them via the correct bridge
method (`bridge.sendSizeChanged({ height })`).

Co-authored-by: Cursor <[email protected]>
@tonxxd
tonxxd requested a review from pietrozullo February 16, 2026 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant