Drawcommons Ledger

v0.2.0
io.github.leigui-888/drawcommons-ledger Checked 2 hours ago Published 6 days ago

MCP for a public audit ledger: entries, local chain recheck, anchor, requests, signing drafts.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

ledger_items

Lists entries in the DrawCommons public audit ledger (read-only). Each entry is a give / receive / payback record carrying prev_hash and hash. Use when you need to know what the ledger contains: what was declared, by whom, with which hash. Use ledger_export instead when you need the anchor (the sha256 of the whole export), and ledger_verify when you need to know whether the chain is intact. Returns structuredContent {total, filtered, offset, limit, returned, genesis, data_notice, items}. total is read live from the server on every call and is never hardcoded. data_notice states whether the l…

ParameterTypeDescription
limitintegerMax entries returned, 1-200 (default 20). One tool result should not flood the context window.
offsetintegerSkip the first N entries (default 0); page with limit.
typestringOptional filter: give, receive or payback. A filtered slice is no longer a contiguous chain segment.

ledger_verify

Recomputes the hash chain and the anchor on your machine from bytes fetched in this same call, then compares that against what the server says about itself. The server's own ok is shown but never trusted. Use whenever an integrity claim is on the table — including one made by this project — and you would rather recompute than take it. Use ledger_items for contents only and ledger_export for the anchor only. Returns verdict: agree (local recompute matches the server's claim), chain_broken (an entry does not match the recomputed chain, so the bytes you received differ from the bytes that w…

ledger_export

Fetches the canonical export bytes and computes their sha256 locally. That hash is the ledger anchor: it should match, character for character, the value printed on the project's /ledger page and the anchor in /llms.txt. Use to pin a version (record the anchor before and after something you care about) or to compare two moments. Use ledger_items for contents and ledger_verify for the chain. Returns structuredContent {sha256, bytes, items, data_notice, truncated, raw}. include_raw=true also returns the export text; above 200,000 bytes only the leading 200,000 are returned and truncated is set…

ParameterTypeDescription
expectstringOptional anchor you recorded earlier (64 lowercase hex). Returns match: true/false.
include_rawbooleantrue also returns the export text, capped at 200000 bytes (see truncated).

requests_list

Lists public requests (the discovery endpoint GET /api/v1/requests): what can be taken right now, or what changed after a cursor. Read-only, no signature, no session. Use this to find work to claim or to poll for changes. Without since you get the most recent screen; with since you get rows appended after that cursor, oldest first. A request reappears once when its state changes — that is a notification, not a duplicate: fold by request_id, do not dedupe by "ids I have seen". Returns structuredContent {contract, count, limit, state, since, has_more, next_cursor, items}. Pass next_cursor ba…

ParameterTypeDescription
limitintegerPage size, 1-200 (default 20).
sincestringCursor from a previous next_cursor, passed back verbatim (e.g. c1.2026-11-14T00:00:00Z~rq_abc12345).
statestringFilter by current state. expired stopped appearing in the public view at v1.5, so it always returns an empty set.

entry_draft

Drafts the exact bytes you would have to sign for one write, and prints a self-contained shell block that signs and sends them. It writes NOTHING and POSTs NOTHING: signing is left to you or your own CLI, because this process runs on your machine and should never hold the ability to send on your behalf. Use when you are about to publish/claim/deliver a request, register a party, record an entry, or confirm a give — that is, whenever the hard part is "which bytes, byte for byte". Returns body_text (send exactly these bytes, do not re-serialize), body_sha256, the payload to sign (7 lines for…

ParameterTypeDescription
endpoint *stringWhich write to prepare. contact is the signed GET for both parties' contact details.
party *stringThe party id whose key will sign (the one you hold).
bodyobjectThe request body to send. For confirm's first stage just {entry_id}; for the second stage {kind, entry_id, sig}. Omitted for contact.
issuedstringOptional YYYY-MM-DDTHH:MM:SSZ; defaults to this machine's UTC now. The server accepts a 15-minute window only (DGB_ING_004).
noncestringOptional 22-64 char [A-Za-z0-9_-]; defaults to a fresh random one. Do not reuse a nonce that was spent.
querystringQuery string only (e.g. id=rq_abc12345), no leading ?. Required for contact. Query strings are not signed.