Memory V2 MCP

Локальная долговременная память для ИИ-агентов: проекты, ветки диалогов и постоянные факты в одном файле SQLite. 10 инструментов MCP для поиска, восстановления веток диалогов и сохранения решений. Без облака и учетной записи.

Документация

Memory v2.1

CI Release License Python Glama

Local-first long-term memory for AI agents and long-running projects.

Memory v2.1 stores projects, conversation branches, messages and durable facts in a single SQLite database. It is built for people who want their agent memory to stay on their own machine: no cloud account, no vendor lock-in, no telemetry.

Status: 2.1.0-alpha.4. The core API, MCP server, web UI and offline installers are working and tested. Expect rough edges; back up your database.

Why

Long agent sessions get lost when a workspace is recreated, a model is switched, or a chat is closed. Memory v2.1 keeps the whole branch, not just a summary:

  • one project can contain dozens of branches;
  • a branch can be restored with one request;
  • durable facts survive across sessions;
  • full-text search covers both facts and messages;
  • the database is a plain SQLite file you can copy and inspect.

Features

  • Projects → branches → messages. One project, many conversations, shared logic and search.
  • Durable memories. Facts, decisions, constraints and preferences with importance, confidence, status and supersede links.
  • Message provenance. Every message keeps its original source fingerprint; edits create revisions instead of silently changing the archive. Soft-deleted messages stay recoverable and are excluded from search.
  • Large branches. Paginated message loading, load-earlier, in-branch search and jump-to-message; role editing and edit history are built in.
  • Full-text search. SQLite FTS5 plus Russian morphology (pymorphy3); search memories and messages, optionally inside one project.
  • Idempotent archive. Re-sending the same branch appends only new messages; duplicates are skipped.
  • Web UI. Projects, branches, messages, memory cards, search, triggers, settings and first-run onboarding. No Node.js build step.
  • MCP server. Ten tools for Claude Desktop, Claude Code, Cursor, Cline, Continue, Windsurf, Zed and other MCP clients.
  • Browser extension. Save selected text or the current page from Chrome/Edge/Chromium and Firefox (experimental): context menu, mem + Tab, or the toolbar popup.
  • Offline installers. Windows and Linux packages with Python 3.12 and all wheels included. A visible status window/stage progress shows what is happening; no internet is needed during installation.
  • Local-first. SQLite file, loopback-only by default, no cloud services.
  • Backups and diagnostics. One-click SQLite backup API, JSON project export, log rotation and /diagnostics.

How it compares

Memory v2 is not a vector store and not an agent framework. It is a small, inspectable archive that an agent can query over MCP.

Memory v2Hosted memory services (mem0, Zep Cloud)Agent frameworks (Letta)Markdown notes (basic-memory)Plain files
Data locationone SQLite file on your diskvendor cloudyour serverMarkdown filesanywhere
Account requirednoyesnonono
MCP serverbuilt in (7 tools)usually separateyesyesno
Editable historyrevisions + soft deletelimitedlimitedgitmanual
SearchFTS5 + morphologyembeddingsembeddingsMarkdown/grepnone
Works offlineyes, installers includednopartialnoyes
LicenseMITmixedApache-2.0MIT—

Details for the other projects change quickly — check their docs. The point here is the trade-off: hosted services give you convenience and sync, Memory v2 gives you a file you own, no account, and no network dependency.

Install

Where to get it

ChannelLink
Offline installers (Windows, Linux)Releases
MCP server packagememory-v2-mcp on PyPI — uvx memory-v2-mcp
Official MCP registryio.github.DonParalon85/memory-v2
Docker image (catalog PR in review)Dockerfile.mcp, docker/mcp-registry#7997
Docker Composedocker compose up -d --build
From sourcebash install/linux/install.sh

Windows (recommended: offline installer)

  1. Download MemoryV2-v2.1.0-alpha.2-Windows-x64.zip from Releases.
  2. Extract it to any folder.
  3. Run windows\install-memory.bat.
  4. The app installs per user to %LOCALAPPDATA%\MemoryV2, starts at logon and opens http://127.0.0.1:8002/ui/.

