class RubyLLM::MCP::Client

Speaks JSON-RPC to one MCP server over a transport. It speaks the 2026-07-28 revision and falls back to the initialize handshake for servers that predate it, declaring only its extensions so those servers never call back. A server that rejects 2026-07-28 while listing it gets the request once more; one that rejects it while listing a revision from LEGACY_VERSIONS, or without listing any, gets the handshake instead; one that answers the handshake with a revision missing from LEGACY_VERSIONS is disconnected.

Servers that predate 2026-07-28 may announce that their tools, prompts, or resources changed on the stream of any request. Those notifications reach the block given to ::new once the request is answered, so the block can make requests of its own. #listen opens a subscription for them instead: subscriptions/listen on newer servers, resources/subscribe and the session’s own stream on older ones, which never announce the status of tasks. Their subscription counts as acknowledged once a ping confirms the session, starting a new one if it ended.

An MCP builds its own client. Applications use one only to read meta, when they send a server requests of their own.