Getting Started
This guide gets db-cluster running in under 5 minutes. It walks the core truth loop: ingest → index → retrieve → mutate → prove.
Prerequisites
Section titled “Prerequisites”- Node.js 20+ (enforced via
engines.nodeinpackage.json). - npm (or
pnpm/yarn).
Optional for the Postgres canonical backend:
- PostgreSQL 16+.
DB_CLUSTER_POSTGRES_URLenvironment variable (e.g.postgres://user:pass@host:5432/db).- For TLS, put
sslmode=requirein the connection string itself — thepgdriver honours it. db-cluster does not configure SSL/TLS in v1.0.0 and there is noDB_CLUSTER_POSTGRES_SSLvariable; the connection is plaintext unless the URL (or a TLS proxy / private network) enforces it.
Install
Section titled “Install”npm install @mcptoolshop/db-clusterOr run via Docker (no Node install required):
docker run --rm -v "$PWD:/workspace" ghcr.io/mcp-tool-shop-org/db-cluster:latest initOr clone and build from source:
git clone https://github.com/mcp-tool-shop-org/db-cluster.gitcd db-clusternpm installnpm run buildInitialize a cluster
Section titled “Initialize a cluster”npx db-cluster initThis creates .db-cluster/ with four physical stores:
.db-cluster/├── canonical/ # entities, stable IDs, owner truth├── artifact/ # raw files, immutable source documents├── index/ # derivative discoverability (rebuildable)├── ledger/ # provenance events and mutation receipts└── commands/ # staged commands awaiting validationIngest an artifact
Section titled “Ingest an artifact”npx db-cluster ingest ./evidence.mdThe artifact store takes ownership of the bytes (content-addressable, hashed). The index store gets a derivative record. The canonical store is not touched — artifacts are not entities.
Create an entity
Section titled “Create an entity”npx db-cluster entity create \ --kind claim \ --name "LLMs should not write directly to databases" \ --attr '{"confidence":"high","domain":"architecture"}'The canonical store takes ownership. An index record is created. The ledger records a provenance event.
Link the artifact as evidence
Section titled “Link the artifact as evidence”npx db-cluster link --entity-id <entity-id> --artifact-id <artifact-id>A provenance link goes into the ledger: the artifact is evidence for the entity. Neither store’s truth is mutated — only the ledger records the relationship.
Retrieve an evidence bundle
Section titled “Retrieve an evidence bundle”npx db-cluster retrieve "LLMs database architecture"The cluster retrieves across all stores:
- Index discovers candidate records.
- Canonical store resolves entities to owner truth.
- Artifact store resolves source documents.
- Freshness and confidence are computed.
This is not RAG. It is structured retrieval with provenance boundaries.
Trace provenance
Section titled “Trace provenance”npx db-cluster trace cluster://canonical/<entity-id>Shows the full provenance graph — who created this entity, what evidence supports it, what mutations changed it. Every node traces to a specific store.
Propose a mutation
Section titled “Propose a mutation”npx db-cluster propose '{ "verb": "update_entity", "targetStore": "canonical", "payload": { "entityId": "<entity-id>", "patch": { "name": "Updated claim" } }, "proposedBy": "developer"}'This does not write to any store. It creates a staged command in proposed status.
Validate and commit
Section titled “Validate and commit”npx db-cluster validate <command-id>npx db-cluster approve <command-id> --note "reviewed by operator"npx db-cluster commit <command-id>The full lifecycle: propose → validate → approve → commit. Each step is auditable. Compensating a committed command creates a new compensating command — original receipts are preserved.
Verify the cluster is healthy
Section titled “Verify the cluster is healthy”npx db-cluster doctornpx db-cluster verifydoctor checks reachability and structural health. verify proves data consistency invariants (index→source, provenance→subject, receipt→event). Both are read-only — neither mutates state.
Next steps
Section titled “Next steps”- Architecture — why the four-store split is load-bearing.
- MCP Integration — make db-cluster available to AI agents.
- Operations — backup, restore, rebuild, runbooks.
- SDK Reference — programmatic usage from your Node code.