MCPNEW

McpAppFrame

Sandboxed iframe + postMessage bridge for MCP Apps spec.

Available inreact

Preview

Live previewreal component

Install

TerminalBash
npx @mcp-elements/cli add mcp-app-frame

Usage

mcp-app-frame-example.tsxTSX
import { McpAppFrame } from '@mcp-elements/react'

export function Example() {
  return (
    <McpAppFrame
      src="https://my-mcp-app.example.com"
      title="My MCP App"
      height={600}
      onMessage={(e) => console.log('app message', e.data)}
    />
  )
}

Props

PropTypeDefaultDescription
src *stringURL of the MCP App to load in the sandboxed iframe
onMessage(event: MessageEvent) => voidCalled when the embedded app sends a postMessage
heightstring | number480Height of the iframe in pixels or CSS value
title *stringAccessible title for the iframe element