Class AbstractHttpClientConnectionProvider

java.lang.Object
com.mulesoft.connectors.mcp.internal.client.connection.provider.AbstractHttpClientConnectionProvider
All Implemented Interfaces:
org.mule.runtime.api.lifecycle.Disposable, org.mule.runtime.api.lifecycle.Initialisable, org.mule.runtime.api.lifecycle.Lifecycle, org.mule.runtime.api.lifecycle.Startable, org.mule.runtime.api.lifecycle.Stoppable, org.mule.sdk.api.connectivity.CachedConnectionProvider<io.modelcontextprotocol.client.McpAsyncClient>, org.mule.sdk.api.connectivity.ConnectionProvider<io.modelcontextprotocol.client.McpAsyncClient>
Direct Known Subclasses:
SseClientConnectionProvider, StreamableHttpClientConnectionProvider

public abstract class AbstractHttpClientConnectionProvider extends Object implements org.mule.sdk.api.connectivity.CachedConnectionProvider<io.modelcontextprotocol.client.McpAsyncClient>, org.mule.runtime.api.lifecycle.Lifecycle
Base class for client providers based on Http
Since:
0.2.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.mule.extension.http.api.request.authentication.HttpRequestAuthentication
     
    protected ConfigTracker
     
    protected org.mule.runtime.http.api.client.HttpClient
     
    protected org.mule.runtime.http.api.HttpService
     
     
    protected org.mule.runtime.core.api.MuleContext
     
    protected String
     
    protected Integer
    Sets the duration to wait for server responses before timing out requests.
    protected TimeUnit
    Time Unit for the requestTimeout parameter
    protected org.mule.runtime.api.tls.TlsContextFactory
    When specified, the client will connect through https

    Fields inherited from interface org.mule.runtime.api.lifecycle.Disposable

    PHASE_NAME

    Fields inherited from interface org.mule.runtime.api.lifecycle.Initialisable

    PHASE_NAME

    Fields inherited from interface org.mule.runtime.api.lifecycle.Startable

    PHASE_NAME

    Fields inherited from interface org.mule.runtime.api.lifecycle.Stoppable

    PHASE_NAME
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final io.modelcontextprotocol.client.McpAsyncClient
     
    protected abstract io.modelcontextprotocol.spec.McpClientTransport
     
    void
    disconnect(io.modelcontextprotocol.client.McpAsyncClient client)
     
    final void
     
    final void
     
    final void
     
    final void
     
    org.mule.sdk.api.connectivity.ConnectionValidationResult
    validate(io.modelcontextprotocol.client.McpAsyncClient client)
     

    Methods inherited from class java.lang.Object

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

    • httpService

      @Inject protected org.mule.runtime.http.api.HttpService httpService
    • configTracker

      @Inject protected ConfigTracker configTracker
    • messagingManager

      @Inject protected MessagingManager messagingManager
    • muleContext

      @Inject protected org.mule.runtime.core.api.MuleContext muleContext
    • refName

      @RefName protected String refName
    • requestTimeout

      @Parameter @Optional(defaultValue="30") @Summary("Sets the duration to wait for server responses before timing out requests.") protected Integer requestTimeout
      Sets the duration to wait for server responses before timing out requests. This timeout applies to all requests made through the client, including tool calls, resource access, and prompt operations.
    • requestTimeoutUnit

      @Parameter @Optional(defaultValue="SECONDS") @Summary("Time Unit for the requestTimeout parameter") protected TimeUnit requestTimeoutUnit
      Time Unit for the requestTimeout parameter
    • tlsContextFactory

      @Parameter @Optional protected org.mule.runtime.api.tls.TlsContextFactory tlsContextFactory
      When specified, the client will connect through https
    • authentication

      @Parameter @Optional @Placement(tab="Authentication") protected org.mule.extension.http.api.request.authentication.HttpRequestAuthentication authentication
    • httpClient

      protected org.mule.runtime.http.api.client.HttpClient httpClient
  • Constructor Details

    • AbstractHttpClientConnectionProvider

      public AbstractHttpClientConnectionProvider()
  • Method Details

    • createClientTransport

      protected abstract io.modelcontextprotocol.spec.McpClientTransport createClientTransport()
    • connect

      public final io.modelcontextprotocol.client.McpAsyncClient connect() throws org.mule.runtime.api.connection.ConnectionException
      Specified by:
      connect in interface org.mule.sdk.api.connectivity.ConnectionProvider<io.modelcontextprotocol.client.McpAsyncClient>
      Throws:
      org.mule.runtime.api.connection.ConnectionException
    • disconnect

      public void disconnect(io.modelcontextprotocol.client.McpAsyncClient client)
      Specified by:
      disconnect in interface org.mule.sdk.api.connectivity.ConnectionProvider<io.modelcontextprotocol.client.McpAsyncClient>
    • validate

      public org.mule.sdk.api.connectivity.ConnectionValidationResult validate(io.modelcontextprotocol.client.McpAsyncClient client)
      Specified by:
      validate in interface org.mule.sdk.api.connectivity.ConnectionProvider<io.modelcontextprotocol.client.McpAsyncClient>
    • initialise

      public final void initialise() throws org.mule.runtime.api.lifecycle.InitialisationException
      Specified by:
      initialise in interface org.mule.runtime.api.lifecycle.Initialisable
      Throws:
      org.mule.runtime.api.lifecycle.InitialisationException
    • start

      public final void start() throws org.mule.runtime.api.exception.MuleException
      Specified by:
      start in interface org.mule.runtime.api.lifecycle.Startable
      Throws:
      org.mule.runtime.api.exception.MuleException
    • stop

      public final void stop() throws org.mule.runtime.api.exception.MuleException
      Specified by:
      stop in interface org.mule.runtime.api.lifecycle.Stoppable
      Throws:
      org.mule.runtime.api.exception.MuleException
    • dispose

      public final void dispose()
      Specified by:
      dispose in interface org.mule.runtime.api.lifecycle.Disposable