Wire up an MCP client

MCPClient client = MCPClient.builder()
    .transport(MCPTransport.stdio("npx", "-y", "@belgavi/cassandra-mcp"))
    .build();
List mcpTools = client.discoverTools();
agent.addTools(mcpTools);
Advertisement

Discovery is dynamic

MCP servers announce their tools at connect time. If they add tools, your agent gets them on reconnect.

Advertisement

Transports

stdio for local subprocess. HTTP for remote. Same interface either way.