API and MCP

Use Breadledger from your coding agent or your own scripts: search the bug ledger, get a fix, check a file, read your rules and show your work on your board.

Start

Everything is JSON over HTTPS at https://breadledger.com. Calls that read or change your own things need your agent key (it starts with blk_). You get one when you connect your coding agent: the one line you paste saves it on your computer, in ~/.breadledger/config.json. Switch a key off any time in Your account.

Send the key in either header. Both work on every call below.

Header

Authorization: Bearer blk_…

Or

x-ledger-key: blk_…

In the examples, $KEY is your key. To set it from the saved file:

KEY=$(node -e "console.log(require(process.env.HOME+'/.breadledger/config.json').token)")

What comes back is only ever yours: your boards, your rules. The ledger tools return the lesson (what went wrong, why, the fix), never which app or file it came from. Text you send to be checked is read and dropped, never kept.

MCP server

Breadledger is a remote MCP server, so Claude Code, Cursor, Codex and other agents can use its tools by themselves. It speaks streamable HTTP with JSON-RPC 2.0 at one address, and answers every request on the same POST (no stream to keep open). The connect line adds it to Claude Code, Cursor and Codex for you.

POST/mcpagent key

Claude Code

claude mcp add --transport http breadledger https://breadledger.com/mcp --header "Authorization: Bearer $KEY"

Cursor · ~/.cursor/mcp.json

{
  "mcpServers": {
    "breadledger": {
      "url": "https://breadledger.com/mcp",
      "headers": { "Authorization": "Bearer blk_…" }
    }
  }
}

Codex · ~/.codex/config.toml

[mcp_servers.breadledger]
url = "https://breadledger.com/mcp"
http_headers = { "Authorization" = "Bearer blk_…" }

In the Claude app (claude.ai, desktop and phone): Settings → Connectors → Add custom connector, paste https://breadledger.com/mcp, press Add, then Connect. You sign in with your email code and press Allow; no key to copy.

Signing in (OAuth). Clients without an agent key sign in with OAuth 2.1. A call to /mcp without a token gets 401 with WWW-Authenticate: Bearer resource_metadata="https://breadledger.com/.well-known/oauth-protected-resource". From there:

AddressWhat it is
/.well-known/oauth-protected-resourceWhich server signs people in for /mcp (RFC 9728)
/.well-known/oauth-authorization-serverThe endpoints below (RFC 8414)
/oauth/registerDynamic client registration for public clients (RFC 7591)
/oauth/authorizeThe person signs in and presses Allow. PKCE with S256 is required; scope mcp
/oauth/tokenauthorization_code and refresh_token. Access tokens last an hour; refresh tokens change on every use and the sign-in ends only after 90 days without use
/oauth/revokeSwitch a token off (RFC 7009)

The tools. All read-only except post_step, which only ever changes your own boards.

ToolWhat it doesArguments
search_ledgerSearch the ledger of real bugs and their fixes.query, optional category, limit (1–20)
get_fixOne lesson in full: what went wrong, the cause, the fix.id from a search
check_textCheck one file's text against the known patterns.filename, text (up to 200 KB)
list_boardsYour latest boards and what each is doing.optional limit (1–50)
post_stepStart a board, or add or tick a step on one of yours.step, optional board_id, status (active or done), title, project, note, now, finish
read_rulesYour "ask me before…" rules, so the agent follows them.none

Try it by hand. The first call is the handshake; the second lists the tools; the third calls one.

curl -s https://breadledger.com/mcp -H "Authorization: Bearer $KEY" -H "content-type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"1"}}}'
curl -s https://breadledger.com/mcp -H "Authorization: Bearer $KEY" -H "content-type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'
curl -s https://breadledger.com/mcp -H "Authorization: Bearer $KEY" -H "content-type: application/json" \
  -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"search_ledger","arguments":{"query":"session after sign out"}}}'

A tool's answer is in result.content[0].text, as JSON. A tool that could not do what was asked says why in that text and sets result.isError to true. Supported protocol versions: 2025-11-25, 2025-06-18, 2025-03-26 and 2024-11-05. Notifications get 202 with no body; GET /mcp answers 405, since there is no stream to open.

Bug ledger

The same lessons the MCP tools return, as plain HTTP.

GET/api/ledger/searchagent key

q words to look for · category optional: security, logic, ui, data-loss, auth, performance, race, sync, crash, other · limit 1–20, default 10.

curl -s "https://breadledger.com/api/ledger/search?q=session+sign+out&limit=5" -H "Authorization: Bearer $KEY"

Answer

{ "ok": true, "query": "session sign out", "total": 14,
  "results": [ { "id": "bl_3f9a1c2b7d10", "title": "…", "category": "security", "severity": "high", "symptom": "…" } ],
  "next": "Call get_fix with an id for the full fix." }

GET/api/ledger/bugs/<id>agent key

One lesson in full. Ids never change.

curl -s https://breadledger.com/api/ledger/bugs/bl_3f9a1c2b7d10 -H "Authorization: Bearer $KEY"

Answer

{ "ok": true, "id": "bl_3f9a1c2b7d10", "title": "…", "category": "security", "severity": "high",
  "symptom": "what went wrong", "cause": "why", "fix": "the fix that worked" }

Check a file

POST/api/checkagent key

Checks one file's text against the known patterns: SQL built from request input, HTML sent back with request input in it, tokens made with Math.random, secrets compared with ===, Access-Control-Allow-Origin: *, keys written into code, and hidden characters. The file name's ending decides which checks apply. Up to 200 KB; the text is not kept. For a whole project, the scanner the connect line installs does far more.

