java.lang.Object
org.apache.juneau.rest.client.mcp.AbstractMcpClient
org.apache.juneau.rest.client.mcp.v20260728.McpClient
All Implemented Interfaces:
Closeable, AutoCloseable

public final class McpClient extends AbstractMcpClient
Typed 2026-07-28 Model Context Protocol (MCP) client facade.

Extends AbstractMcpClient, adding one typed method per 2026-07-28 JSON-RPC method (see McpMethods). Every method stamps the SEP-2243 params._meta envelope (protocol version, client capabilities, client info, and any supplied trace-context fields), builds the corresponding v2 request bean, wraps it in a JsonRpcRequest with the required Mcp-Method/Mcp-Name headers, delegates to the inherited AbstractMcpClient.send(JsonRpcRequest, Map), and then either returns the result re-marshaled into its typed v2 result bean, or throws an McpException built from the response's error.

An optional McpResponseCache can be supplied via McpClient.Builder.responseCache(McpResponseCache) to serve repeat identical calls from cache instead of the wire, keyed off the method and business params (never the per-call _meta, so a per-request trace-context supplier does not defeat the cache).

A server-initiated request delivered over the duplex event-stream channel is routed through the McpDuplexDispatcher registered via setServerRequestHandler(McpServerRequestHandler).

Since:
10.0.0