hybrid-recall
A local MCP server enabling hybrid search over documents, memory, and knowledge graphs for retrieval-augmented generation, with tools for SQLite, semantic memory, and entity-relationship queries.
README
hybrid-recall
A local, self-hosted retrieval stack exposed over the Model Context Protocol (MCP). It gives an LLM four tools:
sqlite- hybrid search over a document corpus you ingest (FTS5 keyword + semantic embeddings, fused with Reciprocal Rank Fusion).retrieve- one unified search across the knowledge graph, memory, and docs, with KG-powered query expansion and RRF fusion.memory- a semantic key/value store for cross-session notes (store / append / replace-section / search / get / list).kg- an entity-relationship knowledge graph with hybrid search.
Everything runs on your machine. The only external dependency is an
OpenAI-compatible embedding server (a small llama-server process), and an
optional reranker. Nothing is sent to a third party.
How it fits together
MCP client (Claude Desktop, etc.)
| stdio (JSON-RPC)
v
server.py -> sqlite / retrieve / memory / kg tools
| | |
| | +--> memory daemon (TCP :8767)
| +--> knowledge_graph.jsonl
+--> docs.db (FTS5 + 2560-d embeddings) + embed_cache (mmap)
|
v
embedding server (llama-server :8000, Qwen3-Embedding-4B)
The docs corpus, memory, and knowledge graph all embed through the same model,
so a single llama-server covers the whole stack.
Requirements
- Python 3.10+
- llama.cpp (
llama-serveron your PATH) - A GPU is recommended for the embedding model (it runs on CPU too, slower)
Quickstart
# 1. Install Python deps
pip install -r requirements.txt
# 2. Download the embedding model into ./models (see models/README.md)
huggingface-cli download Qwen/Qwen3-Embedding-4B-GGUF \
Qwen3-Embedding-4B-Q8_0.gguf --local-dir ./models
# 3. Start the embedding server (leave running in its own terminal)
scripts/start_embeddings.sh # Windows: scripts\start_embeddings.bat
# 4. Start the memory daemon (needed for the memory + retrieve tools)
scripts/start_memory.sh # Windows: scripts\start_memory.bat
# 5. Create the empty docs database
python init_databases.py
# 6. Ingest your documents (markdown, html, json, text, code)
python scripts/ingest_docs.py --source ./corpus # ./corpus has sample docs
# 7. Embed the chunks (talks to the embedding server from step 3)
python scripts/embed_docs.py
# 8. (optional) Prebuild the mmap vector cache for instant search
python scripts/rebuild_mmap_cache.py
Then point your MCP client at server.py (see example_config.json):
{
"mcpServers": {
"hybrid-recall": {
"command": "python",
"args": ["/absolute/path/to/hybrid-recall/server.py"]
}
}
}
Configuration
All settings have sane localhost defaults; override them with environment
variables or a .env file (see .env.example). The important ones:
| Variable | Default | Purpose |
|---|---|---|
EMBED_SERVER_URL |
http://127.0.0.1:8000/v1/embeddings |
embedding endpoint |
RERANKER_URL |
http://127.0.0.1:8001/v1/rerank |
reranker (optional) |
MEMORY_SERVICE_PORT |
8767 |
memory daemon port |
KNOWLEDGE_GRAPH_PATH |
./data/knowledge_graph.jsonl |
KG storage |
DOCS_DB_PATH |
./data/docs.db |
docs corpus DB |
To run the models on a different machine, point EMBED_SERVER_URL /
RERANKER_URL at that host. The tools do not care where the servers live.
Reranking
Reranking is optional and off by default. Every search works without it and
falls back to bi-encoder order if the reranker is not running. To enable it,
start the reranker (scripts/start_reranker) and pass rerank=true on a call.
Notes
- The docs corpus, memory store, and knowledge graph are all built from your own data. A fresh clone starts empty.
- Index-time and query-time embeddings must come from the same model. If you switch embedding models, re-embed the corpus.
- The memory tool is a small TCP daemon (
scripts/start_memory); the docs and KG tools run in-process inside the MCP server.
Benchmarks
The design choices here (Qwen3-4B bi-encoder, cross-encoder reranking off by
default, RRF fusion, BGE-reranker-v2-m3) are backed by real measurements: recall
suites, a 10-strategy fusion A/B, reranker and embedding model bake-offs, and
latency profiles. See benchmark.md. Short version: real
embeddings + reranking moved retrieval MRR from 0.36 to 0.77 on a 32-query suite,
and plain reranking beat every fancy fusion scheme tried against it.
License
MIT. See LICENSE.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。