Class MCPPluginOptions

java.lang.Object
com.google.genkit.plugins.mcp.MCPPluginOptions

public class MCPPluginOptions extends Object
Configuration options for the MCP plugin.

This class allows configuration of MCP server connections, including:

  • Multiple MCP servers with different transports (STDIO, HTTP)
  • Connection timeouts and retry settings
  • Raw tool response handling

Example usage:


 MCPPluginOptions options = MCPPluginOptions.builder().name("my-mcp-host")
 		.addServer("filesystem",
 				MCPServerConfig.stdio("npx", "-y", "@modelcontextprotocol/server-filesystem", "/tmp"))
 		.addServer("weather", MCPServerConfig.http("http://localhost:3001/mcp"))
 		.requestTimeout(Duration.ofSeconds(30)).build();
 
  • Method Details

    • builder

      public static MCPPluginOptions.Builder builder()
      Creates a new builder for MCPPluginOptions.
      Returns:
      a new builder
    • getName

      public String getName()
      Gets the name of the MCP host.
      Returns:
      the host name
    • getServers

      public Map<String,MCPServerConfig> getServers()
      Gets the configured MCP servers.
      Returns:
      map of server name to configuration
    • getRequestTimeout

      public Duration getRequestTimeout()
      Gets the request timeout.
      Returns:
      the request timeout
    • isRawToolResponses

      public boolean isRawToolResponses()
      Whether to return raw MCP tool responses.
      Returns:
      true if raw responses should be returned