kb-mcp
Provides LLM agents with a structured, queryable, local-first knowledge base with typed documents and full-text search via MCP.
README
<div align="center">
kb-mcp
An agent-native knowledge base.
pip install kb-mcp — give any LLM agent a structured, queryable, local-first second brain.
</div>
The problem
Knowledge bases for humans (Notion, Obsidian) and for search engines (Elasticsearch, vector DBs) leave a gap: LLM agents need a knowledge layer that speaks their protocol and assumes the reader is a model, not a person.
kb-mcp fills it.
| Obsidian / Notion | Vector DBs (Chroma / LanceDB) | kb-mcp |
|
|---|---|---|---|
| Reader-optimised for | Humans | Embeddings | LLM agents |
| Protocol | Web UI | SDK | MCP (stdio) |
| Schema | Free-form | Free-form | Typed (project / decision / lesson / ...) |
| Default storage | Cloud / proprietary | Local files | SQLite + FTS5 |
| Setup | Sign up | pip install + configure |
pip install and go |
Features
- 🧠 Agent-native. Every document is reachable from any MCP client
(
Claude Desktop,Cursor,OpenCode,Codex, …) viakb_search/kb_get/kb_add/kb_link. - 📐 Schema-first. Six built-in document types
(
project,decision,lesson,glossary,person,faq) — extensible via Python subclassing. - 🔍 Full-text search. SQLite FTS5 with BM25 ranking. Snippet-aware results returned to the agent.
- 🔗 Typed links. Documents reference other documents; backlinks are automatic.
- 📝 Markdown friendly. Round-trip import/export with frontmatter. Humans can edit, agents can read.
- 🪶 Zero deps by default. SQLite ships with Python.
pip install kb-mcpand you're done. - 🔒 Local-first. Your data lives in
~/.local/share/kb-mcp/. No cloud, no telemetry, no phone-home.
Quickstart
pip install kb-mcp
kb init
kb add --type project --title "kb-mcp" --tags kb,mcp,open-source --body "Agent-native knowledge base."
kb search "mcp server"
# Expose to any MCP client
kb serve
That's it. Five commands, zero config files.
👉 Full walkthrough: docs/quickstart.md
Document types
| Type | Purpose | Example |
|---|---|---|
project |
Repo / initiative background | kb-mcp, micro-app-fork |
decision |
Architecture Decision Record (ADR) | "Use SQLite FTS5 over Elasticsearch" |
lesson |
Post-mortem / lessons learned | "Don't last_insert_rowid() across multi-INSERT batches" |
glossary |
Term definitions | FTS5, MCP, ADR |
person |
People the agent should recognise | "Zhang Bei, owner, uses Hermes" |
faq |
Frequently asked questions | "Why SQLite?" |
Subclass kb_mcp.schema.Document to add your own.
MCP integration
Add to ~/.config/claude_desktop_config.json (or any MCP client):
{
"mcpServers": {
"kb": {
"command": "kb",
"args": ["serve"]
}
}
}
The agent then sees four tools:
kb_search(query, type?, tags?, limit?)— BM25-ranked results with snippetskb_get(id)— full document by id (or slug)kb_add(type, title, body, tags?, source?)— create documentkb_link(from_id, to_id, rel?)— typed edge between documents
Development
git clone https://github.com/your-org/kb-mcp
cd kb-mcp
pip install -e ".[dev]"
pytest # unit + E2E (real SQLite temp file, no mocks)
ruff check .
mypy src/
👉 Spec: docs/requirements.md · Architecture: docs/architecture.md · CLI reference: docs/cli-reference.md
Roadmap
| Version | Scope | Status |
|---|---|---|
| v0.1.0 | CLI + MCP server + SQLite/FTS5 + 6 doc types + Markdown I/O | 🚧 in progress |
| v0.2.0 | Vector search (sqlite-vss) as opt-in, hybrid BM25 + embedding ranking | planned |
| v0.3.0 | Multi-vault (per-project isolated KBs) + shared-vault mode | planned |
| v0.4.0 | Web UI (read-only) + collaborative editing hints | exploring |
| v1.0.0 | Postgres backend, multi-user auth, hosted mode | exploring |
See docs/requirements.md § 4 for v0.1 scope decisions and out-of-scope list.
Status
alpha. API and storage format may change before v0.2.0. Pin minor versions
(kb-mcp>=0.1,<0.2) in production.
Contributing
Issues and PRs welcome. See CONTRIBUTING.md (TODO before v0.1.0 release).
By participating, you agree to abide by the Code of Conduct (TODO before v0.1.0 release).
License
MIT — do what you want, just keep the copyright notice.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。