Deploy with Docker Compose
The repository ships a reference stack in deploy/docker/compose.yml: sklad, Caddy for TLS certificates from Let’s Encrypt, and Logto with Postgres as the OAuth 2.1 identity provider that Claude.ai needs. A single-user deployment fits on a small VPS.
Prerequisites
Section titled “Prerequisites”- An x86_64 Linux host with Docker Compose. The compose file runs the image tagged
sklad:nix; you load it yourself, from the published image or a Nix build. - Two DNS names pointing at the host, here
kb.example.comfor sklad andauth.example.comfor Logto. Create them before the first start: Caddy requests certificates as soon as it starts. - A git remote for the knowledge base that the server may push to.
1. Lay out the checkout and volumes
Section titled “1. Lay out the checkout and volumes”Clone sklad, then the knowledge base inside the sklad checkout. The compose file mounts know-mount/ (the knowledge base) and state-mount/ (token database, deploy key) from the root of the sklad checkout. The image runs as UID 65532, which must own both:
git clone https://github.com/Zebradil/sklad.git /srv/skladcd /srv/skladgit clone git@github.com:<you>/<kb>.git know-mountmkdir -p state-mountsudo chown -R 65532:65532 know-mount state-mount2. Give the server a deploy key
Section titled “2. Give the server a deploy key”sklad commits every write and pushes it (git.auto_push, on by default). The compose file points git at /data/state/git-key and checks the remote’s host key strictly against /data/state/known_hosts:
ssh-keygen -t ed25519 -f state-mount/git-key -N ""ssh-keyscan -t ed25519,rsa -H github.com >> state-mount/known_hostssudo chown 65532:65532 state-mount/git-key* state-mount/known_hostscat state-mount/git-key.pubAdd the public key to the knowledge base repository as a deploy key with write access. Check the scanned fingerprints against your git host’s published ones before trusting them.
3. Set the environment
Section titled “3. Set the environment”Create deploy/docker/.env:
KB_DOMAIN=kb.example.comAUTH_DOMAIN=auth.example.comADMIN_EMAIL=admin@example.comLOGTO_DB_PASSWORD=<a long random password>Compose derives sklad’s settings from these: the OAuth issuer https://auth.example.com/oidc and audience https://kb.example.com/mcp. Optional variables AUTO_PUSH, GIT_REMOTE, and GIT_BRANCH override the push defaults (true, origin, main). For a first trial, point Caddy at Let’s Encrypt’s staging directory so failed attempts do not use up the production rate limit: add ACME_CA=https://acme-staging-v02.api.letsencrypt.org/directory to the caddy service’s environment. Setting it in .env alone does nothing, because Compose does not pass it to that container.
Other sklad settings go into the environment list of the sklad service as SKLAD_* variables. Nested keys use a double underscore, such as SKLAD_GIT__AUTO_PUSH; a single underscore is silently ignored. The configuration reference lists them all.
4. Load the image
Section titled “4. Load the image”Each release is published as ghcr.io/zebradil/sklad:<version> for linux/amd64. Pull a release, such as 0.3.0 (see the releases), and tag it as sklad:nix, the name the compose file uses. The remaining commands run from deploy/docker/:
docker pull ghcr.io/zebradil/sklad:<version>docker tag ghcr.io/zebradil/sklad:<version> sklad:nixcd deploy/dockerTo build the image from the checkout instead, run nix build .#image && ./result | docker load from its root.
Load the image before the next step: docker compose run uses whatever sklad:nix is loaded, and an older image writes older .gitignore patterns that the new server rejects.
5. Initialize the knowledge base
Section titled “5. Initialize the knowledge base”The server refuses to start on a directory that is not a ready knowledge base: a git repository whose .gitignore covers sklad’s sidecar files, with a valid .kb/framework.toml. sklad init creates whatever is missing and leaves content alone; it is safe to run again:
docker compose run --rm --entrypoint sklad sklad init --path /data/knowThe definition itself is yours to write; see the framework definition.
6. Start the stack
Section titled “6. Start the stack”docker compose up -d sklad logto-db logto caddydocker compose logs -f caddyWatch Caddy obtain both certificates. Then check sklad from the outside:
curl -s https://kb.example.com/.well-known/oauth-protected-resource/mcpCaddy passes only /mcp and the OAuth metadata to sklad. /healthz, /readyz, and the metrics listener stay inside the compose network, and so does the web view: to publish it, add routes to deploy/caddy/Caddyfile behind your own access control, see Browse the web view and share pages.
7. Create a bearer token and set up Logto
Section titled “7. Create a bearer token and set up Logto”Mint a token for clients configured by hand, such as Claude Code:
docker compose run --rm --entrypoint sklad sklad token create \ --name laptop --scopes kb:read,kb:writeFor Claude.ai, configure Logto: create an API resource with the identifier https://kb.example.com/mcp and the scopes kb:read, kb:write, and kb:admin, and enable Dynamic Client Registration. Then add the connector, see Connect MCP clients.
Upgrade
Section titled “Upgrade”Load the new image, run sklad init again, and recreate the service. From the root of the sklad checkout:
git pulldocker pull ghcr.io/zebradil/sklad:<version>docker tag ghcr.io/zebradil/sklad:<version> sklad:nixcd deploy/dockerdocker compose run --rm --entrypoint sklad sklad init --path /data/knowdocker compose up -d skladRunning containers do not update themselves; the image’s system packages only get security fixes with a new image.
From kb-mcp
Section titled “From kb-mcp”Releases before 0.2.0 ran as kb-mcp with KBMCP_* variables, kb-mcp.toml, kbmcp_* metrics, and .kbmcp.lock.* write locks. The old and new servers lock different files, so never run both against one checkout:
- Stop and remove the old container first:
docker stop kb-mcp && docker rm kb-mcp. Compose does not remove it once the service is renamed. - Rename
KBMCP_toSKLAD_in your environment files, andkb-mcp.tomltosklad.toml. - Load the image, initialize, and start as above, then
docker compose restart caddyto pick up thesklad:8080upstream. - Rename
kbmcp_tosklad_in alert rules and dashboards.