MCPClient implementation that connects to an MCP server over JSON-RPC.
== Transport auto-detection == For HTTP-based server configs (StreamableHTTPTransport or SSETransport), this client first attempts to connect using the MCP 2025-06-18 Streamable HTTP protocol. If the server responds with HTTP 404 or 405, it automatically falls back to the older 2024-11-05 HTTP+SSE protocol. Stdio servers always use the 2024-11-05 protocol.
== Error swallowing in getTools == getTools() never returns a Left: any failure during tool discovery (network error, parse error, missing transport) is logged and an empty sequence is returned instead. Callers cannot distinguish "server has no tools" from "server could not be reached".
== Thread safety == This class is not thread-safe. Concurrent calls to initialize, getTools, or close from different threads require external synchronisation.
Value parameters
- config
-
Server configuration including transport type, URL/command, and timeout.
Attributes
- Companion
- object
- Graph
-
- Supertypes