@mcp-b/mcp-iframe wraps the iframe transport flow in a custom element. It is the package to use when you want to expose an iframe’s tools, prompts, or resources to the parent page without manually wiring transport classes.
When to use this package
- You want a parent page to surface capabilities from an iframe.
- You prefer a declarative element over manual
IframeParentTransportandIframeChildTransportsetup. - You want namespaced tool forwarding tied to an element ID.
When not to use this package
- You need low-level control over message flow or custom transport wiring. Use
@mcp-b/transports. - The iframe content does not expose
navigator.modelContextor a compatible runtime.
Where it sits in the package graph
This package sits on top of the iframe transport pair from@mcp-b/transports. It is a browser-facing convenience layer, not a separate transport protocol.
First step
Exposenavigator.modelContext inside the iframe, then import @mcp-b/mcp-iframe in the parent page and add the <mcp-iframe> element. The reference page documents events, attributes, methods, and namespacing behavior.
Related pages
Reference
Element registration, attributes, methods, and event contract.
Bridge tools across iframes
Set up a parent-child iframe bridge step by step.
Transports overview
Inspect the underlying iframe transport classes.
Spec status and limitations
Background on cross-document exposure questions that still affect iframe behavior.
