Interface McpTransport

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
HttpMcpTransport, StdioMcpTransport

public interface McpTransport extends Closeable
  • Method Details

    • start

      void start(McpOperationHandler messageHandler)
      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.
    • initialize

      CompletableFuture<com.fasterxml.jackson.databind.JsonNode> initialize(McpInitializeRequest request)
      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.
    • listTools

      CompletableFuture<com.fasterxml.jackson.databind.JsonNode> listTools(McpListToolsRequest request)
      Requests a list of available tools from the MCP server.
    • executeTool

      CompletableFuture<com.fasterxml.jackson.databind.JsonNode> executeTool(McpCallToolRequest request)
      Executes a tool on the MCP server.
      Parameters:
      request - the tool execution request
    • cancelOperation

      void cancelOperation(long operationId)
      Cancels a running operation on the server (sends a 'notifications/cancelled' message to the server). This does not expect any response from the server.
      Parameters:
      operationId - The ID of the operation to be cancelled.