Package com.tnsai.mcp

Class McpServerConfig

java.lang.Object
com.tnsai.mcp.McpServerConfig

public final class McpServerConfig extends Object
MCP Server Configuration.

Represents a remote MCP server connection configuration. Similar to CrewAI's mcps field and LangChain's MCP adapters.

Usage:

 // Simple API key auth
 McpServerConfig server = McpServerConfig.builder()
     .name("firecrawl")
     .endpoint("https://mcp.firecrawl.dev/v1")
     .apiKey("fc-xxx")
     .build();

 // Custom headers
 McpServerConfig server = McpServerConfig.builder()
     .name("custom")
     .endpoint("https://api.example.com/mcp")
     .header("X-API-Key", "xxx")
     .header("X-Workspace", "my-workspace")
     .build();

 // In Agent
 protected List<McpServerConfig> getMcpServers() {
     return List.of(
         McpServerConfig.of("https://mcp.firecrawl.dev", "fc-xxx")
     );
 }
 
  • Method Details

    • of

      public static McpServerConfig of(String endpoint, String apiKey)
      Creates an MCP server config with endpoint and API key.
    • of

      public static McpServerConfig of(String endpoint)
      Creates an MCP server config with endpoint only (no auth).
    • builder

      public static McpServerConfig.Builder builder()
      Creates a builder for more complex configurations.
    • getName

      public String getName()
    • getEndpoint

      public String getEndpoint()
    • getHeaders

      public Map<String,String> getHeaders()
    • getTimeout

      public Duration getTimeout()
    • hasApiKey

      public boolean hasApiKey()
    • toString

      public String toString()
      Overrides:
      toString in class Object