McpConnection
class McpConnection
Minimal MCP client implementing the tools-related subset of the protocol on top of McpTransport (Streamable HTTP by default).
Responsibilities:
initializehandshake +notifications/initialized;session management:
Mcp-Session-Idheader capture and automatic re-initialization when the server answers 404 (session expired);tools/listwith pagination and caching - see listTools;tools/callwith textual result rendering - see callTool.
Server-initiated features (sampling, roots, elicitation) are not supported: empty client capabilities are declared, so a compliant server will not send such requests. Incoming messages that do not match our request id (notifications, server requests) are skipped while scanning SSE streams.