<mcp-iframe> custom element wraps an iframe and automatically exposes its tools, resources, and prompts to the parent page’s navigator.modelContext.
Installation
Quick Start
Parent page — import to auto-register the element:Item Prefixing
Items are exposed with the element’sid as prefix to prevent naming conflicts:
Attributes
Standard iframe attributes (src, width, height, sandbox, etc.) are mirrored to the internal iframe.
MCP-Specific Attributes
Events
Properties & Methods
Multiple Iframes
Each iframe uses itsid as prefix:
calc:add, calc:multiply, todos:create, todos:list, etc.
Cross-Origin
For cross-origin iframes, settarget-origin explicitly:
Custom Registration
Related
Transports
Underlying IframeParentTransport
@mcp-b/global
Model Context API polyfill
Security
Origin validation
MCP UI Apps
Building embeddable apps
