Interface McpTransport

All Known Implementing Classes:
HttpMcpTransport

public interface McpTransport
Interface for MCP communication transports. Transports are responsible for receiving and sending raw JSON-RPC messages.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Functional interface for handling incoming MCP messages.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    sendMessage(String sessionId, String message)
    Sends a message to a specific session.
    void
    Starts the transport.
    void
    Stops the transport and releases any resources.
  • Method Details

    • start

      void start(McpTransport.McpHandler handler) throws IOException
      Starts the transport.
      Parameters:
      handler - The handler to call when a new message is received.
      Throws:
      IOException - If the transport fails to start.
    • stop

      void stop()
      Stops the transport and releases any resources.
    • sendMessage

      void sendMessage(String sessionId, String message)
      Sends a message to a specific session.
      Parameters:
      sessionId - The ID of the session to send the message to.
      message - The raw JSON-RPC message string.