hiatamaworkshop/dcp-wrap
Convert JSON to DCP positional-array format for AI agents
Platform-specific configuration:
{
"mcpServers": {
"dcp-wrap": {
"command": "npx",
"args": [
"-y",
"dcp-wrap"
]
}
}
}Add the config above to .claude/settings.json under the mcpServers key.
Convert JSON to DCP positional-array format — fewer tokens, same accuracy.
DCP strips repeated keys from structured data. Instead of sending {"endpoint":"/v1/users","method":"GET","status":200} per record, DCP declares the schema once and writes values by position:
["$S","api-response:v1","endpoint","method","status","latency_ms"]
["/v1/users","GET",200,42]
["/v1/orders","POST",201,187]40–60% token reduction when feeding data to LLMs. Zero accuracy cost. See benchmark.
npm install dcp-wrapOr use directly:
npx dcp-wrapcat api-response.json | npx dcp-wrap init api-responseOutput:
Schema: api-response:v1
Fields: 4
endpoint: string (source: endpoint, unique: 4/4)
method: string (source: method, unique: 2/4) [enum(2)]
status: number (source: status, unique: 2/4)
latency_ms: number (source: latency_ms, unique: 4/4)
Saved: dcp-schemas/api-response.v1.json
Saved: dcp-schemas/api-response.v1.mapping.jsonThe generator infers field types, detects enums, numeric ranges, and orders fields by DCP convention (identifiers → classifiers → numerics → text).
cat data.json | npx dcp-wrap encode --schema dcp-schemas/api-response.v1.jsonOutput:
["$S","api-response:v1","endpoint","method","status","latency_ms"]
["/v1/users","GET",200,42]
["/v1/orders","POST",201,187]
["/v1/auth","POST",200,95]npx dcp-wrap inspect dcp-schemas/api-response.v1.jsonFor known structures where you define the schema inline:
import { dcpEncode } from "dcp-wrap";
const dcp = dcpEncode(results, {
id: "engram-recall:v1",
fields: ["id", "relevance", "summary", "tags", "hitCount", "weightLoading reviews...