Tab Transport (In-Page Communication)
For communication within the same browser tab: Use cases:- Website exposing tools to extension
- Same-origin communication
- Real-time tool updates
Setting Up Tab Transport
Extension Transport (Cross-Context)
For communication between extension components: Use cases:- Multi-tab tool aggregation
- Extension-to-extension communication
- Centralized tool management
Extension Transport Features
The extension transport enables:- Tool Aggregation - Collect tools from multiple tabs into a single interface
- Persistent Connection - Maintain stable communication channels across page navigation
- Background Processing - Execute tool calls in the background service worker
- Cross-Tab Coordination - Coordinate actions across multiple browser tabs
Transport Comparison
| Feature | Tab Transport | Extension Transport |
|---|---|---|
| Scope | Single tab | Multiple tabs/extension |
| Setup Complexity | Simple | Moderate |
| Use Case | Website tools | Extension features |
| Security | Origin-based | Extension permissions |
| Performance | Fast (same context) | Moderate (cross-context) |
| Tool Persistence | Page lifetime | Extension lifetime |
Choosing the Right Transport
Use Tab Transport when...
Use Tab Transport when...
- You’re building a website that exposes tools to AI agents
- Your tools are specific to a single page/domain
- You want simple setup with minimal configuration
- You need real-time updates as page state changes
- Your website is the primary MCP server
Use Extension Transport when...
Use Extension Transport when...
- You’re building browser extension features
- You need to aggregate tools from multiple tabs
- You want tools to persist across page navigation
- You need background processing capabilities
- You’re building cross-tab coordination features
How Transports Work
Message Flow
-
Tool Registration
- Your code calls
navigator.modelContext.registerTool() - The polyfill stores the tool definition
- The transport layer announces the new tool to connected clients
- Your code calls
-
Tool Discovery
- AI agent requests available tools
- Extension queries transport for tool list
- Transport returns all registered tools with schemas
-
Tool Execution
- AI agent calls a tool with arguments
- Extension sends execution request via transport
- Transport routes to the correct tool handler
- Handler executes and returns result
- Transport forwards result back to AI agent
