class LittleGhost::MCP::Client

Client makes tools from an MCP server available as ordinary LittleGhost tools. Agents can use a remote capability without learning a second tool interface.

transport = LittleGhost::MCP::HTTPTransport.new(url: "https://mcp.example/rpc")
client = LittleGhost::MCP::Client.new(transport:, prefix: "docs")
client.tools.map(&:tool_name) # => ["docs_search", "docs_fetch"]

Tool names are normalized and checked for collisions. Pagination, tool count, and response sizes are limited; rejected_tools and definition_filter can enforce an application allowlist.

Server definitions and results remain untrusted input. LittleGhost validates them before creating tools, but applications still decide which servers and capabilities an agent may use.

A client and its transport represent one authenticated server session. Create a separate pair for each principal or trust boundary. Protocol initialization and subsequent requests through one client are serialized; do not share its transport with another client.