MCP Architecture and Component Analysis

MCP Architecture Overview

Host Web/Mobile/Desktop Interface MCP Client Communication & Protocol Handler MCP Server Resources & Tools API/External Data

English Summary

MCP adopts a client-server architecture composed of three core components: MCP Host, MCP Client, and MCP Server.

MCP Host

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.

MCP Client

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.

MCP Server

Provides concrete data or functional service components, exposing two main capabilities according to the MCP protocol:

  • Resources: Read-only data access such as file contents, database records, and other static information
  • Tools: Executable functions like API calls, computational logic, file operations, and prompt templates that help models generate more precise responses in specific scenarios

An MCP Server can connect to one or multiple external data sources, which may be local or network-based data.

Information Flow

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。

MCP Host

作為整個 AI 應用的前端介面,可以是 Web 應用、移動應用或其他類型程序。負責整合用戶介面和業務邏輯,協調多個 MCP Client 的運作,並將外部資料或工具整合進 AI 模型的上下文中,生成更相關的回應。例如 Claude Desktop、各類 LLM 工具或 IDE 等。

MCP Client

位於 Host 內部,使用 MCP 協議與 Server 建立一對一連線。負責管理消息傳遞、初始化握手、能力協商和路由工具調用。當 AI 模型決定使用某工具(如進行計算)時,Client 會將相應請求轉發給後端 Server。

MCP Server

提供具體的數據或功能服務元件,根據 MCP 協議對外暴露兩大類能力:

  • 資源 (Resource): 提供只讀數據,如文件內容、數據庫記錄及其他靜態資料
  • 工具 (Tools): 提供可執行功能,如 API 調用、計算邏輯、文件讀寫,以及提示模板,協助模型在特定場景下生成更精確的回應

一個 MCP Server 可對應一個或多個外部數據源,這些數據源可以是本地數據或網路數據。

信息流程

整體架構展示了使用者、LLM 應用、MCP 伺服器之間的流程,讓我們理解如何將大語言模型與外部工具資料源整合,並最終呈現給使用者。這個標準化的接口層讓各元件只需實作 MCP 協議,就可實現跨平台、跨系統的互通。