We talked about Tools and then MCP . In this post let's talk how to use Quarkus and lanchaing4j to connect your intelligent application to MCP servers! Requirements Java Open JDK (24 is preferred) Maven Ollama with at least one LLM model that you can locally. Notice that you could use other providers such as ramalama and vllm , but you will need to use the correct dependencies for OpenAI API. jbang , npx or other tool required top run the MCP server The LLM client application Our application simple needs the dependencies quarkus-langchain4j-mcp , quarkus-langchain4j-ollama and quarkus-rest . You can generate your application online using Code Quarkus . About the code, you only need one single interface: import dev . langchain4j . service . SystemMessage ; import io . quarkiverse . langchain4j . RegisterAiService ; @ RegisterAiService public interface AIService { @ SystemMessage ( "You are a nice and helpful assistant." ) String input ( S...
You probably heard about Model Context Protocol (MCP) , which is basically a standard for connecting Tools to LLMs. It was released November 2024 and a few months later we have a good list of MCP Clients and MCP Servers . Building MCP Server is easy with Quarkus and there are a few good servers available with one single jbang command. Check the Quarkiverse MCP Servers project! For the client I did find myself with some difficult finding a good lightweight open MCP Client. Don't get me wrong, I know there are good alternatives, but I only use ollama locally and I don't want to fell in the multiverse of LLM Clients to find one that fits my needs. I wanted to build my own MCP Client! In this post let's take a look at MCP Java SDK to build our own client. MCP Java SDK MCP provides a good modern Java SDK for building MCP applications. Quarkus and langchain4j are also a good alternative, but this time I needed something low level. To get started with the MCP Java SDK you ...