From the course: Hands-On AI: Building AI Agents with Model Context Protocol (MCP) and Agent2Agent (A2A)
MCP architecture
From the course: Hands-On AI: Building AI Agents with Model Context Protocol (MCP) and Agent2Agent (A2A)
MCP architecture
- [Instructor] What are the key entities that participate in MCP? In this video, we will discuss the key entities in the MCP protocol. We will explore more details of their interactions in the following videos. There are three key entities that participate in the model context protocol. The first one is the MCP Host. The MCP Host is the application that wants to access resources, tools, and prompts using MCP. This is typically the gen AI application that does orchestration across resources. This application is usually an executable service itself. Next comes the MCP Server. This is the server that exposes resources and tools through the MCP protocol. It typically sits in between the MCP Host and the backend resources and services. It talks using the MCP protocol on one side and the native protocol of the resources and services on the other side. Finally, there is the MCP Client. This is the module or function that resides within the MCP Host. The MCP Host talks to the MCP Server through the MCP Client. The MCP Client, and the MCP Server, are the entities that will communicate using the MCP protocol. Let's discuss this architecture with an example now. Let's say we have a Sales AI Assistant application. This assistant is an AI agent that answers questions about products as well as performs order management operations. This is the MCP Host. The assistant uses a knowledge base of products sold by the company. This knowledge base is stored in a Postgres Vector database where the product data is stored in embedded format for semantic search. This information will be used using retrieval augmented generation or RAG by the Sales AI Assistant. A PGVector MCP Server is deployed to front the PGVector database. This server exposes search capabilities on the Vector DB as MCP resources. It talks with the Vector database using a SQL interface. To access the knowledge base for RAG, the Sales AI Assistant has a PGVector MCP Client. This is typically a library, a package, or a class that runs inside the same executable as the MCP Host. When the Sales AI Assistant needs to search for products, it invokes the PGVector MCP Client. This MCP Client will connect to the PGVector MCP Server using the MCP protocol. The PGVector MCP Server will in turn execute the search on the Vector DB using SQL and return the results back to the MCP Client. In addition, the Sales AI Assistant also uses Salesforce Cloud for managing orders. A Salesforce MCP Server is deployed for accessing the Salesforce Cloud using MCP. It integrates with the Salesforce Cloud using the REST protocol. It exposes tools for creating, updating and deleting orders. This server can be either custom-built by the Sales AI Assistant developers, or provided by Salesforce itself for MCP integrations. The Salesforce AI Assistant also has a Salesforce MCP Client, which it uses to perform order management operations. This MCP Client talks to the Salesforce MCP Server using the MCP protocol. As seen here, irrespective of the protocol supported by the source systems like PGVector and Salesforce, the Sales AI Assistant only needs to use one protocol, namely MCP, to talk to multiple sources. Similarly, multiple AI assistants and Gen AI applications can use the same MCP Servers to integrate with their sources. This standardizes communications and reduces redundant integration work.