Skip to main content
@mcp-b/transports provides transport classes for explicit MCP client/server connections over same-window postMessage, parent-child iframe messaging, and Chrome runtime ports. Use it when you need to choose or control the message path directly.

When to use this package

  • You are connecting an MCP server and client over postMessage, an iframe, or a Chrome runtime port.
  • You need direct access to transport options such as allowed origins or connection IDs.
  • You are building on top of the lower-level browser transport primitives.

When not to use this package

  • You want the runtime wired up automatically. Use @mcp-b/global.
  • You want the high-level iframe custom element instead of raw iframe transports. Use @mcp-b/mcp-iframe.

Where it sits in the package graph

The transport classes sit beside the SDK layer and below higher-level packages. @mcp-b/global selects a server transport automatically, while @mcp-b/mcp-iframe creates the parent-side iframe client transport. React MCP clients can also accept a transport supplied by the application.

What this package does not provide

These classes do not install document.modelContext or perform native cross-document WebMCP discovery. Native iframe discovery uses allow="tools", exposedTo, and getTools({ fromOrigins }) without an MCP transport. There is no user-script transport. Extension transports require chrome.runtime.Port; ordinary page scripts and user-script managers do not gain that API from this package.

First step

Choose the transport pair that matches your boundary, then connect it to a server or client. The reference page lists every class, option surface, and security boundary.

Reference

Transport classes, option tables, and connection examples.

Bridge tools across iframes

Practical iframe transport setup.

Transports and bridges

Conceptual background on how tools move between boundaries.

mcp-iframe overview

The higher-level wrapper built on the iframe transports.

WebMCP standard API

Compare MCP transports with native browser discovery.