Device Context Protocol: A Compact, Safety-First Architecture for LLM-Driven Control of Constrained Devices
Dongxu Yang · 2026
Read Device Context Protocol: A Compact, Safety-First Architecture for LLM-Driven Control of Constrained Devices by Dongxu Yang (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2605-26159.txt.
Introduction
Yang presents the Device Context Protocol, a safety-first scheme for tiny-device control by language models. The Model Context Protocol assumes services with megabytes of memory, never reaching microcontrollers. Even IoT-MCP, at 74 kilobytes peak memory, excludes the smallest chips and ignores safety. DCP frames run under fifty bytes: six-byte header, CBOR payload, optional sixteen-byte authentication code. Its manifest makes capability scoping, range checks and type checks primitives. Dry-run evaluation and units-as-types join them. A host bridge rejects malformed or hallucinated commands.
Catalog record
| CREATOR | Dongxu Yang |
|---|---|
| YEAR | 2026 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 43054 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2605.26159
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Device Context Protocol: A Compact, Safety-First Architecture for LLM-Driven Control of Constrained Devices Dongxu Yang Abstract Large language models are increasingly used as orchestrators of external tools via the Model Context Protocol (MCP) [ 1 ] , 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) [ 22 ] 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 [ 6 ] 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 [ 14 ] ) and the physical devices it does not reach. 1 Introduction The deployment of large language models (LLMs) as orchestrators of external tools has driven the rapid adoption of standardized invocation protocols. The Model Context Protocol (MCP) [ 1 ] has emerged as a leading candidate, providing a JSON-RPC–based interface for exposing tools, resources, and prompts to LLM clients such as Claude Desktop, IDE assistants, and agent frameworks. The MCP roadmap for 2026 [ 14 ] foregrounds enterprise readiness : stateless HTTP transport, OAuth 2.1, audit logging, and gateway architectures. It says nothing about embedded devices, and there is no indication that the upstream specification will descend to that layer. This produces a gap. Physical devices—smart-home actuators, sensors, laboratory equipment, prototyping hardware—are typically built on microcontrollers whose flash and SRAM budgets are an order of magnitude smaller than those a JSON-RPC-over-WebSocket implementation requires. A common workaround is to bridge the device to an MCP host with an ad-hoc serial protocol; every project that does so reinvents framing, manifest exchange, error reporting, and safety. A recent academic contribution, IoT-MCP [ 22 ] , demonstrates that MCP can be ported to edge devices at a 74 KB peak memory cost and \sim 205 ms response time across 22 sensor types and 6 microcontroller units. We regard this as foundational empirical work that establishes the feasibility of LLM-IoT bridging. It also surfaces three open issues: (i) the 74 KB footprint excludes the smallest commodity MCUs (Cortex-M0+, ATmega-class, and most BLE-only chips); (ii) the underlying protocol is unchanged MCP, so its overhead and discovery model carry through unmodified; (iii) the paper does not address authentication, capability scoping, or safety against hallucinated or adversarial LLM calls—the central reliability problem introduced by allowing an unreliable caller to control hardware. Concurrent threat-modeling work formalizes the third concern. A recent STRIDE-based analysis of LLM-enabled robotic systems [ 15 ] identifies six boundary-crossing interaction points at which semantic validation is absent in today’s stacks, with no protocol-layer defenses available to close the gap. Adjacent work proposes runtime guardrails [ 9 , 20 ] and post-hoc behavioral intrusion detection [ 24 ] , but none addresses the boundary at the wire-format and schema level. DCP is, to our knowledge, the first proposal to do so. We claim that closing these issues requires changes at the protocol layer, not the implementation layer. DCP (Device Context Protocol) is our proposal: a compact wire format, a manifest schema, a safety model, and a reference implementation across host (Python) and device (C++ for ESP32), designed from the start for LLM callers. Empirical headlines. Two findings up front, both measured (§ 3.4 , § 4 ): (i) across 675 tool calls produced by five LLMs across four vendors (DeepSeek V3; Alibaba Qwen 2.5-72B and Qwen 3.5-35B-A3B; Zhipu GLM-4-32B; MiniMax M2.5) in response to six categories of adversarial prompts — with the prompt-injection category instantiated from AgentDojo’s [ 6 ] attack templates — DCP rejects 100 % of capability escalation attempts and 78 % of prompt injection attempts (the latter category instantiated from the seven attack templates in AgentDojo [ 6 ] , adapted to the device-control setting) before any byte leaves the host — versus 0–1 % for Raw MCP and IoT-MCP, and tied with a well-formed OpenAPI 3 spec at \sim 1/1000 the runtime footprint OpenAPI requires. (ii) An apples-to-apples wire latency A/B on identical ESP32-S3 hardware shows DCP’s full schema validation (capability + range + dry-run + CBOR/COBS/CRC) and an IoT-MCP-style newline-JSON wire both complete a round-trip in \sim 15.6 ms median, within 5 \mu s of each other. DCP’s safety primitives carry no measurable latency cost. Contributions. This paper makes the following contributions: 1. A wire format and manifest schema (§ 3 ) explicitly designed for the LLM-as-caller setting: intent-level commands rather than register-level; units as a protocol primitive; dry-run as a wire-format bit; and a 6-byte fixed header that makes static dispatch on resource-constrained MCUs natural. 2. An architectural pattern (§ 3.4 ) in which a host-side Bridge is the sole trust boundary. Capability tokens (HMAC-SHA256, scoped, time-limited) bound the LLM’s reach; range, type, and dry-run checks reject hallucinated calls before they traverse the wire. Devices remain simple. 3. Reference implementations (§ 4 ): a Python Bridge with five transports (loopback, UART with COBS+CRC, MQTT, BLE GATT, and an MCP server wrapper that surfaces DCP devices to any MCP host); and an Arduino-compatible ESP32 firmware targeting <\!16 KB flash, with self-contained SHA-256 for optional per-frame integrity. 4. A language-neutral conformance suite (§ 4 ): a YAML encoding of golden frames that other implementations (e.g. in C, Rust, Go) can mechanically verify against. We argue this methodology is necessary for the protocol to survive multi-author implementation. 5. An empirical study (§ 3.4 ) in which 675 tool calls produced by five real LLMs across four vendors (DeepSeek, Alibaba Qwen, Zhipu GLM, MiniMax; all via SiliconFlow) in response to adversarial prompts across six attack categories — with the prompt-injection category instantiated from AgentDojo’s [ 6 ] seven attack templates adapted to the device-control setting — are run through each protocol’s host-side validator. DCP rejects 100 % of capability escalation attempts and 78 % of prompt injection attempts, vs 0–1 % for MCP/IoT-MCP. The study also produced an end-to-end latency A/B against an IoT-MCP-shaped firmware on the same ESP32-S3 hardware: 15.60 ms vs 15.59 ms median, within 5 \mu s. DCP’s safety primitives are free at this scale. 6. A discussion (§ 5 ) positioning DCP