arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2606.04769cs.CRcs.AIcs.SE
收藏

现实世界 MCP 服务器中的描述-代码不一致性:测量、检测与安全影响

Description-Code Inconsistency in Real-world MCP Servers: Measurement, Detection, and Security Implications

University of Science and Technology of China(中国科学技术大学)

Yutao Shi, Xiaohan Zhang, Xiangjing Zhang, Xihua Shen, Hui Ouyang, Huming Qiu, Mi Zhang, Min Yang

AI总结:

针对 MCP 服务器中工具描述与代码实现不一致的问题,提出结合结构感知静态分析与 Direct-Reverse-Arbitration 提示方法的自动检测框架 DCIChecker,并在大规模数据集上揭示 9.93% 的不一致率及其安全风险。

摘要:

模型上下文协议 (MCP) 已成为赋能大型语言模型 (LLM) 使用外部工具的关键标准。在此生态系统中,LLM 依赖 MCP 服务器提供的自然语言描述来选择和执行函数。这种交互隐含假设工具描述忠实地反映了其底层实现,而该假设在实践中并未得到强制验证。因此,MCP 部署可能遭受名为描述-代码不一致性 (DCI) 的问题,即工具对其能力和安全边界的描述与代码实际行为不一致。 本文对现实世界 MCP 服务器中的 DCI 进行了全面研究。我们正式定义了该问题,并提出了一个涵盖功能不一致和未声明副作用的综合分类法。在此分类法指导下,我们开发了 DCIChecker,一个自动框架,结合结构感知静态分析与 Direct-Reverse-Arbitration 提示方法,交叉验证工具描述与实际代码实现。我们将该框架应用于一个大规模数据集,包含从 2,214 个现实世界 MCP 服务器中提取的 19,200 个描述-代码对。我们的测量揭示 DCI 普遍存在,其中 9.93% 的对存在不一致。我们进一步证明 DCI 造成了关键的防御盲点,助长了从操作故障到隐蔽恶意行为等多种风险。最后,我们提出了缓解策略以强制语义一致性并增强新兴智能体生态系统的可靠性。

英文摘要:

The Model Context Protocol (MCP) has emerged as a critical standard empowering Large Language Models (LLMs) to utilize external tools. In this ecosystem, LLMs rely on natural language descriptions provided by MCP servers to select and execute functions. This interaction implicitly assumes that tool descriptions faithfully reflect their underlying implementations, while this assumption is not mandatorily verified in practice. As a result, MCP deployments may suffer from a problem named Description-Code Inconsistency (DCI), where a tool's description of its capabilities and security boundaries is not consistent with what the code actually does. In this paper, we present a comprehensive study of DCI in real-world MCP servers. We formally define the problem and propose a comprehensive taxonomy spanning functionality inconsistencies and undeclared side effects. Guided by this taxonomy, we develop DCIChecker, an automated framework that combines structure-aware static analysis with the Direct-Reverse-Arbitration prompting method to cross-validate tool descriptions against actual code implementations. We apply this framework to a large-scale dataset comprising 19,200 description-code pairs extracted from 2,214 real-world MCP servers. Our measurement reveals that DCI is widespread, with 9.93% of these pairs exhibiting inconsistencies. We further demonstrate that DCI creates a critical defense blind spot, facilitating varied risks from operational failures to stealthy malicious behaviors. Finally, we propose mitigation strategies to enforce semantic consistency and enhance the reliability of the emerging agentic ecosystem.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