curl -s https://breadledger.com/api/check -H "Authorization: Bearer $KEY" -H "content-type: application/json" \
  -d '{"filename":"src/app.js","text":"headers.set(\"Access-Control-Allow-Origin\", \"*\")"}'

Answer

{ "ok": true, "file": "src/app.js", "lines": 1, "checks": 7, "count": 1,
  "findings": [ { "id": "SEC-CORS-STAR", "severity": "medium", "line": 1, "problem": "…", "fix": "…", "excerpt": "…" } ] }

Treat every finding as a lead: open the file and confirm it before changing anything. A key found in the file is never sent back.

Boards

A board is one piece of work an agent is doing, with its steps. Yours are private: only you see them, at /now.

GET/api/sessionsagent key

Your latest boards. limit 1–50, default 12 · active=1 only the ones working now.

curl -s "https://breadledger.com/api/sessions?limit=5" -H "Authorization: Bearer $KEY"

Answer

{ "ok": true, "now": 1763600000000, "count": 1,
  "sessions": [ { "id": "…", "title": "Add a sign-up form", "status": "active", "current": "…", "done": 1, "total": 3, "tasks": [ … ], "live": true } ],
  "counts": { "agents": 1, "boards": 0, "waiting": 0, … } }

GET/api/session?id=<id>agent key

One of your boards.

curl -s "https://breadledger.com/api/session?id=my-board-1" -H "Authorization: Bearer $KEY"

POST/api/sessionagent key

Start a board or update yours. Send the whole step list each time; the server stamps when each step started and finished. A finished board ("status": "done") can't change again. Up to 80 steps.

curl -s https://breadledger.com/api/session -H "Authorization: Bearer $KEY" -H "content-type: application/json" \
  -d '{"id":"my-board-1","app":"My app","title":"Add a sign-up form","current":"Reading signup.html",
       "tasks":[{"text":"Read the code","status":"done"},{"text":"Write the form","status":"active"},{"text":"Test it","status":"pending"}]}'

Answer

{ "ok": true, "id": "my-board-1", "url": "https://breadledger.com/now/my-board-1", "board": "https://breadledger.com/now", "done": 1, "total": 3 }

POST/api/session/eventagent key

Add to a board's story: what was found, fixed, measured. kind is one of phase, say, found, fixed, clean, metric, verdict, caveat, note, feature, shot, act. Up to 50 events a call.

curl -s https://breadledger.com/api/session/event -H "Authorization: Bearer $KEY" -H "content-type: application/json" \
  -d '{"sessionId":"my-board-1","events":[{"kind":"fixed","title":"Form now checks the email","severity":"low"}]}'

Answer

{ "ok": true, "ids": [ "…" ], "count": 1, "story": "https://breadledger.com/story/my-board-1" }

Your rules

GET/api/auth/rulesagent key

The five "ask me before…" switches from Your account: deleting, pushing, spending, reading secret files, touching production. An agent key can read them but never change them.

curl -s https://breadledger.com/api/auth/rules -H "Authorization: Bearer $KEY"

Answer

{ "ok": true, "rules": { "del": true, "push": false, "spend": true, "secrets": true, "prod": false } }

Posting a bug to the ledger

POST/api/bugscontributor key

Adds a bug, security finding or optimiser to the shared ledger. The ledger is add-only: nothing in it can be changed or removed. Because every addition reaches every member's agent, this needs a contributor key, which we give to contributors; an agent key is refused with 401. To share a bug you found, use Send feedback from the menu.

Fields: app and title are required; kind bug, security or optimiser; category; severity; symptom; fix; file; project.

curl -s https://breadledger.com/api/bugs -H "x-ledger-key: $CONTRIBUTOR_KEY" -H "content-type: application/json" \
  -d '{"app":"My app","kind":"bug","title":"Totals off by one on the last page","category":"logic","severity":"medium","symptom":"…","fix":"…"}'

Answer

{ "ok": true, "id": "…", "app": "My app", "title": "Totals off by one on the last page", "shots": [] }

Open endpoints

No key needed.

GET/api/stats

How many bugs the ledger holds, each counted once.

curl -s https://breadledger.com/api/stats

Answer

{ "ok": true, "bugs": 1117 }

GET/api/health

Whether the site and its storage are answering. 503 when they are not. The status page shows the history.

curl -s https://breadledger.com/api/health

Answer

{ "ok": true, "db": "ok", "at": 1763600000000 }

Rate limits

WhatLimit
The MCP server, /api/ledger/… and /api/check60 calls a minute and 5,000 a day, per agent key
New boards300 a day per account
Events on one board5,000
Steps on one board80
One file to check200 KB
Search results20 a call

Over a limit, you get 429 with a Retry-After header saying how many seconds to wait, and retryAfter in the body.

Errors

Every error is JSON with "ok": false and a plain sentence in error you can show to a person.

{ "ok": false, "error": "Send your agent key: Authorization: Bearer blk_… (make one at https://breadledger.com/connect)." }
StatusMeans
400Something in the request is missing or not right; error says what.
401No key, a wrong key, or a key that was switched off.
403Not yours: another person's board, or a page on another site calling the MCP server.
404No such thing, or no such address.
409That board is finished; start a new one.
413The file is too big to check in one go.
429Too many calls; wait the seconds in Retry-After.
500, 503A problem on our side. Try again in a minute; the status page says if something is down.

The MCP server answers in JSON-RPC: -32700 the body isn't JSON, -32600 not a JSON-RPC request, -32601 no such method, -32602 no such tool.