Class HttpMcpClient
java.lang.Object
com.cockroachlabs.data.continuum.mcp.HttpMcpClient
- All Implemented Interfaces:
McpClient
HTTP-backed
McpClient speaking the MCP Streamable HTTP transport (spec
2025-06-18). Lazily performs the initialize handshake before the first tools
call, echoes the server-assigned Mcp-Session-Id and the
MCP-Protocol-Version header, and handles both application/json and
text/event-stream responses.
To stay independent of the host application's HTTP message converters and
Jackson version, responses are retrieved as text and parsed with Spring Boot's
JsonParser, and request bodies are written as compact JSON strings.
Construct with create(String, String) in production, or pass a pre-built
RestClient (e.g. bound to a MockRestServiceServer) in tests.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.cockroachlabs.data.continuum.mcp.McpClient
McpClient.CallResult, McpClient.Config, McpClient.Content, McpClient.Tool -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHttpMcpClient(org.springframework.web.client.RestClient rest) HttpMcpClient(org.springframework.web.client.RestClient rest, String clientName, String clientVersion) -
Method Summary
Modifier and TypeMethodDescriptionInvoke a tool by name with the given arguments.static HttpMcpClientBuilds a client posting toendpointwith a Bearer token.Discover the tools the server advertises.
-
Field Details
-
PROTOCOL_VERSION
The MCP revision this client negotiates.- See Also:
-
-
Constructor Details
-
HttpMcpClient
public HttpMcpClient(org.springframework.web.client.RestClient rest) -
HttpMcpClient
-
-
Method Details