gitmyhub

dcp

Python ★ 43 updated 1mo ago

Device Context Protocol — bridge LLM agents to physical devices. Sub-50-byte frames, 27.6KB flash / 0.6KB RAM measured on ESP32, capability-scoped and safe by design. Complementary to MCP. Paper: arXiv:2605.26159

Draft protocol that lets LLM agents drive microcontrollers via a compact CBOR wire format, with a Bridge that translates to and from MCP.

PythonArduinoCBORESP32MQTTsetup: hardcomplexity 4/5

DCP, short for Device Context Protocol, is a draft protocol that lets large language model agents send commands to physical devices like microcontrollers. The project is at draft v0.3 as of May 2026 and has been measured on an ESP32-WROOM-32 dev board. The author positions it as a companion to MCP, the Model Context Protocol used by Claude Desktop and other assistant tools. A reference Bridge converts between DCP and MCP, so any MCP-compatible assistant can drive a device with no extra setup.

The problem the README describes: MCP works well for SaaS tools, but it expects JSON-RPC over WebSocket and runtime tool discovery, which is too heavy for a chip with only 32 KB of RAM. DCP keeps the same idea of a manifest plus tool calls, then compiles them into a compact CBOR wire format with a fixed intent table. A typical brightness command is about 19 bytes on the wire, versus around 180 bytes for the MCP equivalent.

Safety lives in the Bridge process, not on the device. The Bridge issues capability tokens, checks parameter ranges, types, and units against the manifest, and supports dry-run as a first-class wire feature. Devices stay simple and trust the Bridge. The author argues this catches several classes of model hallucination or adversarial calls before any byte hits hardware.

A manifest declares intents in YAML, for example a smart lamp with set_brightness, read_brightness, and a motion_detected event. Every parameter declares a unit and a range. The intent ID is a CRC-16 of the name, so manifests and firmware stay aligned without coordination. The firmware footprint is around 14 KB on top of an empty Arduino sketch, and the protocol layer compiles for every current ESP32 variant and ESP8266 without SoC-specific code paths.

Installation for a user is pip install pydcp with optional MCP, serial, MQTT, and BLE transport extras. There is a CLI for inspecting a manifest and serving a simulator, recipes for ready-to-flash device skeletons, and a five-step guide for adding a new feature. The license is MIT.

Where it fits