Skip to content
FlyCockpit
Knowledge Base/ Overview & Quick Start
Knowledge Base logo

Knowledge Base Overview & Quick Start

Rust + TypeScriptApache-2.0Target v1.0.0
Repository

Self-hosted Git-backed Markdown knowledge base with hybrid FTS5 + vector search, scoped MCP grants, and the standalone kb Rust CLI.

Platforms: Linux, macOS, Windows (kb CLI) · Docker (server)

Knowledge Base is a self-hosted, multi-user Markdown knowledge-base platform built for both people and AI coding agents. Canonical Markdown documents and asset manifests live in bare Git repositories, application authority and operational metadata live in PostgreSQL 18, and hybrid full-text + vector search runs on rebuildable SQLite index files (FTS5 + sqlite-vec). People manage knowledge bases, shares, reviews, and credentials in a web control plane, while agents connect over a scoped /mcp server or the companion kb Rust CLI.

Architecture

One server and one dedicated worker share a single host data volume (KB_DATA_ROOT, default /var/lib/knowledge-base). The kb CLI implements the exact same 34-tool kb/1 MCP catalog against either a local on-device store or one or more remote servers.

  Browser (Cookie / oRPC)        Agents (OAuth 2.1 / PAT / kb mcp)       Git Clients (PAT)
            |                                   |                                |
            +-------------------+---------------+--------------------------------+
                                |
                    +-----------v------------------------------------+
                    |  apps/server (Hono, Better Auth, oRPC,         |
                    |    /mcp Streamable HTTP, /api/v1 REST,         |
                    |    Git smart-HTTP, read-only SQLite search)    |
                    +-----+------------------+-----------------+-----+
                          |                  |                 |
                +---------v-------+  +-------v-------+  +------v--------------------+
                | PostgreSQL 18   |  | Valkey 9.1    |  | Shared Host Volume        |
                | (Authority,     |  | (BullMQ,      |  | KB_DATA_ROOT              |
                |  Grants, PRs)   |  |  Rate Limits) |  |  repos/  assets/          |
                +-----------------+  +-------+-------+  |  index/  models/          |
                                             |          +------^--------------------+
                                     +-------v-------+         |
                                     | apps/worker   +---------+
                                     | (Index builds, embeddings, mirrors, Git rollup)
                                     +---------------+

Repository layout:

Path Role
apps/web React / TanStack Router human control plane (/$lang localized routes)
apps/server Hono API, Better Auth, /mcp, /api/v1 REST control plane, Git smart-HTTP, asset streaming
apps/worker Dedicated BullMQ worker for SQLite index builds, local/external embeddings, mirrors, and pack compaction
apps/cli Standalone Apache-2.0 Rust CLI (kb), crates/kb-local, and crates/kb-client
packages/api, db, auth, env, queue Shared oRPC routers, Prisma schema, auth, env validation, and BullMQ queues

Prerequisites

Local development stack

  • Node.js 26.13.1+ (Node 26 no longer bundles Corepack; install corepack@0.36.0 globally)
  • Docker or Podman (for local PostgreSQL 18, Valkey 9.1, and Mailpit)
  • portless (npm install -g portless) for https://knowledge-base.localhost
  • Git 2.45+ (required for git merge-tree --merge-base PR merges and conflict checks on both server and local kb stores)
  • Rust 1.96+, CMake, a C++ compiler, libclang, and OpenMP (except macOS) only if building kb from source

Local development quick start

Enable the pinned pnpm release via Corepack, install dependencies, initialize local services, and launch the dev server:

npm install --global corepack@0.36.0 portless
corepack enable pnpm
pnpm install
pnpm setup:app
pnpm dev

pnpm setup:app creates missing .env files from the manifest, starts PostgreSQL, Valkey, and Mailpit via docker-compose.dev.yml, and applies committed Prisma migrations. Once running, open https://knowledge-base.localhost.

Installing the kb CLI

Every Knowledge Base server serves a version-matched installer (also shown under Settings → MCP access in the web app). It verifies the download against sha256.sum before installing into ~/.cargo/bin (%USERPROFILE%\.cargo\bin on Windows) and launches kb login:

# Linux (x86_64 / ARM64 static musl) and macOS (x86_64 / Apple silicon)
curl -fsSL https://kb.example.com/install.sh | sh
# Windows PowerShell (5.1 or 7)
irm https://kb.example.com/install.ps1 | iex

Set KB_INSTALL_NO_LOGIN=1 ($env:KB_INSTALL_NO_LOGIN = '1') to install without immediately logging in. You can also download release archives from GitHub Releases and verify both checksums and keyless build provenance:

grep 'kb-x86_64-unknown-linux-musl\.tar\.xz$' sha256.sum | sha256sum -c -
gh attestation verify kb-x86_64-unknown-linux-musl.tar.xz --repo FlyCockpit/knowledge-base

Building from source

The Rust workspace lives in apps/cli outside the pnpm/Turborepo graph:

cd apps/cli
CARGO_BUILD_JOBS=3 cargo build --locked -p kb
cargo run -- --help

Connect Claude Code or Codex in 2 minutes

Knowledge Base exposes /mcp over Streamable HTTP with OAuth 2.1 (recommended for interactive clients) and Personal Access Tokens (PATs, recommended for headless harnesses).

Claude Code

# OAuth 2.1 (then run /mcp -> Authenticate inside Claude Code)
claude mcp add --transport http kb https://kb.example.com/mcp

# Or PAT from Settings -> MCP access (stored in KB_MCP_TOKEN)
claude mcp add --transport http kb https://kb.example.com/mcp \
  --header "Authorization: Bearer ${KB_MCP_TOKEN}"

Codex

# OAuth 2.1
codex mcp add kb --url https://kb.example.com/mcp
codex mcp login kb

# Or PAT via environment variable
codex mcp add kb --url https://kb.example.com/mcp --bearer-token-env-var KB_MCP_TOKEN

Alternatively, install kb and connect any stdio-only MCP client to a local store (kb mcp --root /path/to/store) or aggregate multiple remote servers behind one tool list (kb mcp --server work --server personal).

Known limitations

  • Single-instance, single-host architecture. Production supports one server and one dedicated worker sharing one local persistent filesystem (KB_DATA_ROOT). Horizontal multi-replica writers and network filesystems (NFS/EFS) are not supported.
  • No organizations or anonymous/public KBs. Knowledge bases are user-owned and shared privately with explicit accounts. Instance administrators have no implicit read or manage access to private KBs.
  • No server-side dreaming. Clients/agents perform dreaming over MCP (knowledge_changes_apply with mode: "dream"); the server deterministically validates provenance and commits atomic change sets.
  • Markdown only, no asset GC. Text documents are Markdown only (no PDF or DOCX text extraction). Content-addressed asset blobs are retained permanently for historical citations; deleting a manifest entry never deletes historical blobs.
  • Git 2.45+ required. Both the server/worker and kb mcp --root refuse to start on older Git releases (such as Debian 12’s Git 2.39).
  • Worker volume security tradeoff. Both server and worker mount KB_DATA_ROOT read-write (non-root UID 1000); a compromised worker could modify canonical repositories or assets on disk. Protection relies on UID isolation, private tmpfs mirror keys, process fences, hash verification, and encrypted offline backups.
  • Static Linux musl DNS resolution. Prebuilt Linux kb binaries link musl statically and resolve hostnames through DNS and /etc/hosts only—they do not load /etc/nsswitch.conf modules such as mDNS (*.local), LDAP, or SSSD.