RAG knowledge base server with ChromaDB and MCP interface
Project description
Candlekeep
The great library fortress on the Sword Coast, where all knowledge is preserved.
A RAG knowledge base server that gives AI agents the power to search, retrieve, and manage technical documentation through the Model Context Protocol. Ask a question, and the library answers — with the right scroll, expanded to full context, in milliseconds.
The Arcane Arts
- Bardic Knowledge — Documents are enriched with title and description at ingestion, woven into every embedding
- Bardic Inspiration — Result-time metadata boosting that ensures specific technical guides outrank generic content
- Arcane Recall — Intelligent expansion using Scholar's Discernment and Arcane Coalescence to return full sections without token waste
- Wild Magic — Hybrid retrieval merging Vector and BM25 (lexical) search, fixing "keyword blindness" for exact identifiers
- Divine Insight — Cross-encoder reranking for when precision matters more than speed
- The Relevance Ward — Results below a configured threshold are filtered, so the library says "I don't know" instead of guessing
Features
- Adaptive Search Routing: Three paths —
simple(Vector),hybrid(BM25+Vector), andprecise(Reranked) - Statistical Rigor: Validated against The Centurion Set (100+ multi-category queries)
- Quality Gate: Documents must have frontmatter and structure to enter the library
- Embedding Protection: Auto-detects model mismatch on remote databases
- 8 MCP Tools: Search, ingest, critique, generate docs, and more
- LLM & Vision Providers: Pluggable
anthropic,openai,bedrock, andopenai_compat(Ollama/LM Studio/vLLM) — text and vision independently configurable - Token Auth: Bearer token authentication for remote ChromaDB
Quick Start
# Enter the library
pip install -e .
./scripts/setup.sh # Download the tomes (embedding models)
./scripts/configure.sh # Set your wards (configuration)
./scripts/start_chroma.sh # Awaken the vault (ChromaDB)
candlekeep # Open the gates
MCP Client Integration
HTTP mode (recommended) — one server, multiple agents. Models loaded once, shared memory, no cold-start per agent (~230ms first query vs ~6s in stdio mode):
# Start the server once
CANDLEKEEP_TRANSPORT=http CANDLEKEEP_HTTP_PORT=8111 candlekeep
{
"mcpServers": {
"candlekeep": {
"url": "http://localhost:8111/mcp"
}
}
}
stdio mode — each agent spawns its own server process. Simpler setup, but each agent pays ~6s cold-start and loads its own copy of the models:
{
"mcpServers": {
"candlekeep": {
"command": "/path/to/.venv/bin/candlekeep",
"args": [],
"env": {
"CANDLEKEEP_SPICE": "true"
}
}
}
}
See Setup Guide for auth configuration and production deployment.
The Tomes (Documentation)
- Setup Guide — Local and remote installation
- Authentication — Token configuration
- Architecture — System design and technical reference
- Design Decisions & Benchmarks — Why things are the way they are, with measured results
- Interactive Benchmark Chart — Visual comparison of paths
- Glossary of Retrieval — IR metrics explained in wizard sage style
- Research Diary — The full journey, every experiment, archived plans
- The Keeper's Chronicle — The story of how the library was built
MCP Tools
- search — Semantic search with adaptive routing (
simple22–36ms,precise~1550ms) - list_documents — List all indexed tomes
- get_stats — Library statistics
- critique_document — Check document quality before ingestion
- generate_documentation — Scan a project and create structured docs
- ingest — Add documents with automatic quality validation
- delete_document — Remove a tome from the index
- repopulate_database — Clear and rebuild the library
Access to write tools is managed by your database permissions (configured via CHROMA_AUTH_TOKEN).
Testing
# Unit tests — no database required (~1.4s)
pytest tests/test_router.py tests/test_quality_gate.py tests/test_arcane_recall_unit.py \
tests/test_protection.py tests/test_processor.py tests/test_search.py \
tests/test_providers.py
# Benchmarks — requires local ChromaDB on localhost:8000
./scripts/start_chroma.sh
pytest tests/test_router_benchmark.py -v -s
59 unit tests covering router, quality gate, chunk expansion, embedding protection, document processing, and LLM/vision providers. Benchmark tests include regression assertions that fail if precision or content match drops below 80%.
Requirements
- Python 3.10+
- ChromaDB server (local or remote)
Candlekeep is a trademark of Wizards of the Coast. This project is unofficial fan content and is not endorsed by or affiliated with Wizards of the Coast.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file candlekeep-0.1.0.tar.gz.
File metadata
- Download URL: candlekeep-0.1.0.tar.gz
- Upload date:
- Size: 16.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
edf614a41365741b6a32b3474ff596ccd4fee49a3d6d8755786d304e67e15971
|
|
| MD5 |
f490af6793c9eb3afb40e7641163b9b3
|
|
| BLAKE2b-256 |
07be06270c3c824be4abf20789acf119186046ff46038f1f4434b5d046b46abf
|
Provenance
The following attestation bundles were made for candlekeep-0.1.0.tar.gz:
Publisher:
release.yml on BansheeEmperor/candlekeep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
candlekeep-0.1.0.tar.gz -
Subject digest:
edf614a41365741b6a32b3474ff596ccd4fee49a3d6d8755786d304e67e15971 - Sigstore transparency entry: 1086085351
- Sigstore integration time:
-
Permalink:
BansheeEmperor/candlekeep@9856a9f2968a3012279ef368aa59827fe86635b1 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/BansheeEmperor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9856a9f2968a3012279ef368aa59827fe86635b1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file candlekeep-0.1.0-py3-none-any.whl.
File metadata
- Download URL: candlekeep-0.1.0-py3-none-any.whl
- Upload date:
- Size: 64.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ec281d7441332a29195ab65eec5122454eeddea7d6e1172f12e14c002f5c7ab
|
|
| MD5 |
01a8c087ab0bc770ca4fb735164610ac
|
|
| BLAKE2b-256 |
cc3681a6af4bba168491f8550e777ad2cab688e11a0f62b8140872e3c2fa667b
|
Provenance
The following attestation bundles were made for candlekeep-0.1.0-py3-none-any.whl:
Publisher:
release.yml on BansheeEmperor/candlekeep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
candlekeep-0.1.0-py3-none-any.whl -
Subject digest:
2ec281d7441332a29195ab65eec5122454eeddea7d6e1172f12e14c002f5c7ab - Sigstore transparency entry: 1086085433
- Sigstore integration time:
-
Permalink:
BansheeEmperor/candlekeep@9856a9f2968a3012279ef368aa59827fe86635b1 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/BansheeEmperor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9856a9f2968a3012279ef368aa59827fe86635b1 -
Trigger Event:
push
-
Statement type: