Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:A9T9 RPA Tool Call Relay

From Leeroopedia
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} }

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment