local-knowledge-base
Provides cited retrieval over local-first knowledge sources (TXT, CSV, Google Sheets, Zoho Mail, MBOX) via SQLite FTS5, with tools for searching and checking source status, returning evidence links instead of generated answers.
README
Local-first Knowledge Base
A private, local-first evidence search system for TXT, CSV, Google Sheets, Zoho Mail and MBOX sources. It normalizes source documents into SQLite FTS5 and exposes cited results through a local web UI, CLI and MCP server.
The runtime does not call a paid LLM API. It returns evidence with source links instead of generating unsupported answers.
Features
- SQLite FTS5 index with rare-term scoring, character similarity, recency and reciprocal-rank fusion;
- idempotent TXT, CSV and Google Sheets ingestion;
- Google Sheets connector restricted to
spreadsheets.readonly, one configured spreadsheet and configured sheet IDs; - GET-only Zoho Mail connector with exact account and folder matching;
- local web UI bound to loopback only;
- MCP tools for cited retrieval and source status;
- no-answer gate for weak or unrelated matches;
- no model API keys or token-based LLM costs.
Quick start
Requirements: Python 3.11+ and Node.js only for the JavaScript syntax check.
python -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
cp data/lukasz_knowledge_base/config.example.json \
data/lukasz_knowledge_base/config.json
cp data/lukasz_knowledge_base/internal_context.example.txt \
data/lukasz_knowledge_base/internal_context.txt
python execution/lukasz_knowledge_base.py init
python execution/lukasz_knowledge_base.py ingest-txt \
data/lukasz_knowledge_base/internal_context.txt
python execution/lukasz_knowledge_base.py serve
Open http://127.0.0.1:8765.
The server refuses to bind to a public interface because the MVP has no remote authentication.
Google Sheets
- Create a dedicated Google service account.
- Share only the required spreadsheet with that identity as Viewer.
- Save its credential locally as
service_account.json. This filename is ignored by Git. - Set the spreadsheet URL and allowed
sheet_gidsin the privateconfig.json. - Run:
python execution/lukasz_knowledge_base.py sync-sheet
The connector constructs credentials with only:
https://www.googleapis.com/auth/spreadsheets.readonly
It uses spreadsheet metadata and value reads; it contains no Sheets write operation.
Zoho Mail
Create a dedicated folder such as Knowledge Base and a dedicated OAuth grant with read scopes only:
ZohoMail.accounts.READ
ZohoMail.folders.READ
ZohoMail.messages.READ
Provide credentials through local LOCAL_KB_ZOHO_* environment variables or an ignored token file, then run:
python execution/lukasz_knowledge_base.py sync-zoho
The default configuration blocks Inbox. Email source text is marked as untrusted evidence.
Search
python execution/lukasz_knowledge_base.py status
python execution/lukasz_knowledge_base.py search "What is our response process?"
python execution/lukasz_knowledge_base.py search "What is the offer?" --source internal_txt
Each result includes a snippet, source type, metadata, score and source URL. When the lexical evidence is too weak, the result list is empty.
MCP
Example MCP client entry:
{
"mcpServers": {
"local-knowledge-base": {
"command": "python",
"args": ["/absolute/path/execution/lukasz_knowledge_base_mcp.py"],
"env": {
"LOCAL_KB_CONFIG": "/absolute/path/data/lukasz_knowledge_base/config.json"
}
}
}
}
Available tools:
search_knowledgelist_knowledge_sourcesknowledge_base_status
Architecture
TXT / CSV / Google Sheets / Zoho / MBOX
|
read-only source connectors
|
normalized documents + provenance
|
SQLite FTS5 + hybrid lexical ranking
|
cited evidence + no-answer gate
|
CLI / Web / MCP
Secret safety
Never commit private config.json, .env, service-account JSON, OAuth tokens, MBOX exports, internal context or generated databases. The included .gitignore excludes these files, but secret scanning and credential rotation remain the operator's responsibility.
Run the same checks used before publication:
python -m pip install -r requirements-dev.txt
python -m pytest -q
node --check execution/lukasz_knowledge_base_web/app.js
gitleaks detect --no-git --source . --redact
License
MIT
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。