localmem-mcp
Give your AI agent a memory that never leaves your machine.
No cloud. No API keys. No per-call billing. Just SQLite and local embeddings.
Quickstart (30 seconds)
1. Add it to your MCP client. No install step — uvx fetches and runs it:
// Claude Desktop: claude_desktop_config.json
// Cursor: .cursor/mcp.json
// Claude Code: claude mcp add localmem -- uvx localmem-mcp
{
"mcpServers": {
"localmem": {
"command": "uvx",
"args": ["localmem-mcp"]
}
}
}
2. Restart the client and talk to it:
"Remember that we chose SQLite over Postgres for this project because it ships in a single file."
…then, in a completely new session tomorrow:
"What database did we pick, and why?"
That's it. Your agent now remembers, and nothing left your laptop.
Prefer a normal install?
pip install localmem-mcp # then use "command": "localmem-mcp" in the config above
The three tools
| Tool | What the agent uses it for |
|---|---|
store_memory |
Save a durable fact, decision, or preference — with optional tags. |
search_memory |
Find memories by meaning, not keywords. "which database?" finds "we went with SQLite". |
recall_memory |
Re-read a specific memory by id, or catch up on the most recent ones. |
Plus memory_stats for where the database lives and how much is in it.
Also a Python library
The MCP server is a thin shell over a store you can import directly:
from localmem_mcp import MemoryStore
store = MemoryStore() # ~/.localmem/memories.db
store.add("We chose SQLite over Postgres", tags=["decision", "architecture"])
for hit in store.search("what database are we using?"):
print(hit.score, hit.memory.content)
And a CLI, for when you just want to look:
localmem-mcp add "Deploys go out on Thursdays" --tag ops
localmem-mcp search "when do we ship?"
localmem-mcp recall -n 5
localmem-mcp stats
Privacy
Nothing is sent anywhere. Memories live in one SQLite file you own, and
embeddings are computed on-device with fastembed.
The only network request the package ever makes is the one-time download of the
embedding model (~90 MB, from Hugging Face) on first use — after that it works
fully offline. Delete ~/.localmem/memories.db and the memory is gone.
Architecture
MCP client (Claude Code, Cursor, Claude Desktop, OpenClaw…)
│ stdio / JSON-RPC
▼
server.py FastMCP — store_memory · search_memory · recall_memory
▼
store.py MemoryStore
├── SQLite memories table + FTS5 index (durable, single file)
└── fastembed ONNX embeddings, lazy-loaded (on-device, 384-dim)
Search is hybrid: every memory is scored by cosine similarity against the
query embedding, and memories that also hit the FTS5 keyword index get a bounded
bonus — so paraphrases are found and exact terms like error codes or names
aren't lost. Embeddings are stored as float32 blobs alongside the text, so a
memory is one row and there is no second datastore to keep in sync.
The model loads lazily on the first store/search call, which keeps server startup near-instant for clients that spawn it eagerly.
Configuration
| Environment variable | Default | Purpose |
|---|---|---|
LOCALMEM_DB_PATH |
~/.localmem/memories.db |
Full path to the SQLite file. |
LOCALMEM_HOME |
~/.localmem |
Directory used when LOCALMEM_DB_PATH is unset. |
LOCALMEM_MODEL |
BAAI/bge-small-en-v1.5 |
Any model name supported by fastembed. |
Point separate projects at separate databases with --db or LOCALMEM_DB_PATH.
Contributing
Issues and PRs are welcome, and the project is deliberately small enough to read
in one sitting — store.py is the whole thing, and everything else is a shell
over it.
git clone https://github.com/OpenAgentHQ/localmem-mcp && cd localmem-mcp
python -m venv .venv && .venv/bin/pip install -e ".[dev]"
.venv/bin/python -m pytest -q # offline, about a second
CONTRIBUTING.md covers the layout, the testing approach, and what does and doesn't fit the project. Good first issues are scoped to be approachable without deep context.
- Code of Conduct
- Security policy — report vulnerabilities privately, please
License
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file localmem_mcp-0.1.0.tar.gz.
File metadata
- Download URL: localmem_mcp-0.1.0.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37b3d311bee32b2f2235729d176f9c7d43c018263ad628cd6d752d6e97c20b5e
|
|
| MD5 |
f7715a7861f5592f3d9e8fce5dcfd987
|
|
| BLAKE2b-256 |
b256b1217b0a4a7d73a99c47a92cf15e2e9c3407908357dd59bf7878955befd1
|
Provenance
The following attestation bundles were made for localmem_mcp-0.1.0.tar.gz:
Publisher:
release.yml on OpenAgentHQ/localmem-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
localmem_mcp-0.1.0.tar.gz -
Subject digest:
37b3d311bee32b2f2235729d176f9c7d43c018263ad628cd6d752d6e97c20b5e - Sigstore transparency entry: 2466413018
- Sigstore integration time:
-
Permalink:
OpenAgentHQ/localmem-mcp@a82128995d38ab308b837d5ba9bd11c3e620dc84 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/OpenAgentHQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a82128995d38ab308b837d5ba9bd11c3e620dc84 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file localmem_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: localmem_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
314c2fd35efcfe7770898902db39f9842496f517432a4f9c7e764ca2ff9f9576
|
|
| MD5 |
9698440de128307c3385d7a1308fd5fa
|
|
| BLAKE2b-256 |
ffe5963d9fbf81a991367e5e3cc67b0b78133f74569c1fddbfdc7f9909a2a9b3
|
Provenance
The following attestation bundles were made for localmem_mcp-0.1.0-py3-none-any.whl:
Publisher:
release.yml on OpenAgentHQ/localmem-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
localmem_mcp-0.1.0-py3-none-any.whl -
Subject digest:
314c2fd35efcfe7770898902db39f9842496f517432a4f9c7e764ca2ff9f9576 - Sigstore transparency entry: 2466413037
- Sigstore integration time:
-
Permalink:
OpenAgentHQ/localmem-mcp@a82128995d38ab308b837d5ba9bd11c3e620dc84 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/OpenAgentHQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a82128995d38ab308b837d5ba9bd11c3e620dc84 -
Trigger Event:
workflow_dispatch
-
Statement type: