设备上下文协议:面向大语言模型驱动受限设备控制的紧凑、安全优先架构 Device Context Protocol: A Compact, Safety-First Architecture for LLM-Driven Control of Constrained Devices 预印本

⚠️ 本文为 预印本(arXiv 公开版本),尚未经过正式同行评审。作者自发公开,结论未经期刊审稿验证,阅读时请知悉。
发布时间:2026-05-24
👁️ 预览文献
💡 AI 中文简介
大语言模型常通过MCP协议调用外部工具,但MCP面向内存以兆字节计的软件服务,无法下沉到海量微控制器。本文提出设备上下文协议DCP,典型帧小于50字节,将能力范围、类型检查、试运行、单位即类型等安全机制内建到协议层,并在主机侧设置Bridge,在字节到达设备前拦截幻觉或恶意调用。参考固件在ESP32上仅占27.6KB闪存、0.6KB内存。对五款大模型675次工具调用的测试显示,DCP能100%拦截权限提升、78%拦截提示注入,而原始MCP和IoT-MCP仅0-1%。
领域嵌入式系统与物联网安全、大语言模型智能体工具调用
适合谁读需要一定专业背景(了解LLM智能体、嵌入式系统与协议安全)
核心贡献1. 提出DCP协议,将能力范围、类型检查、试运行、单位即类型等安全机制作为协议层原语,实现主机侧Bridge在字节到达设备前拦截恶意调用;2. 在ESP32上实现仅27.6KB闪存/0.6KB内存的参考固件,并公开MIT许可的Python Bridge、固件与一致性测试套件。
关键数据典型帧<50字节;ESP32固件27.6KB闪存/0.6KB内存;675次工具调用测试中,DCP拦截100%权限提升、78%提示注入,而Raw MCP和IoT-MCP仅0-1%;固件占用比OpenAPI 3方案低三个数量级。
推荐理由如果你关心大模型如何安全地控制真实硬件,这篇论文给出了一个极轻量又安全优先的协议方案,实测拦截效果远超现有方法,值得一读。
关键词["设备上下文协议", "大语言模型", "微控制器", "提示注入", "安全协议", "边缘计算"]

原文摘要

查看英文原文摘要

Large language models are increasingly used as orchestrators of external tools via the Model Context Protocol (MCP), but MCP is built for software services with megabytes of memory and does not descend to the microcontrollers that dominate the long tail of physical devices. Recent work (IoT-MCP) ports MCP to edge gateways at 74 KB peak memory; this still excludes the smallest commodity MCUs and, critically, does not address the safety problem of giving an unreliable caller (an LLM that may hallucinate or be prompt-injected) direct control of physical hardware. We present the Device Context Protocol (DCP): a sub-50-byte typical frame (6-byte header + CBOR payload + optional 16-byte HMAC), a manifest schema in which capability scoping, range and type checks, dry-run evaluation, and units-as-types are protocol-layer primitives, and a host-side Bridge that rejects malformed or hallucinated calls before any byte reaches the device. Reference firmware measures 27.6 KB flash / 0.6 KB RAM on ESP32; the Python Bridge, ESP32 firmware, and a language-neutral conformance suite are MIT-licensed and public. An empirical study -- 675 tool calls produced by five LLMs across four vendors (DeepSeek, Alibaba, Zhipu, MiniMax) against six categories of adversarial prompts, with the injection category instantiating AgentDojo's attack templates -- shows DCP rejects 100% of capability-escalation attempts and 78% of prompt-injection attempts, versus 0--1% for Raw MCP and IoT-MCP, matching the expressiveness of a well-formed OpenAPI 3 schema at three orders of magnitude less firmware footprint. We position DCP as the missing layer between MCP (which is moving toward enterprise SaaS connectivity) and the physical devices it does not reach.