mcp-kb-sqlite
Simple, fast persistent memory for your coding agent — cross-session, cross-project. One knowledge
base shared across every repo you work in, so what you learn in one project is there the next time
you open another. Entries can be linked to each other (relate), so related facts stay connected
instead of scattered.
Start a conversation with /kb-use to load relevant context before you begin. When you learn
something worth keeping — an architecture decision, a gotcha, a debugging finding — save it with
/kb-update.
Under the hood: a plain SQLite database with an FTS5 full-text index, and a small tool surface for agents to search, save, and link entries. No server to run, no external service, no schema to manage by hand.
Install — MCP server
The database lives at ~/.ai-memory/kb.db unless you override it with DB_PATH (shown below,
optional). The schema is created and migrated automatically on first connection.
Claude Code
claude mcp add kb -- uv run --directory /path/to/mcp-kb-sqlite mcp-kb-sqlite
# with a custom DB_PATH:
claude mcp add kb --env DB_PATH=/path/to/kb.db -- uv run --directory /path/to/mcp-kb-sqlite mcp-kb-sqlite
Or add it directly to .mcp.json (project-local) or ~/.claude.json (user-scoped, under the
top-level mcpServers key):
{
"mcpServers": {
"kb": {
"type": "stdio",
"command": "uv",
"args": ["run", "--directory", "/path/to/mcp-kb-sqlite", "mcp-kb-sqlite"],
"env": { "DB_PATH": "/path/to/kb.db" }
}
}
}
env is optional — drop it to use the default ~/.ai-memory/kb.db.
OpenCode
Add to opencode.json (global at ~/.config/opencode/opencode.json, or project-local):
{
"mcp": {
"kb": {
"type": "local",
"command": [
"uv",
"run",
"--directory",
"/path/to/mcp-kb-sqlite",
"mcp-kb-sqlite"
],
"enabled": true,
"environment": { "DB_PATH": "/path/to/kb.db" }
}
}
}
environment is optional — drop it to use the default ~/.ai-memory/kb.db.
Install — skills
The /kb-use and /kb-update workflows ship as skills for both Claude Code and OpenCode. The two
flavors are hand-kept in sync — there's no generator, so edit both when instructions change.
Claude Code
Copy or symlink skills/claude/commands/*.md into ~/.claude/commands/.
OpenCode
Copy or symlink each skills/opencode/<name>/ directory into ~/.config/opencode/skills/<name>/
(or a project-local .opencode/skills/). OpenCode skills are auto-invoked by description match via
the agent's skill tool, but can also be triggered directly as /<name> in chat — this prepends
the SKILL.md text and appends whatever you typed after the command.
Tools
| Tool | Purpose |
|---|---|
save(id?, ns?, key?, title?, description?, tags?, data?) |
Create or update an entry — see below |
replace(id, old_string, new_string, replace_all=False) |
Targeted edit to an entry's data — see below |
get(id, include_data=False) |
Fetch one entry; include_data=True returns the payload. Also shows up to 10 most recently added relations — use get_relations for the full set |
search(query, ns?, limit=10, offset=0) |
FTS5/BM25 over title + description + tags + data |
list(ns?, limit=20, offset=0) |
Entries by recency, metadata only |
list_namespaces() |
Namespaces with entry counts and last-updated date |
relate(from_id, to_id, rel?) |
Link two entries; omit rel to remove all links between them |
get_relations(id) |
Links in both directions |
delete(id) |
Remove an entry (cascades to its relations) |
Entries are addressed by ns (namespace, e.g. project/subsystem) plus key (a slug unique within the
namespace). ns filters are prefix matches, so ns="project" covers every subsystem under it.
title, description, tags, and data are all FTS-indexed — search matches against the full
entry, including its payload, not just the summary fields.
save: create vs. update
Every parameter is optional; the presence of id picks the mode.
Update — pass id plus only the fields you want to change:
save(id=42, description="new search hints") # title, tags, data untouched
Omitted fields keep their current value. Pass "" (or [] for tags) to clear description, tags, or
data. ns, key, and title can be changed — that's how you rename or move an entry — but not cleared.
Create — omit id; ns, key, and title are all required:
save(ns="project/db", key="schema", title="Schema layout", tags=["db","schema"], data="…")
There is no upsert. Creating over an existing (ns, key) is an error that reports the existing id, so an
accidental full overwrite isn't possible:
Error: project/db/schema already exists (id=42) — pass id=42 to update it
replace: targeted edits without resending data
For a small change to an existing entry's data, replace avoids resending the whole field through save:
replace(id=42, old_string="old fact", new_string="corrected fact")
old_string must match exactly. It's an error if the text isn't found, or if it matches more than once —
pass replace_all=True to replace every occurrence, or include more surrounding context in old_string to
disambiguate a single occurrence. This mirrors editor-style find/replace: self-verifying, so a stale or
ambiguous call fails loudly instead of silently writing to the wrong content.
Metadata
Release files for mcp-kb-sqlite 0.2.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 |
|---|---|---|---|---|
| mcp_kb_sqlite-0.2.0.tar.gz | 89.9 kB | With provenance | Details for mcp_kb_sqlite-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcp_kb_sqlite-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for mcp_kb_sqlite-0.2.0-py3-none-any.whl |
Total release size: 103.9 kB
Release files / mcp_kb_sqlite-0.2.0.tar.gz
| Download URL | mcp_kb_sqlite-0.2.0.tar.gz |
|---|---|
| Size | 89.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
252c04ddb72b951e8c5d2a2ff3083713198ebd28d684d04ce769f4e9ac64a76f
|
|
BLAKE2b-256 checksum How to use checksums |
51a66762af67f134c91370c762f7da27dd7732378f0002427ae4f1917e068524
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.
Transparency logRelease files / mcp_kb_sqlite-0.2.0-py3-none-any.whl
| Download URL | mcp_kb_sqlite-0.2.0-py3-none-any.whl |
|---|---|
| Size | 14.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
49ef5917d9843f7e077a50d0862ca1b8620ade0d6fabbce02cf2e83214f106dc
|
|
BLAKE2b-256 checksum How to use checksums |
da31d00117faf0be48aa9ba35d35e283dd34b2dc7cb85dc9a763f2a194b13fad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.
Transparency logSecurity for mcp-kb-sqlite 0.2.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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for mcp_kb_sqlite-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.
Transparency logA 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.