explaingit

device-context-protocol/dcp

25PythonAudience · developerComplexity · 4/5ActiveLicenseSetup · hard

TLDR

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

Mindmap

mindmap
  root((dcp))
    Inputs
      YAML manifest
      MCP tool call
      Capability token
    Outputs
      CBOR frame
      Device event
      Dry-run check
    Use Cases
      Drive smart lamp from Claude
      Connect ESP32 to MCP host
      Simulate device locally
      Add new firmware intent
    Tech Stack
      Python
      CBOR
      Arduino
      ESP32
      MQTT

Things people build with this

USE CASE 1

Let Claude Desktop control an ESP32 smart lamp through the DCP-to-MCP Bridge

USE CASE 2

Author a YAML intent manifest for a new sensor and flash a matching ESP32 firmware skeleton

USE CASE 3

Run the pydcp simulator to dry-run agent commands before pointing them at real hardware

USE CASE 4

Add CBOR-based agent control to an existing Arduino project under 14KB extra footprint

Tech stack

PythonArduinoCBORESP32MQTT

Getting it running

Difficulty · hard Time to first run · 1h+

Full loop needs an ESP32 or ESP8266 board flashed with the DCP firmware plus the Python Bridge running with the right transport extra (serial, MQTT, or BLE).

MIT lets you use, modify, and redistribute the code for any purpose as long as you keep the copyright and license text.

In plain English

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.

Copy-paste prompts

Prompt 1
pip install pydcp and walk me through running the simulator against a sample lamp manifest
Prompt 2
Write a DCP manifest for a temperature sensor with units and ranges then generate the firmware stub
Prompt 3
Set up the DCP-to-MCP Bridge so Claude can call set_brightness on a real ESP32
Prompt 4
Add a new motion_detected event to the example lamp manifest and update the CRC-16 intent ID
Prompt 5
Compare DCP's 19-byte brightness frame against the MCP JSON-RPC equivalent on the wire
Open on GitHub → Explain another repo

Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.