No administrator rights and no internet connection are required. Windows may show a SmartScreen warning because the installer is not code-signed yet. Details: docs/installers.md.

Linux (recommended: offline installer)

  1. Download MemoryV2-v2.1.0-alpha.2-Linux-x64.zip from Releases.
  2. Extract it.
  3. Run:
bash linux/install.sh

The installer puts the app in ~/.local/share/memoryv2, creates a user systemd service (or a nohup fallback), and starts it on http://127.0.0.1:8002/ui/.

Python 3.12 is required. The installer can install it via the system package manager if it is missing; the Python packages themselves are bundled offline (cp312, x86_64).

Docker (from source)

cp .env.example .env
mkdir -p data
docker compose up -d --build

Open http://127.0.0.1:8002/ui/.

Manual native install (development)

python3.12 -m venv .venv
. .venv/bin/activate
pip install -r api/requirements.txt
pip install -r mcp/requirements.txt
cp .env.example .env
python api/init_db.py
python start_memory.py

See README-WINDOWS.md for the Windows native path.

First run

  • The API listens on 127.0.0.1:8002 by default.
  • If MEMORY_API_TOKEN is empty, only loopback clients are accepted.
  • The onboarding wizard offers language (RU/EN), an optional AI agent, and browser-extension installation.
  • The demo seed is optional and fictional:
MEMORY_API=http://127.0.0.1:8002 python3 examples/seed_demo.py

Browser extension

The extension is included in both offline installers and in the app's first-run wizard. Standalone packages are attached to each release:

MemoryV2-v2.1.0-alpha.2-browser-extension.zip   # Chrome/Edge/Chromium
MemoryV2-v2.1.0-alpha.2-firefox-extension.zip   # Firefox

Chrome/Edge/Chromium:

  1. Open chrome://extensions (Edge: edge://extensions).
  2. Enable Developer mode.
  3. Choose Load unpacked and select the memory-v2-extension folder.
  4. Pin the icon and check the API URL in the extension settings.

Firefox (experimental):

  1. Unpack the Firefox ZIP.
  2. Open about:debugging#/runtime/this-firefox.
  3. Choose Load Temporary Add-on and select manifest.json.
  4. For a permanent install, submit the ZIP to addons.mozilla.org (AMO); Firefox does not install unsigned XPI permanently.
  5. If Firefox asks for access to 127.0.0.1:8002, allow it.

Usage:

  • select text → right click → Memory v2.1 → project;
  • type mem, press Tab, then проект Home: text or save this page to project Home;
  • click the toolbar icon for a popup with selection/page capture.

A search query typed into Google/Yandex goes to the search engine, not to Memory. Use the context menu, mem + Tab, or the popup instead. Firefox is experimental: use the separate Firefox ZIP; permanent install requires AMO signing.

See extension/README.md.

MCP

The MCP server lives in mcp/. It speaks stdio and uses the Memory HTTP API; it never opens the SQLite file directly.

Published on PyPI as memory-v2-mcp:

uvx memory-v2-mcp            # run without installing
pip install memory-v2-mcp    # or install the console script

From the source tree:

python3.12 -m venv .venv-mcp
. .venv-mcp/bin/activate
pip install -r mcp/requirements.txt
python mcp/server.py

Tools:

ToolPurpose
memory_healthCheck API availability
memory_list_projectsList projects
memory_create_projectCreate a project container
memory_project_contextRestore a project and its branches
memory_searchSearch memories and messages
memory_archive_conversationArchive a branch idempotently
memory_upsertStore a fact, decision, constraint or preference
memory_getRead one memory by id
memory_list_memoriesList facts with filters
memory_deprecateRetire an old memory, optionally with a replacement

Client configs (Claude Desktop, Claude Code, Cursor, Docker-only) are in mcp/README.md and mcp/examples/.

API at a glance

