Class StdioMcpTransport.Builder

java.lang.Object
dev.langchain4j.mcp.client.transport.stdio.StdioMcpTransport.Builder
Enclosing class:
StdioMcpTransport

public static class StdioMcpTransport.Builder extends Object
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • command

      public StdioMcpTransport.Builder command(List<String> command)
    • environment

      public StdioMcpTransport.Builder environment(Map<String,String> environment)
    • workingDirectory

      public StdioMcpTransport.Builder workingDirectory(Path workingDirectory)
      Sets the working directory of the MCP server subprocess, including when it is restarted. If not set or null, the subprocess inherits the current process's working directory. This does not change the working directory of the current process.
      Parameters:
      workingDirectory - the subprocess working directory, or null to use the default
      Returns:
      this
    • logEvents

      public StdioMcpTransport.Builder logEvents(boolean logEvents)
    • executorService

      public StdioMcpTransport.Builder executorService(ExecutorService executorService)
      Sets the ExecutorService to use for background I/O operations. If not provided, will use DefaultExecutorProvider.getDefaultExecutor().

      Frameworks like Quarkus should provide their managed executor here. The provided executor is never shut down when the transport is closed.

      Parameters:
      executorService - the executor service to use
      Returns:
      this
    • logger

      public StdioMcpTransport.Builder logger(org.slf4j.Logger logger)
      Parameters:
      logger - an alternate Logger to be used instead of the default one provided by Langchain4J for traffic logging.
      Returns:
      this.
    • build

      public StdioMcpTransport build()