Standalone LibreChat deployment for KnowledgeBase-S.
This repo runs LibreChat, MongoDB, Meilisearch, nginx, and a small kb-mcp
bridge that exposes KnowledgeBase-S API calls to LibreChat through MCP. It also
runs search-mcp, a Brave Search MCP bridge for current web/news search.
librechat: chat UI and provider integration.mongodb: LibreChat application state.meilisearch: LibreChat search backend.kb-mcp: MCP bridge to the remote KnowledgeBase-S API.search-mcp: MCP bridge to Brave Search API.nginx: HTTP entrypoint forchat.laughtale.co.uk.watchtower: optional image auto-updater.
Copy .env.example to .env and fill in real values.
Important variables:
KB_API_BASE: public KnowledgeBase-S API origin, for examplehttps://swanny.laughtale.co.uk.KB_SERVICE_TOKEN: service token sent bykb-mcpas bothAuthorization: Bearer ...andX-KB-Service-Token.LIBRECHAT_DOMAIN_CLIENT/LIBRECHAT_DOMAIN_SERVER: public LibreChat URL.CLAUDE_API_KEY/OPENAI_API_KEY: model provider keys.BRAVE_SEARCH_API_KEY: Brave Search API key used bysearch-mcp.ALLOW_REGISTRATION: set totrueonly while creating the first account, then set it back tofalse.
The model picker includes Claude Sonnet 5.5, Claude Opus 5.5, and
Claude Haiku 4.5. New chats default to the Claude Sonnet 5.5 model spec,
configured in config/librechat.yaml.
KB_SERVICE_TOKEN must match the value configured in the KnowledgeBase-S .env.
The web-search MCP exposes Brave LLM Context, Web Search, News Search, and a
basic URL fetcher. Use Brave LLM Context for grounded current-information
answers; use News Search when the user specifically asks for recent news.
make devDetached:
make dev-dTemporarily enable registration:
ALLOW_REGISTRATION=trueApply the change:
make deployCreate your account in the web UI, then disable registration again:
ALLOW_REGISTRATION=falseApply the change again:
make deployOn every push to main, GitHub Actions builds:
ghcr.io/<owner>/kb-chat-kb-mcp:latestghcr.io/<owner>/kb-chat-search-mcp:latest
make deployThis runs:
docker compose pull
docker compose up -d --remove-orphansThis repository uses ghcr.io/librechat-ai/librechat:latest, which pointed to
v0.8.8 on 2026-10-01. The image moved from the danny-avila package namespace.
Once these repository changes are available on the VPS, run the commands below
from its repo directory.
The server's existing .env values, especially LIBRECHAT_CREDS_KEY,
LIBRECHAT_CREDS_IV, and the JWT secrets, must stay the same.
First download the new image while the current site is still running:
git pull --ff-only
docker compose pull librechatStop LibreChat writers and back up the database and mounted files. MongoDB stays running for the backup and migration. Keep this backup outside the repo.
docker compose stop librechat
umask 077
backup_dir="../kb-chat-backups/$(date +%Y%m%d-%H%M%S)"
mkdir -p "$backup_dir"
docker compose exec -T mongodb mongodump --db LibreChat --archive > "$backup_dir/mongo.archive"
tar -czf "$backup_dir/files.tgz" .env config data/librechat/imagesConfirm both backup commands succeeded and the archive files are nonempty before continuing. Stop if any command fails.
LibreChat v0.8.8 needs an explicit MongoDB tenant-index migration for databases created by v0.8.7 or earlier, including single-tenant installs. Check the dry-run output, then apply it while LibreChat remains stopped:
docker compose run --rm --no-deps -w /app librechat npm run migrate:tenant-indexes:dry-run
docker compose run --rm --no-deps -w /app librechat npm run migrate:tenant-indexes
docker compose up -d --no-deps librechat
docker compose ps
docker compose logs --tail=100 librechatCheck that the site loads, sign in, open an old conversation, send a new message, and try the KnowledgeBase and web-search MCP tools. If startup reports an index error, leave LibreChat stopped and follow the tenant-index migration guide before retrying. Do not drop MongoDB indexes or volumes to clear the error.
For later releases, make deploy pulls the current latest image without a
version edit. Check LibreChat's release and configuration notes first: a future
release may require another migration or a config/librechat.yaml update.
The LibreChat service is excluded from Watchtower updates, so latest does
not change the running site until you deploy it.
For rollback, stop LibreChat, restore the saved MongoDB archive and files,
then run the previous ghcr.io/danny-avila/librechat:v0.8.7 image and the
previous config/librechat.yaml. Keep the backup until the upgraded site has
been checked.
Persistent runtime data is stored under:
data/mongodata/meilidata/librechat/imagesdata/librechat/logs
If migrating from the old KnowledgeBase-S VPS, copy the corresponding old directories before switching DNS.