MCP Registry client
LangChain4j also offers a separate client implementation that can talk to MCP registries. Right now, only read-only operations are implemented (you can search for MCP servers, but managing and adding servers is not supported - please use the official tools for that). WARNING: Discovering MCP servers and using them (especially running locally) may present serious security risks. Before running any MCP server that you locate in a public registry, make sure you can trust it. The registry client lives in thedev.langchain4j.mcp.registryclient package and can be initialized like this:
registry.listServers(McpServerListRequest) method. A McpServerListRequest
object can be built using the McpServerListRequest.Builder class. The Java API in LangChain4j
closely mirrors the REST API of MCP registries as described in the official
MCP Registry Reference.