Skip to main content

Module client

Module client 

Source
Expand description

Downstream MCP client (#210).

A real MCP client built on the official rmcp SDK — no bespoke JSON-RPC. Each operation opens a fresh connection (performs the initialize handshake), does its work, and shuts the connection down. This keeps the gateway stateless and robust (no stale child processes / sessions); the expensive part — listing the full catalog — is amortized by the TTL cache in super::catalog.

Functions§

call_tool_on
Call a tool on an already-connected session (bounded by timeout).
fetch_tools
List a downstream server’s tools (connect → tools/list → disconnect).
list_tools_on
List tools on an already-connected session (bounded by timeout).
open
Open a connection to a downstream MCP server (runs the MCP initialize handshake). The whole connect is bounded by timeout.
proxy_call
Proxy a single tool call to a downstream server (connect → tools/call → disconnect).
result_to_text
Flatten a downstream CallToolResult into plain text. Text blocks are concatenated; non-text blocks (images/resources) are summarized so the proxy never returns binary blobs into the model context.

Type Aliases§

ClientService
A connected downstream MCP client session. Transport-erased: stdio, HTTP, and (in tests) in-process duplex all collapse to this one type.