Package com.tnsai.mcp.client
Class StdioTransport.Builder
java.lang.Object
com.tnsai.mcp.client.StdioTransport.Builder
- Enclosing class:
StdioTransport
Builder for creating StdioTransport instances with custom configuration.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionautoReconnect(boolean autoReconnect) Enables or disables automatic reconnection.build()Builds the StdioTransport instance.Sets the command to execute.environment(String key, String value) Adds an environment variable for the process.environment(Map<String, String> environment) Adds multiple environment variables for the process.healthCheckInterval(Duration healthCheckInterval) Sets the interval for health checks.initialRetryDelay(Duration initialRetryDelay) Sets the initial delay between reconnection attempts.maxRetries(int maxRetries) Sets the maximum number of reconnection attempts.maxRetryDelay(Duration maxRetryDelay) Sets the maximum delay between reconnection attempts.processStartTimeout(Duration processStartTimeout) Sets the timeout for process startup.shutdownTimeout(Duration shutdownTimeout) Sets the timeout for graceful shutdown.workingDirectory(String workingDirectory) Sets the working directory for the process.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
command
Sets the command to execute.- Parameters:
command- the command and arguments- Returns:
- this builder
-
environment
Adds an environment variable for the process.- Parameters:
key- the environment variable namevalue- the environment variable value- Returns:
- this builder
-
environment
Adds multiple environment variables for the process.- Parameters:
environment- the environment variables map- Returns:
- this builder
-
workingDirectory
Sets the working directory for the process.- Parameters:
workingDirectory- the working directory path- Returns:
- this builder
-
maxRetries
Sets the maximum number of reconnection attempts.- Parameters:
maxRetries- the maximum number of retries (default: 5)- Returns:
- this builder
-
initialRetryDelay
Sets the initial delay between reconnection attempts.- Parameters:
initialRetryDelay- the initial delay (default: 500ms)- Returns:
- this builder
-
maxRetryDelay
Sets the maximum delay between reconnection attempts.- Parameters:
maxRetryDelay- the maximum delay (default: 30s)- Returns:
- this builder
-
processStartTimeout
Sets the timeout for process startup.- Parameters:
processStartTimeout- the startup timeout (default: 10s)- Returns:
- this builder
-
healthCheckInterval
Sets the interval for health checks. Set to Duration.ZERO to disable health checks.- Parameters:
healthCheckInterval- the health check interval (default: 30s)- Returns:
- this builder
-
shutdownTimeout
Sets the timeout for graceful shutdown.- Parameters:
shutdownTimeout- the shutdown timeout (default: 5s)- Returns:
- this builder
-
autoReconnect
Enables or disables automatic reconnection.- Parameters:
autoReconnect- true to enable auto-reconnect (default: true)- Returns:
- this builder
-
build
Builds the StdioTransport instance.- Returns:
- a new StdioTransport instance
-