by JimJafar
Provides a markdown‑native, git‑backed knowledge graph that serves as a durable memory and handoff layer for AI agents via a seven‑verb MCP interface.
The Librarian offers a portable, markdown‑native knowledge graph where memories, handoffs, and reference documents are stored as plain files in a git‑backed vault. An autonomous curator continuously organizes new entries, links them through [[wikilinks]], and prepares the corpus for fast retrieval by AI agents through a standardized seven‑verb MCP surface.
npx @the-librarian/cli server up
Add --data-dir /path/to/vault to control where the markdown vault lives.npx @the-librarian/cli install
The CLI prompts for the MCP URL and the agent token displayed at startup.recall, remember, flag_memory, store_handoff, list_handoffs, claim_handoff, search_references) over /mcp using the bearer token.npx command starts the server and installs harness integrations.primer.md) that teaches agents the recall/remember protocol.librarian server admin backup or simply copy the bound data directory.
Project site → — what The Librarian is, how it works, and why you'd want it.
The Librarian is a living, markdown-native knowledge graph for AI agents — with
a resident curator that tends it. It is a markdown+git vault of three note
types — memories, handoffs, and references — linked into a graph by
[[wikilinks]]; a resident "librarian" curates the collection as it grows,
filing each new memory where it belongs, linking it to its neighbours, and
organising the whole for retrieval, not just storage. It's all plain files you
can read, edit, and reorganise yourself (in the dashboard or in Obsidian); git
gives it history; nothing is locked in a database.
Practically, that makes it a portable memory + handoff layer for AI agents: served to any harness over MCP as 7 verbs, taught to agents by one ≤2KB primer, with an explicit cross-harness handoff surface so work started in one harness (Claude Code, Codex, Hermes, OpenCode, Pi) can be packaged into a single document and picked up cleanly in another.
It runs as a small self-hosted server, reachable locally or over the network.
The librarian CLI's server command group stands up the server for you — it
builds and runs the all-in-one container, surfaces the master key once, and hands
you the MCP URL + agent token to paste into clients. Run it with npx — no
install needed:
npx @the-librarian/cli server up
(Or npm i -g @the-librarian/cli once and call librarian server up directly,
if you'll run it often.)
Want the data at a path you choose — to back it up, put it on a specific disk, or
move it between hosts? Add --data-dir; it bind-mounts a host directory at /data
and runs the container as its owner, so the vault stays yours to read and write:
npx @the-librarian/cli server up --data-dir /srv/librarian
server up/update/down/status/logs, Linux boot persistence
(enable-boot), and host-side admin (server admin backup|restore|auth|rebuild)
are all covered in the
self-host guide in
the docs site.
Use native Docker, not the snap.
librarian serveris unsupported on snap-packaged Docker (common on Ubuntu / LXC) — its confinement breaks the build and hides container health. Install Docker CE. See the self-host guide.
Once your server is running, the librarian CLI wires The Librarian into your
harnesses and keeps them up to date — the package-manager-style tool you keep.
It covers all five harnesses (Claude Code, Codex, OpenCode, Hermes, Pi), drives
each one's native install path, and wires automatic capture where supported. Any
harness already has Node, so one command does it:
npx @the-librarian/cli install # wire your harnesses; prompts for the MCP URL + token
npx @the-librarian/cli update # later: bring every installed integration up to date
(Or install it globally once — npm i -g @the-librarian/cli — then run
librarian install / librarian update whenever you add or refresh a harness.)
See packages/installer-cli for the
full command reference and what it writes to your environment.
librarian install above wires all five for you; this section is the manual
reference for each. Run the server, then add one config block per harness. Claude
Code, Codex, and OpenCode need no plugin code at all — the MCP config (plus,
for OpenCode, one instructions line pointing at the server's GET /primer.md)
is a full integration. Hermes and Pi get thin in-tree adapters. Each harness's
exact config and install steps live in its README:
| Harness | Integration | Shape |
|---|---|---|
| Claude Code | integrations/claude |
MCP config; optional plugin adds 4 slash commands |
| Codex | integrations/codex |
MCP config block in ~/.codex/config.toml — no code |
| OpenCode | integrations/opencode |
MCP config + one remote-URL instructions line — no code |
| Hermes | integrations/hermes |
Python MemoryProvider (stdlib-only) proxying the 7 verbs |
| Pi | integrations/pi |
Pi extension: primer hook + 7 native tool proxies |
All five teach the model the same protocols: the primer rides each harness's
thinnest native channel (MCP instructions where honored, a one-hook adapter
where not), and the 7 tools carry protocol-bearing descriptions that render in
every harness.
recall / remember / flag_memory over one shared,
curated corpus with project-key scoping and a three-state
(active / proposed / archived) model.store_handoff packages the work in a
five-section document; claim_handoff claims it atomically in another
agent / harness.search_references — deliberately
not auto-recalled.create/update/merge) auto-apply above a single confidence
threshold; destructive ones (archive/split) always become human-reviewed
proposals.Markdown-native and dependency-light: memories are plain [[wikilinked]] notes
in a git-backed vault, recall runs over a disposable in-memory index (keyword +
vector + backlinks, RRF-fused) rebuilt from the vault — no external database to
run.
The fastest path is the one-command self-host above, then librarian install to
wire your harnesses. The full getting-started walkthrough — stand up a server,
connect your first agent, and verify it — is in the docs site:
Install and
First run.
Prefer to drive Docker yourself (single container, Compose, or Fly)? See Manual deployment. For working on The Librarian itself (local two-service dev, tests, lint), see CONTRIBUTING.md.
A fresh install needs zero auth/secret env vars. Auth and secrets are managed
from the dashboard at /settings/auth (password and/or GitHub/Google),
enforced without a redeploy. The agent token is the network auth boundary;
there is no admin token (the admin tRPC API is served only on a trusted internal
listener, never the published port — ADR 0008).
The full picture — the auth model, dashboard owner-login and lockout recovery, and the master-key externalization ladder — lives in Authentication & secrets in the docs site.
Agents talk to the Librarian over /mcp with a bearer token. The surface is
exactly seven tools — contract-tested, with zero internal tools:
recall — hybrid search over memories (active only by default; pass
include_ids: true for [mem_…]-prefixed lines so callers can flag).remember — fire-and-forget: each submission lands in the curator's intake
inbox; the curator dedupes, merges, and files it asynchronously.flag_memory — flag a memory as wrong / misleading / outdated with a
free-text reason; routes it to review (and soft-demotes it in recall) rather
than archiving unilaterally.Memories are active, proposed, or archived. Admin/curatorial ops
(archive, approve, update, list proposals) are not agent MCP tools — they
live on the dashboard tRPC surface (ADR 0006).
store_handoff — store a handoff document (five required headings: Start &
intent, Journey, Current state, What's left, Open questions).list_handoffs — list handoffs in the current project / cwd.claim_handoff — atomically claim a handoff by id. Claiming is one-shot —
once claimed, the handoff is closed to other callers.search_references — search the long-form reference corpus. A separate verb
by design: references are background material, never auto-recalled.Agents are taught by the primer — one ≤2KB operator-editable document at
vault/primer.md, served at connect time as the MCP initialize instructions
field and at the unauthenticated GET /primer.md endpoint — plus each tool's own
protocol-bearing description. It carries the recall/remember loop, the
handoff/takeover and learn protocols, private mode, and the fail-soft rule. Edit
it from the dashboard's Vault page (the server enforces the 2KB cap). Design:
docs/adr/0007-the-rethink.md.
The four optional slash commands (/handoff, /takeover, /learn, and the
local-only /toggle-private) are thin sugar over those protocols — plain language
works identically. Contract: docs/slash-commands.md.
Walkthroughs for operators are in the docs site:
Handoff & takeover and
Private mode.
The Next.js admin cockpit (published on port 3042 by default — override with
server up --dashboard-port) is the complete operator surface —
Memories, Proposals, Flagged, Archive, Analytics,
Handoffs, the Curator cockpit, the Obsidian-lite Vault explorer,
Activity, Health, and Settings (auth, backups, connect, curator,
ingest, primer, tokens, dashboard). The dashboard reaches the admin tRPC API over
a trusted internal listener with no bearer (ADR 0008) — the published agent
port serves no admin surface, so there is no admin credential to reach the
browser.
A guided, screenshot-backed tour of every area is in the docs site: Using the dashboard.
Two CLIs ship with The Librarian: @the-librarian/cli (the librarian installer
and server group — wire harnesses, self-host the server) and the bundled admin
binary the-librarian (rebuild, seed, backup, export, auth, handoffs,
migrate-data-dir). The admin verbs run from the host shell — directly, or via
librarian server admin <verb> inside the container even when the dashboard is
locked. See
Self-host → admin from the host.
One curator engine does two jobs, configured and observed from the dashboard
Curator cockpit (/curator): Intake consolidates each new submission as
it lands (create / update / merge against the corpus), and Grooming tends the
existing corpus (dedupe, archive stale, refine) — triggered, not scheduled. Under
one apply rule (ADR 0007), create / update / merge auto-apply once the
curator's confidence clears a single threshold (default 0.8), while archive
and split — the only operations that destroy or restructure information —
always become proposals for human review. The curator's LLM API token is one
of the server's own credentials that LIBRARIAN_SECRET_KEY encrypts; the master
key protects those creds, not the vault (your memories stay plaintext markdown by
design; ADR 0008).
You teach the curator through use — editing each job's advisory, git-versioned addendum and judging the real proposals it produces. The full operator guide, including the self-improving loop and the curator chat, is in the docs site: Configuring the curator.
See CONTRIBUTING.md for the workspace layout, "where to add what" recipes (new MCP tool / tRPC procedure / dashboard page / CLI verb), and local test/lint commands.
Architecture decisions live in docs/adr/; the active spec and
backlog live in docs/.
Apache-2.0.
Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by modelcontextprotocol
A basic implementation of persistent memory using a local knowledge graph. This lets Claude remember information about the user across chats.
by topoteretes
Provides dynamic memory for AI agents through modular ECL (Extract, Cognify, Load) pipelines, enabling seamless integration with graph and vector stores using minimal code.
by basicmachines-co
Enables persistent, local‑first knowledge management by allowing LLMs to read and write Markdown files during natural conversations, building a traversable knowledge graph that stays under the user’s control.
by agentset-ai
Provides an open‑source platform to build, evaluate, and ship production‑ready retrieval‑augmented generation (RAG) and agentic applications, offering end‑to‑end tooling from ingestion to hosting.
by smithery-ai
Provides read and search capabilities for Markdown notes in an Obsidian vault for Claude Desktop and other MCP clients.
by chatmcp
Summarize chat messages by querying a local chat database and returning concise overviews.
by dmayboroda
Provides on‑premises conversational retrieval‑augmented generation (RAG) with configurable Docker containers, supporting fully local execution, ChatGPT‑based custom GPTs, and Anthropic Claude integration.
by qdrant
Provides a Model Context Protocol server that stores and retrieves semantic memories using Qdrant vector search, acting as a semantic memory layer.
by doobidoo
Provides a universal memory service with semantic search, intelligent memory triggers, OAuth‑enabled team collaboration, and multi‑client support for Claude Desktop, Claude Code, VS Code, Cursor and over a dozen AI applications.
{
"mcpServers": {
"librarian": {
"command": "npx",
"args": [
"@the-librarian/cli",
"server",
"up"
],
"env": {}
}
}
}claude mcp add librarian npx @the-librarian/cli server up