MCP provides a structured framework for AI agents to communicate with data sources seamlessly. The protocol consists of three primary components:
MCP Host(chat application)
MCP Client
MCP Server
1. MCP Host
The MCP Host is at the core of the system. It can be an application like a chat assistant, or any AI-powered tool requiring access to external data. The host includes one or more MCP clients.
2. MCP Client
The MCP Client operates within the MCP Host, acting as an intermediary between the host application and the MCP Server.
3. MCP Server
The MCP Server serves as a bridge between the MCP Client and external data sources. It can connect to:
Databases (SQL, NoSQL)
APIs (REST, GraphQL, or any other standard)
Local files and code repositories
“What is the weather like in New York?”
1.MCP Client Requests Tools: The MCP Host (chat application) needs to access relevant data, so it queries the MCP Server for available tools.
2.MCP Server Provides Available Tools: The server returns a list of available services, such as a weather API.
3.MCP Host Consults LLM: The host then sends the user’s query, along with the available tools, to a large language model (LLM).
4.LLM Determines the Best Tool: The LLM processes the request and determines that the best tool for the job is the weather API.
5.MCP Client Calls the MCP Server: The client makes a request to the MCP Server to fetch weather data.
6.MCP Server Executes Query: The server retrieves weather information from an external API and returns the response.
7.Final Answer Returned to User: The MCP Host compiles the response and presents it to the user in the chat application.
https://medium.com/garantibbva-teknoloji/model-context-protocol-mcp-a-new-standard-for-ai-agents-878a1378f41d