MCP adopts a client-server architecture composed of three core components: MCP Host, MCP Client, and MCP Server.
Functions as the frontend interface of the AI application, which can be implemented as a web application, mobile app, or other program types. It integrates user interfaces with business logic and coordinates multiple MCP Clients. The Host processes external data and tools into the AI model's context to generate relevant responses. Examples include Claude Desktop, LLM tools, or IDE environments.
Located within the Host, it establishes one-to-one connections with MCP Servers using the MCP protocol. The Client manages message delivery, initializes handshakes, negotiates capabilities, and routes tool invocations. When an AI model decides to use a specific tool (like performing calculations), the Client forwards the corresponding request to the backend Server.
Provides concrete data or functional service components, exposing two main capabilities according to the MCP protocol:
An MCP Server can connect to one or multiple external data sources, which may be local or network-based data.
The architecture demonstrates how users interact with LLM applications, showing the flow between user requests, LLM applications (MCP Host), LLM agents (MCP Client), and external resources (MCP Server). This standardized interface layer enables cross-platform and cross-system interoperability simply by implementing the MCP protocol.
MCP 採用客戶端-伺服器架構,由三個核心元件組成:MCP Host、MCP Client 和 MCP Server。
作為整個 AI 應用的前端介面,可以是 Web 應用、移動應用或其他類型程序。負責整合用戶介面和業務邏輯,協調多個 MCP Client 的運作,並將外部資料或工具整合進 AI 模型的上下文中,生成更相關的回應。例如 Claude Desktop、各類 LLM 工具或 IDE 等。
位於 Host 內部,使用 MCP 協議與 Server 建立一對一連線。負責管理消息傳遞、初始化握手、能力協商和路由工具調用。當 AI 模型決定使用某工具(如進行計算)時,Client 會將相應請求轉發給後端 Server。
提供具體的數據或功能服務元件,根據 MCP 協議對外暴露兩大類能力:
一個 MCP Server 可對應一個或多個外部數據源,這些數據源可以是本地數據或網路數據。
整體架構展示了使用者、LLM 應用、MCP 伺服器之間的流程,讓我們理解如何將大語言模型與外部工具資料源整合,並最終呈現給使用者。這個標準化的接口層讓各元件只需實作 MCP 協議,就可實現跨平台、跨系統的互通。