MCPNEW

McpAppFrame

Sandboxed iframe + postMessage bridge for MCP Apps spec.

Available inreactangularvue

Preview

Live previewreal component

Install

TerminalBash
npx mcp-elements add mcp-app-frame

Usage

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

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

Props

PropTypeDefaultDescription
src *stringURL of the MCP App to load in the sandboxed iframe
onMessage(envelope: AppMessageEnvelope) => voidCalled with a decoded envelope when the embedded app sends a message
heightnumber480Height of the iframe in pixels
sandboxstring'allow-scripts allow-same-origin'iframe sandbox flags
classNamestringAdditional CSS classes