Candlekeep
A RAG knowledge base server that enables AI agents to search, retrieve, and manage technical documentation through the Model Context Protocol.
README
![]()
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
- The Rosetta Seal — Corpus-derived BM25 token normalisation map that bridges surface-form variants (
crossencoder↔cross-encoder), rebuilt automatically in the background after each ingest - 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
- True Sight — Images in PDFs and markdown are captioned at ingestion via VLM, making diagram details searchable
Features
- Adaptive Search Routing: Three paths —
hybrid(BM25+Vector),precise(Reranked), andexplore(Divination — entity expansion) - True Sight: Opt-in vision captioning for PDFs and markdown images — deployment topologies, benchmark charts, and architecture diagrams become searchable
- 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
- 14 MCP Tools: Search, ingest, critique, generate docs, agent memory, and more
- LLM & True Sight Providers: Pluggable
anthropic,openai,bedrock, andopenai_compat(Ollama/LM Studio/vLLM) — text and True Sight independently configurable - Token Auth: Bearer token authentication for remote ChromaDB
Quick Start
PyPI (Recommended)
The easiest way to get the library up and running for use with any MCP client:
pip install candlekeep
# Run in stdio mode (standard)
candlekeep
# Run in HTTP mode (recommended for better performance)
CANDLEKEEP_TRANSPORT=http CANDLEKEEP_HTTP_PORT=8111 candlekeep
Docker (Isolated)
Run the server in a container. Note that if your ChromaDB is running on localhost, you'll need to use your host's internal IP (e.g., host.docker.internal on Docker Desktop):
docker run -p 8111:8111 \
-e CHROMA_URL=http://host.docker.internal:8000 \
ghcr.io/bansheeemperor/candlekeep:latest
Local Development
If you wish to contribute or modify the library's arcane secrets:
git clone https://github.com/raalgaw/candlekeep.git
cd candlekeep
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 # Enter the library
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
- explore_entity — Explore an entity's co-occurring entities and source chunks via the graph
- generate_documentation — Scan a project and create structured docs
- memory_recall — Recall recorded memories semantically similar to a query
- memory_list — List recorded memories, newest first
- ingest — Add documents with automatic quality validation
- delete_document — Remove a tome from the index
- repopulate_database — Clear and rebuild the library
- rebuild_normalisation_map — Regenerate The Rosetta Seal from the current corpus after a full repopulate + ingest cycle
- memory_store — Record a short-form memory (lesson, failure pattern, debug tip) in the Chronicle
- memory_delete — Delete a memory from the Chronicle by ID
The Chronicle is a separate store of agent-recorded memories, isolated from the document corpus and preserved across repopulate_database.
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/True Sight 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)
<sub>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.</sub>
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。