kb-server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@kb-serversearch my vault for notes about the Goodhart's law article, then summarize them"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
kb-tools
Tooling for a personal LLM wiki in the pattern Andrej Karpathy described: a folder of plain markdown that a coding agent reads, writes and keeps current, browsed in Obsidian. This package puts a graph, a search index, guarded writes and an MCP server over such a vault, and runs an autonomous ingestion loop that files new sources by itself behind a fail-closed merge gate.
There is no RAG here, no embeddings and no vector store, by decision rather than omission. Retrieval is lexical and in memory: term frequency with a title boost and a one-hop walk along wikilinks. The pattern is knowledge compiled into pages an agent can read whole, not chunks retrieved by similarity.
My own vault is private: it holds third-party papers I cannot redistribute and personal notes. It consumes this package pinned to a release tag. examples/vault/ is a small slice of it so you can run everything below.
The vault it expects
raw/is the evidence layer: immutable source material. Nothing in the tooling can write here; the guard is in code, not convention.wiki/is the compiled layer: synthesised pages, each citing the sources it was written from. Agents maintain it; a human reads it.index.mdis the map the agent routes questions through;log.mdis append-only history.
templates/kb-schema.md is the schema an agent follows to maintain a vault like this, and docs/CONTEXT.md is the glossary.
Related MCP server: obsidian-mcp-context
Quick start
python3 -m venv .venv && .venv/bin/pip install -e .
.venv/bin/kb --root examples/vault verify # graph + citation audit
.venv/bin/kb --root examples/vault search "goodhart"
.venv/bin/kb --root examples/vault read wiki/concept-software-engineering-laws
.venv/bin/python -m unittest discover -s tests -t . # runs against a temporary fixture vaultOr install it into another project: pip install git+https://github.com/philippe-ths/kb-tools@v1.0.0.
The root falls back to KNOWLEDGE_BASE_ROOT. Add --json before the subcommand for machine-readable output.
The MCP server
kb-server --root /path/to/vault exposes ten tools over stdio to Claude Code, Codex or Claude Desktop. kb install --host claude (or codex) prints the host config; --write --yes applies it.
Tool | Does |
| lexical search over |
| one page with its outgoing links and backlinks |
| a bundle of pages for a question |
| the catalogue: categories, counts, orphans, broken links |
| graph hygiene report |
| graph plus citation audit |
| unified diff per operation and before/after verification, over an in-memory overlay; writes nothing |
| commit a change set through the guarded writers, then re-verify on disk |
| the recorded search history |
| re-read the vault after an outside change |
A change set is JSON: write_page under a flat wiki/, write_index, or append_log. Those are the only three writes that exist. raw/ cannot be written, log.md can only be appended, and a path that escapes the vault is refused.
Autonomous ingestion
kb --root <vault> auto-ingest, scheduled weekly through launchd (kb install --host launchd):
Find pending sources: any
raw/*.mdno wiki page cites, minus the vault's.kb-ingest-ignore.Branch from the remote base into a
kb-maintenance/worktree, so the human's checkout is never touched.For each source, a writer agent (Claude CLI, headless) synthesises a cited page and commits it together with the source it cites.
An independent reviewer agent reads the diff adversarially and returns a structured JSON verdict.
A deterministic merge gate decides. It merges only when validation passes, verification shows zero warnings and zero new warnings, the diff touches only
wiki/,index.md,log.mdandraw/, the worktree is clean after the commit, and the reviewer raised no blocking objection. Anything else leaves the pull request open for the human.
Both agents run under a hard-coded allowlist of the kb_* tools and nothing else: no Bash, no Write, no Edit. The git, gh and agent calls sit behind injectable seams, so the gate's logic is unit-tested without a model in the loop. If the vault has a validation script at .ai-policy/scripts/run-validation.sh it runs as part of the gate; otherwise validation is recorded as skipped.
Layout
Module | Responsibility |
| root resolution, file discovery, reads, and the guarded writers |
| wikilink parsing and target resolution |
|
|
| in-memory graph: links, backlinks, broken links, orphans |
| lexical search index |
| change-set model and write-rule guards |
| graph and citation audit, before/after deltas |
| maintenance runs, worktree planning, PR reports |
| pending-source detection, the ingestion orchestrator and merge gate, the Claude CLI runner |
| MCP host config and launchd snippets |
|
|
| the CLI and the MCP server, both thin adapters over |
The core is standard-library Python 3.10+; only the MCP server needs the mcp SDK.
Decisions
0001: a local MCP knowledge base with propose/apply writes.
0002: autonomous ingestion with a guarded auto-merge.
0003: this package split out of the private vault.
License
MIT. The example vault's content is included for demonstration.
This server cannot be deployed
Maintenance
Related MCP Connectors
Serve a folder of Markdown notes as an MCP server: hybrid search, reading, and sourced answers.
Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.
Read-only MCP server exposing a user ORANO library to their own AI agent.
Guarded MCP server for agent-readable business truth, provenance, readiness, and discovery.
Related MCP Servers
- AlicenseCqualityCmaintenanceRead-only MCP server for querying a running Obsidian vault from agentic runtimes, exposing safe Obsidian CLI commands.551MIT
- FlicenseBqualityAmaintenanceParses an Obsidian vault and exposes structured context (notes, blocks, tasks, headings) through MCP tools, enabling AI clients to query and reason over local markdown notes.19-
- AlicenseNot gradedqualityBmaintenanceExposes a personal markdown-based second brain (Obsidian-style) as an MCP server, enabling agents to search, read, and write notes with privacy controls.MIT
- AlicenseNot gradedqualityCmaintenanceExposes a local Obsidian vault as a stateless MCP server, letting AI coding agents search, read, browse, and edit notes in real time.6 npmMIT