Principle:A9T9 RPA Tool Call Relay
| Knowledge Sources | |
|---|---|
| Domains | MCP, JSON_RPC |
| Last Updated | 2026-10-22 00:00 GMT |
Overview
Mechanism for relaying tool calls from an MCP client to a browser extension via a local WebSocket bridge using JSON-RPC 2.0 over stdio and WebSocket.
Description
Tool Call Relay is the transport layer of the MCP bridge. The bridge process sits between two communication channels:
- stdio (JSON-RPC 2.0): the MCP client (Claude Code, Cursor) communicates with the bridge via newline-delimited JSON-RPC 2.0 messages over stdin/stdout. This is the standard MCP transport for local processes.
- WebSocket: the bridge runs a local WebSocket server; the browser extension's `McpBridgeClient` connects to it. Tool calls received from the MCP client are forwarded to the extension via WebSocket, and results are relayed back.
The relay handles:
- Tool call forwarding: `callExtensionTool` sends a `{ type: 'tool_call', id, tool, args }` message to the active extension connection
- Timeout management: each tool has a per-tool timeout; the relay resolves with an error if the extension does not respond in time
- Cancellation: the relay supports tool-call cancellation, forwarding cancel messages to the extension
- Connection management: the bridge tracks active connections, supports multiple browsers, and handles reconnection
Usage
Use this principle when designing an MCP bridge that connects a stdio-based MCP client to a WebSocket-based browser extension.
Theoretical Basis
The relay is a bidirectional message bridge:
Failed to parse (syntax error): {\displaystyle \text{MCP Client} \xleftrightarrow{\text{JSON-RPC / stdio}} \text{Bridge} \xleftrightarrow{\text{WebSocket}} \text{Extension} }