localmem-mcp

localmem-mcp

Gives AI agents persistent, local-first memory using SQLite and on-device embeddings, enabling semantic search and recall across sessions with no cloud calls.

Category
Visit Server

README

<div align="center">

<img src="docs/assets/banner.svg" alt="localmem-mcp β€” give your AI agent a memory that never leaves your machine" width="880">

CI PyPI - Version PyPI - Python Versions License: MIT MCP Docs Local-first

Just SQLite and local embeddings.

πŸ“– Read the docs β†’

<!-- TODO: replace with demo.gif β€” agent stores a fact in one session, recalls it in the next --> <img src="docs/demo.gif" alt="localmem-mcp demo" width="720">

</div>


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.

<details> <summary>Prefer a normal install?</summary>

pip install localmem-mcp     # then use "command": "localmem-mcp" in the config above

</details>

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
localmem-mcp export > memories.jsonl     # take your memories elsewhere
localmem-mcp import memories.jsonl

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.

License

MIT

Recommended Servers

playwright-mcp

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured