Class HttpMcpTransport

java.lang.Object
dev.langchain4j.mcp.client.transport.http.HttpMcpTransport
All Implemented Interfaces:
McpTransport, Closeable, AutoCloseable

@Deprecated(forRemoval=true, since="1.4.0-beta10") public class HttpMcpTransport extends Object implements McpTransport
Deprecated, for removal: This API element is subject to removal in a future version.
The legacy HTTP/SSE transport (see specification). Whenever possible, it is recommended to use StreamableHttpMcpTransport instead.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Performs transport-specific health checks, if applicable.
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Sends a message that does not expect a response from the server - either a client-initiated notification or a response to a server-initiated request.
    CompletableFuture<com.fasterxml.jackson.databind.JsonNode>
    Deprecated, for removal: This API element is subject to removal in a future version.
    Executes an operation that expects a response from the server.
    CompletableFuture<com.fasterxml.jackson.databind.JsonNode>
    Deprecated, for removal: This API element is subject to removal in a future version.
    Sends the "initialize" message to the MCP server to negotiate capabilities, supported protocol version etc.
    void
    onFailure(Runnable actionOnFailure)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    void
    start(McpOperationHandler messageHandler)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Creates a connection to the MCP server (runs the server as a subprocess if needed).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HttpMcpTransport

      public HttpMcpTransport(HttpMcpTransport.Builder builder)
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Details

    • start

      public void start(McpOperationHandler messageHandler)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: McpTransport
      Creates a connection to the MCP server (runs the server as a subprocess if needed). This does NOT yet send the "initialize" message to negotiate capabilities.
      Specified by:
      start in interface McpTransport
    • initialize

      public CompletableFuture<com.fasterxml.jackson.databind.JsonNode> initialize(McpInitializeRequest operation)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: McpTransport
      Sends the "initialize" message to the MCP server to negotiate capabilities, supported protocol version etc. When this method returns successfully, the transport is fully initialized and ready to be used. This has to be called AFTER the "start" method.
      Specified by:
      initialize in interface McpTransport
    • executeOperationWithResponse

      public CompletableFuture<com.fasterxml.jackson.databind.JsonNode> executeOperationWithResponse(McpClientMessage operation)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: McpTransport
      Executes an operation that expects a response from the server.
      Specified by:
      executeOperationWithResponse in interface McpTransport
    • executeOperationWithoutResponse

      public void executeOperationWithoutResponse(McpClientMessage operation)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: McpTransport
      Sends a message that does not expect a response from the server - either a client-initiated notification or a response to a server-initiated request.
      Specified by:
      executeOperationWithoutResponse in interface McpTransport
    • checkHealth

      public void checkHealth()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: McpTransport
      Performs transport-specific health checks, if applicable. This is called by `McpClient.checkHealth()` as the first check before performing a check by sending a 'ping' over the MCP protocol. The purpose is that the transport may have some specific and faster ways to detect that it is broken, like for example, the STDIO transport can fail the check if it detects that the server subprocess isn't alive anymore.
      Specified by:
      checkHealth in interface McpTransport
    • onFailure

      public void onFailure(Runnable actionOnFailure)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      onFailure in interface McpTransport
    • close

      public void close() throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException