Class SseParser

java.lang.Object
com.shaft.commandline.mcp.SseParser

public final class SseParser extends Object
Extracts the JSON payload from a Server-Sent Events response body. shaft-mcp returns tools/list and tools/call results over HTTP as a single SSE message event:
id:<session-id>
event:message
data:{"jsonrpc":"2.0",...}
Per the SSE spec, multiple data: lines within one event are joined with newlines.
  • Method Details

    • extractData

      public static String extractData(String body)
      Concatenates the data: lines of an SSE body into their raw payload.
      Parameters:
      body - the raw SSE response body
      Returns:
      the concatenated data payload (typically a JSON string)