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.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.