Package com.tnsai.mcp
Class McpServerConfig
java.lang.Object
com.tnsai.mcp.McpServerConfig
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")
);
}
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic McpServerConfig.Builderbuilder()Creates a builder for more complex configurations.getName()booleanstatic McpServerConfigCreates an MCP server config with endpoint only (no auth).static McpServerConfigCreates an MCP server config with endpoint and API key.toString()
-
Method Details
-
of
Creates an MCP server config with endpoint and API key. -
of
Creates an MCP server config with endpoint only (no auth). -
builder
Creates a builder for more complex configurations. -
getName
-
getEndpoint
-
getHeaders
-
getTimeout
-
hasApiKey
public boolean hasApiKey() -
toString
-