Chapter 4. Communication Protocols
While the previous chapter demonstrated how to provide context to LLMs through remote method calls, it also highlighted a significant limitation: those functions often lack reusability across different projects and programming languages. To solve this, the industry has historically relied on standardized protocols—think SOAP for web services or USB for hardware—to ensure different systems can speak the same language. In the world of AI, this standardization is achieved through the Model Context Protocol (MCP), an open-source standard that enables seamless interoperability between AI applications and external systems through a consistent interface.
In this chapter, we will explore the MCP architecture, which is built on a client-server model using JSON-RPC 2.0 for message exchange. You will learn how to implement MCP clients and servers using both LangChain4j and Quarkus, moving from basic tool execution to advanced features like Sampling, Elicitation, and ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access