Class McpUtils

java.lang.Object
com.mulesoft.connectors.mcp.internal.McpUtils

public final class McpUtils extends Object
Misc utilities
Since:
0.1.0
  • Method Details

    • parseAndValidate

      public static URI parseAndValidate(String uri)
      Parses the given uri and throws a ModuleException if invalid
      Parameters:
      uri - potentially a URI in String format
      Returns:
      a parsed URI
    • toMcpRoles

      public static List<io.modelcontextprotocol.spec.McpSchema.Role> toMcpRoles(List<Role> roles)
      Transforms the connector representation of roles into the McpSchema ones
      Parameters:
      roles - a list of roles
      Returns:
      a list of McpSchema.Role roles
    • fromMcpRoles

      public static List<Role> fromMcpRoles(List<io.modelcontextprotocol.spec.McpSchema.Role> roles)
      Transforms the McpSchema representation of a role into the connector one
      Parameters:
      roles - a list of roles
      Returns:
      a list of Role
    • toBase64

      public static String toBase64(InputStream inputStream)
      Parameters:
      inputStream - a binary content
      Returns:
      Base64 encoded content
    • fromBase64

      public static byte[] fromBase64(String base64)
      Decodes the base64 content as a byte array
      Parameters:
      base64 - encoded content
      Returns:
      a byte array
    • getRequestAttributes

      public static RequestAttributes getRequestAttributes(MessagingManager tracker)
    • rpcErrorResponse

      public static io.modelcontextprotocol.spec.McpSchema.JSONRPCResponse rpcErrorResponse(io.modelcontextprotocol.spec.McpSchema.JSONRPCMessage originalMessage, McpErrorTypes errorType, String message)
    • rpcErrorResponse

      public static io.modelcontextprotocol.spec.McpSchema.JSONRPCResponse rpcErrorResponse(Object id, McpErrorTypes errorType, String message)
    • immutable

      public static <K, V> org.mule.runtime.api.util.MultiMap<K,V> immutable(org.mule.runtime.api.util.MultiMap<K,V> multiMap)