mcp-knowledge-base
A Model Context Protocol (MCP) server that gives an AI assistant a searchable, persistent knowledge base. Documents are stored in SQLite and searched with FTS5 full-text search ranked by relevance.
It is a self-contained MCP server: it owns its own data and logic rather than wrapping an external API. The SQLite database is the application; MCP is the interface an AI host (Kiro, Claude Desktop, any MCP client) talks to it through.
Features
- Tools — add, search, get, list, update, and delete documents.
- Resources — read documents by URI (
kb://documents,kb://documents/{id}). - Prompts — reusable templates (
summarize_search,find_related). - Full-text search — SQLite FTS5 with BM25 relevance ranking, not naive
LIKE. - Input validation — Pydantic field constraints surfaced in the generated tool schemas.
Installation
Once published, add the server to your MCP host's config. No clone, no paths:
{
"mcpServers": {
"knowledge-base": {
"command": "uvx",
"args": ["sqlite-kb-mcp"]
}
}
}
- Kiro — put this in
.kiro/settings/mcp.json(workspace) or~/.kiro/settings/mcp.json(user). - Claude Desktop — put this in
claude_desktop_config.json.
uvx downloads and runs the published package on demand, so users never touch the source.
autoApproveis intentionally omitted here: auto-approving tool calls is a personal trust decision. Add it in your own config if you want read-only tools to run without a prompt.
What it exposes
Tools
| Tool | Description |
|---|---|
add_document(title, content, tags="") |
Add a document. |
search_documents(query, limit=10) |
Full-text search, ranked by relevance. |
get_document(doc_id) |
Fetch one document by id. |
list_documents() |
List all documents, newest first. |
update_document(doc_id, ...) |
Update provided fields. |
delete_document(doc_id) |
Delete a document. |
Resources
| URI | Description |
|---|---|
kb://documents |
All documents, as JSON. |
kb://documents/{doc_id} |
One document, as JSON. |
Prompts
| Prompt | Description |
|---|---|
summarize_search(query, limit=5) |
Searches the KB and asks the model to summarize (data embedded). |
find_related(topic) |
Instructs the model to find related documents using the search tool. |
Architecture
MCP host ──stdio──► server.py ──► db.py ──► knowledge.db
(Kiro/Claude) (MCP layer) (logic) (SQLite + FTS5)
server.py— the MCP interface. Each tool/resource/prompt is a thin wrapper that validates input and delegates todb.py. No business logic lives here.db.py— pure data-access logic. Knows nothing about MCP, so it is independently testable. Opens a connection per call to avoid SQLite threading issues.- SQLite + FTS5 — a
documentstable plus adocuments_ftsexternal-content virtual table. Triggers keep the search index in sync automatically, so CRUD touches only the main table.
This separation of concerns means the whole data layer is tested without any MCP machinery.
Development
# clone, then:
uv sync # install deps (incl. dev group)
uv run pytest # run the test suite
uv run mcp dev src/mcp_knowledge_base/server.py # open the MCP Inspector
To run the server directly over stdio:
uv run sqlite-kb-mcp
Notes and future work
- Transport — currently stdio (local subprocess). Streamable HTTP would make it deployable as a remote service; FastMCP supports it with a small change.
- Search — FTS5 matches whole tokens (
index!=indexes). Prefix queries (index*) work today; a Porter stemmer could be enabled for automatic stem matching. - Not implemented (by design) — client-side primitives (sampling, elicitation, roots) and OAuth authorization, which are relevant mainly to remote/HTTP deployments.
License
MIT
Metadata
Release files for sqlite-kb-mcp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sqlite_kb_mcp-0.1.0.tar.gz | 6.4 kB | Without provenance | Details for sqlite_kb_mcp-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sqlite_kb_mcp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for sqlite_kb_mcp-0.1.0-py3-none-any.whl |
Total release size: 13.8 kB
Release files / sqlite_kb_mcp-0.1.0.tar.gz
| Download URL | sqlite_kb_mcp-0.1.0.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ac7a7651558fc88d2dd53fb6c923a7d1837cc4906ea6c966f0cc07e149722ff3
|
|
BLAKE2b-256 checksum How to use checksums |
173cf240e8244d7fbcd8b154e1c2b632a709d85c82ee692c2db89aa0bc6cc1bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / sqlite_kb_mcp-0.1.0-py3-none-any.whl
| Download URL | sqlite_kb_mcp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6aae8d81a7d7bf054ae779ae35dafe374d449707b05f9d6ffc33d771bae5730e
|
|
BLAKE2b-256 checksum How to use checksums |
7a620cb13fadfa077e8ed1cd8c643e3e0fb26592f5e82e98e54d2fc95d848c7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for sqlite-kb-mcp 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.