MCP Explained
348 points
• 7 days ago
• Article
Link
模型上下文协议(Model Context Protocol,简称 MCP)是一项开放标准,旨在将 AI 应用连接到它们所需的各类工具和数据源。其核心架构包含一个宿主(host),例如 AI 智能体或开发环境,以及一个 MCP 服务器(MCP server)。服务器是一个小程序,用于暴露特定的能力(capabilities)、数据(data)或提示(prompts)。模型本身处于关键位置,它负责决定何时调用这些外部工具,但重要的是:模型从不直接与服务器通信。
这种交互机制以 JSON-RPC 作为底层消息格式,不过 MCP 进一步通过定义具体方法、能力协商以及传输机制来提供更完整的结构。与标准的 REST API 不同,MCP 支持双向通信,使服务器可以反向与宿主进行交互。该协议还会管理这些连接的完整生命周期,包括初始化、持续运行以及关闭;同时集成了诸如用于远程服务器访问的 OAuth 2.1 等安全特性。
从功能上看,该协议为服务器端和客户端划分了不同的功能集。服务器端提供模型可调用的工具(tools)、应用可读取的资源(resources),以及用户可选择的模板(prompts)。与此同时,客户端或宿主端提供诸如采样(sampling)之类的能力:它允许服务器借用模型;还包括用于请求用户输入的引导(elicitation),以及定义服务器允许运行的根目录(root directories)。诸如进度跟踪(progress tracking)和日志记录(logging)之类的工具,确保这些自动化任务保持透明且易于管理。
工作流程按固定步骤展开:AI 应用首先向服务器查询,以发现其可用的工具。随后,这些信息会被传递给模型,使其理解自己可以触发哪些函数。当用户提出请求时,模型会判断需要调用哪一个工具,生成所需的参数(arguments),并指示应用通过服务器执行该工具。服务器完成处理后,将结果返回给模型,模型再整合信息,生成并输出给用户的最终答复。
尽管该协议提供了连接所需的基础框架,但诸如智能工具检索或更复杂的代码生成模式等高级能力仍不在规范范围内,而是由具体实现来完成。此外,MCP 的开发也非常重视安全性,充分认识到工具投毒(tool poisoning)、注入(injection)或钓鱼(phishing)等潜在风险。协议的持续更新不断扩展其能力,未来的迭代将致力于引入更强的扩展,用于提升智能体能力(agent skills)、改进交互式用户界面,以及优化任务管理。
The Model Context Protocol, or MCP, serves as an open standard designed to connect AI applications to the diverse tools and data sources they require. At its core, the architecture involves a host, such as an AI agent or a development environment, and an MCP server, which acts as a small program that exposes specific capabilities, data, or prompts. The model itself occupies a central role by deciding when to utilize these external tools, but importantly, it never communicates with the server directly.
The mechanics of this interaction rely on JSON-RPC as the underlying message format, though MCP adds significantly more structure by defining the specific methods, capability negotiations, and transport mechanisms. Unlike a standard REST API, MCP facilitates bidirectional communication, allowing servers to interact back with the host. The protocol manages the entire lifecycle of these connections, including initialization, ongoing operation, and shutdown, while also incorporating security features like OAuth 2.1 for remote server access.
Functionally, the protocol is divided into distinct feature sets for both servers and clients. Servers provide tools that the model can call, resources that the application can read, and templates known as prompts that users can select. Meanwhile, the client or host features include capabilities like sampling, which allows a server to borrow a model, elicitation for requesting user input, and the definition of root directories where a server is permitted to operate. Utilities such as progress tracking and logging ensure that these automated tasks remain transparent and manageable.
The workflow follows a structured sequence where the AI application first queries the server to discover its available tools. This information is passed to the model, allowing it to understand what functions it can trigger. When a user provides a request, the model determines the necessary tool, generates the required arguments, and instructs the application to execute that tool via the server. Once the server processes the task, the result is fed back to the model, which then synthesizes a final response for the user.
While the protocol provides the fundamental framework for these connections, certain advanced features like intelligent tool searching or sophisticated code generation modes remain outside the spec, functioning instead as implementation details. Furthermore, the development of MCP includes a focus on security, acknowledging potential risks like tool poisoning, injection, or phishing. Ongoing updates continue to expand the protocol, with future iterations aiming to introduce even more robust extensions for agent skills, interactive user interfaces, and improved task management.
136 comments • Comments Link
- 许多人认为,模型上下文协议(MCP)是一种面向 agents 的标准化 JSON-RPC 接口;但也有批评者觉得,它为简单的请求 / 响应模式平添了不必要的复杂性。
- 交互式、支持多窗格的文档格式因追求"好莱坞式 UX"而遭到批评:它往往不是为了高效、线性地提炼信息,而是让读者更容易感到无所适从。
- 关于 MCP 的实际价值,观点分歧很大:有人把它看作模仿旧行业潮流的"没什么用(nothing burger)",也有人认为它在企业环境中对安全、受限资源的访问至关重要。
- 技术说明文档的"信息密度"偏高且设计不佳,通常被认为是过度依赖 LLM 生成内容、缺少人工监督,以及缺乏基本的教学原则所致。
- 对于非技术用户和受监管的环境,MCP 充当了一座更安全、可授权的桥梁——这往往比让 agents 安装任意 CLI 工具或授予其 shell 访问权限更容易被管理员接受。
- 一个关键技术批评是:MCP 缺少 Unix 风格管道和 CLI 固有的可组合性,因此一些高级用户会把 MCPs 再包装进脚本里,以重新获得链式操作的能力。
- 高级用户还注意到, "harnesses" 往往会隐藏重要的工具元数据,迫使 agents 去猜测参数;在这种情况下,结合良好错误日志记录的简单 execute-script 方法反而更稳健。
- AI 开发的"苦涩教训"表明:随着模型能力提升,更复杂的架构层往往会变得多余,因为 agents 越来越能直接使用原始 APIs 或标准的 CLI 。
- 文档与协议设计常常受制于创建者的"知识诅咒":开发者没有站在目标受众的思维模型和具体疑问上来设计。
- 对许多人来说,最有效的采用方式是让 LLMs 负责搭建样板配置,把协议当作实现细节,而不是一项需要手动完成的集成工作。
这段讨论凸显了一个张力:一方面,人们希望为 AI agents 提供标准化、可安全使用的接口;另一方面,开发者更偏好 CLI 等简单、可组合的工具。批评者认为 MCP 不过是多余的"稀释物(slop)"或带有管理色彩的流行做法;支持者则认为,它提供了标准 APIs 以及那些带 shell 访问权限的 agents 所缺少的必要安全层。归根结底,这场讨论说明:尽管该协议在集成不同企业服务方面确实有现实效用,但它目前的呈现方式往往不足以打动那些重视简洁与清晰,以及认可现有标准工具强大功能的开发者。 • The Model Context Protocol (MCP) is viewed by many as a standardized JSON-RPC interface for agents, though critics argue it adds unnecessary complexity to simple request/response patterns.
• Interactive, multi-pane documentation formats are criticized for favoring aesthetic "Hollywood UX" over the efficient, linear distillation of information, often overwhelming the reader.
• There is a significant divide regarding MCP's utility; some developers see it as a "nothing burger" that mimics past industry fads, while others find it essential for secure, restricted resource access in enterprise environments.
• The perceived density and poor design of technical explainers are often attributed to a reliance on LLM generation without human oversight or basic pedagogical principles.
• For non-technical users and regulated environments, MCP acts as a secure, authorized bridge that is often more palatable to administrators than installing arbitrary CLI tools or granting shell access to agents.
• A core technical critique is that MCP lacks the composability inherent in Unix-style pipes and CLIs, leading some power users to wrap MCPs in scripts to regain the ability to chain operations.
• Advanced users observe that "harnesses" often hide important tool metadata, forcing agents to guess parameters, which makes a simple execute-script approach—combined with good error logging—a more robust strategy.
• The "bitter lesson" of AI development suggests that as models improve, complex infrastructure layers often become redundant, as agents become increasingly capable of using raw APIs or standard CLIs directly.
• Documentation and protocol design are frequently hampered by the creator's "curse of knowledge," where developers fail to account for the specific mental models and questions of the intended audience.
• The most effective adoption strategy for many involves letting LLMs handle the boilerplate setup, treating the protocol as an implementation detail rather than a manual integration task.
The conversation highlights a tension between the desire for standardized, secure interfaces for AI agents and the developer preference for simple, composable tools like CLIs. While critics dismiss MCP as redundant "slop" or a management-driven fad, proponents argue that it provides a necessary security layer that standard APIs and shell-access agents lack. Ultimately, the discussion suggests that while the protocol offers real-world utility for integrating disparate enterprise services, its current presentation often fails to resonate with developers who value brevity, clarity, and the power of existing standard tools.