§ /docs — mcp · rest · admin

The interaction surface,
every endpoint.

Three MCP tools. A REST mirror for every one. A small set of admin endpoints for queues, snapshots, and traces. All open, none behind auth in the OSS release.

transport · MCP · streamable HTTPrest · FastAPI · OpenAPI 3.1auth · none · single-user
§ 01 — MCP TOOLS

Three tools,
explicit schemas.

Every MCP client invokes these by name. All take JSON arguments matching the schema below.

borg_thinkcompile

Classify the query, retrieve across strategies, rank on 4 dimensions, compile a token-budgeted context package.

// arguments
{
  query: string,
  namespace: string,
  model?: "claude" | "gpt" | "copilot",
  task_hint?: "debug" | "architecture" | "compliance" | "writing" | "chat",
  budget_tokens?: number
}

borg_learnrecord

Store an episode. Extraction runs async so this returns in milliseconds and never blocks the agent loop.

// arguments
{
  content: string,
  source: "claude-code" | "codex" | "copilot" | "kiro" | "slack" | string,
  namespace: string,
  occurred_at?: ISO-8601,
  participants?: string[]
}

borg_recallbrowse

Direct memory search without compilation. Raw episodes, facts, and procedures — for UI, audits, or the developer at the console.

// arguments
{
  query: string,
  namespace: string,
  memory_type?: "episodic" | "semantic" | "procedural" | "all",
  limit?: number
}
§ 02 — REST MIRROR

Same tools,
plain HTTP.

Not every upstream speaks MCP. The REST mirror gives you the same surface for webhooks, CI, ad-hoc scripts, or legacy apps.

MethodPathMaps to
POST/api/thinkborg_think
POST/api/learnborg_learn
POST/api/recallborg_recall
GET/healthLiveness · returns engine + worker status
GET/docsSwagger UI · full OpenAPI spec
§ 03 — ADMIN

Inspect the pipeline,
drive the worker.

The admin surface lets you observe the extraction queue, trigger snapshots, and audit exactly what went into the last compile.

Observability

// queue depth, running, errors, throughput
GET /api/admin/queue

// list recent entities / facts / procedures
GET /api/admin/entities
GET /api/admin/facts
GET /api/admin/procedures

Control

// force-process or requeue
POST /admin/process-episode
POST /admin/requeue-failed

// snapshot + cost
POST /admin/snapshot
GET /admin/cost-summary
§ 04 — ERRORS

Predictable failures,
diagnostic bodies.

Everything returns JSON. Every 4xx and 5xx includes a detail field and, where applicable, a hint with the exact next step.

StatusConditionHint body
400Missing / malformed argsInvalid field enumerated with a JSON pointer.
404Unknown namespaceLists known namespaces within reason.
429Rate-limited (default 60/min on learn)Retry after Retry-After seconds.
503Worker queue backed up > 1 minReads still served from last-good state.