MCPNEW
McpAppFrame
Sandboxed iframe + postMessage bridge for MCP Apps spec.
Available in
reactangularvuePreview
Live previewreal component
Install
TerminalBash
npx mcp-elements add mcp-app-frameUsage
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)}
/>
)
}mcp-app-frame.component.tsTS
import { Component } from '@angular/core'
import { McpeMcpAppFrameComponent } from '@mcp-elements/angular'
import type { AppMessageEnvelope } from '@mcp-elements/core'
@Component({
selector: 'app-app-frame-example',
standalone: true,
imports: [McpeMcpAppFrameComponent],
template: `<mcpe-mcp-app-frame src="https://my-mcp-app.example.com" [height]="600" (onMessage)="onMessage($event)" />`,
})
export class AppFrameExampleComponent {
onMessage(env: AppMessageEnvelope) {
console.log('app message', env)
}
}mcp-app-frame.vueVue
<script setup lang="ts">
import { McpeMcpAppFrame } from '@mcp-elements/vue'
import type { AppMessageEnvelope } from '@mcp-elements/core'
function onMessage(env: AppMessageEnvelope) {
console.log('app message', env)
}
</script>
<template>
<McpeMcpAppFrame src="https://my-mcp-app.example.com" :height="600" @message="onMessage" />
</template>Props
| Prop | Type | Default | Description |
|---|---|---|---|
src * | string | — | URL of the MCP App to load in the sandboxed iframe |
onMessage | (envelope: AppMessageEnvelope) => void | — | Called with a decoded envelope when the embedded app sends a message |
height | number | 480 | Height of the iframe in pixels |
sandbox | string | 'allow-scripts allow-same-origin' | iframe sandbox flags |
className | string | — | Additional CSS classes |