Skip to main content
@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 IframeParentTransport and IframeChildTransport setup.
  • 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.modelContext or 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

Expose navigator.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.