GET  /health
GET  /projects
POST /projects
GET  /projects/{id}/context
POST /conversations/archive
GET  /memories/search?q=...&include_messages=true
POST /memories/upsert
POST /memories/{id}/deprecate
POST /capture
GET  /settings
PUT  /settings
POST /triggers/preview
POST /triggers/apply
GET  /diagnostics

Interactive API reference: http://127.0.0.1:8002/docs.

Archive requests are idempotent; use a stable external_id:

{
  "project_id": 1,
  "title": "Demo / FastAPI async session debugging",
  "source": "demo",
  "external_id": "demo:fastapi:async-session:001",
  "messages": [
    {"role": "user", "content": "..."},
    {"role": "assistant", "content": "..."}
  ]
}

Data model

TablePurpose
projectsShared project container
conversationsA dialog branch
messagesUser/assistant messages
memoriesDurable facts, decisions, constraints, preferences
eventsReserved for future timeline events
settingsLanguage, AI agent, onboarding, triggers, extension status

SQLite FTS5 indexes (memories_fts_norm, messages_fts) are kept in sync by triggers. The schema is in migrations/schema.sql.

Configuration

VariableDefaultMeaning
MEMORY_DBdata/memory_v2.dbSQLite database path
MEMORY_SCHEMAmigrations/schema.sqlSchema for first init
MEMORY_HOST127.0.0.1Listen address
MEMORY_PORT8002Listen port
MEMORY_API_TOKENemptyBearer token; empty means loopback-only
MEMORY_TRUST_BRIDGEemptySet to 1 only for a loopback-published Docker port
MEMORY_LANGUAGEruInitial UI language (ru/en)
MEMORY_LOG_DIRlogsLog directory

If you expose the API to a LAN, set MEMORY_API_TOKEN and use a reverse proxy with HTTPS. Never expose an unauthenticated instance to the internet.

Development

python3.12 -m venv .venv
. .venv/bin/activate
pip install -r api/requirements.txt
pip install -r mcp/requirements.txt
sh scripts/ci_integration.sh

The integration script creates a clean database, starts the API on 127.0.0.1:8002, seeds the fictional demo project and runs the 13-check MCP stdio test. The GitHub Actions workflow runs the same script on Python 3.12.

Repository layout:

api/            FastAPI application, auth, search, archive, capture, settings
mcp/            MCP stdio server, HTTP client, 13-check smoke test
web/            Static UI (HTML/CSS/JS, no build step)
extension/      Chrome/Edge MV3 extension
connectors/     OpenCode sync (Windows/Linux) and generic import
migrations/     SQLite schema and notes
install/        Docker/venv developer installers
scripts/        CI, backup, search and health helpers
docs/           Architecture, testing, integrations, installers
examples/       Fictional demo seed

Backup

The database is the source of truth. Use the SQLite backup API while the API is running, or copy the file while it is stopped.

python3 - <<'PY'
import sqlite3
src = sqlite3.connect("data/memory_v2.db")
dst = sqlite3.connect("data/backup.db")
src.backup(dst)
dst.close()
src.close()
PY

Security

  • Loopback-only by default; empty token means non-local clients get 401.
  • Optional bearer token for LAN/reverse-proxy deployments.
  • Connectors redact common token patterns before archiving, but this is not a guarantee. Do not put secrets into prompts or conversation text.
  • Keep backups and restrict file permissions.

Roadmap

  • Projects, branches, messages, durable memories.
  • FTS5 + Russian morphology.
  • Idempotent archive.
  • Web UI with manual CRUD, triggers, settings and onboarding.
  • MCP server for agent integrations.
  • Chrome/Edge extension.
  • Offline Windows and Linux installers.
  • Firefox extension (experimental; temporary load or AMO signing).
  • Importers for ChatGPT/Claude/Markdown exports.
  • Alembic migrations and schema version history.
  • Code-signed native Windows .exe (the current installer is unsigned).

License

MIT. See LICENSE. The license can be switched to Apache-2.0 before a stable release.