freshcrate
Skin:/
Home > MCP Servers > m3-memory

m3-memory

Local-first Agentic Memory Layer for MCP Agents • 25 tools • Hybrid search (FTS5 + vector + MMR) • GDPR • 100% local

Why this rank:Recent releaseStrong adoptionHealthy release cadence

Description

Local-first Agentic Memory Layer for MCP Agents • 25 tools • Hybrid search (FTS5 + vector + MMR) • GDPR • 100% local

README

M3 Memory — Local-First Agentic Memory for MCP Agents

GitHub StarsDiscordPyPI versionDownloads Python 3.11+ License: MIT MCP 25 tools CI Platform

Your AI agents finally remember things between sessions.

Persistent, private memory for MCP agents. Runs entirely on your hardware.
No cloud. No API keys. No subscriptions.

Claude CodeGemini CLIAiderOpenClaw

  • Quick Start
  • Let Your Agent Install It
  • The Problem
  • With M3 Memory
  • The Moment It Clicks
  • Who This Is For
  • Use Cases
  • Features
  • Core Tools
  • How It Compares
  • Architecture
  • See It in Action
  • Documentation
  • Community
  • Roadmap
  • Contributing

  • Quick Start (<1 minute)

    Prerequisites: Python 3.11+ and Ollama (or any OpenAI-compatible embedding endpoint).

    ollama pull nomic-embed-text && ollama serve
    pip install m3-memory

    Add to your MCP config (~/.claude/settings.json, ~/.gemini/settings.json, etc.):

    {
      "mcpServers": {
        "memory": { "command": "mcp-memory" }
      }
    }

    Restart your agent. It now has memory. Done.


    Let Your Agent Install It

    Already inside Claude Code, Gemini CLI, or Aider? Paste one of these prompts and let the agent set it up for you:

    Claude Code:

    Install m3-memory for persistent memory. Run: pip install m3-memory
    Then add {"mcpServers":{"memory":{"command":"mcp-memory"}}} to my
    ~/.claude/settings.json under "mcpServers". Make sure Ollama is running
    with nomic-embed-text. Then use /mcp to verify the memory server loaded.
    

    Gemini CLI:

    Install m3-memory for persistent memory. Run: pip install m3-memory
    Then add {"mcpServers":{"memory":{"command":"mcp-memory"}}} to my
    ~/.gemini/settings.json under "mcpServers". Make sure Ollama is running
    with nomic-embed-text.
    

    Aider / Any MCP agent:

    Install m3-memory for persistent memory. Run: pip install m3-memory
    Then add {"mcpServers":{"memory":{"command":"mcp-memory"}}} to the
    MCP config file for this agent. Make sure Ollama is running with
    nomic-embed-text.
    

    After install, test it:

    Write a memory: "M3 Memory installed successfully on [today's date]"
    Then search for: "M3 install"
    

    The Problem

    Every new session, your AI agent has amnesia. It forgets your project structure, your preferences, the decisions you made together yesterday. You paste the same context. You re-explain the same architecture. You correct the same mistakes.

    When facts change — a port number, a dependency version — there's no mechanism to update what the agent "knows." Contradictions accumulate silently until something breaks.

    With M3 Memory

    Your agents remember. Architecture decisions, server configs, debugging history, your preferences — all searchable, all persistent across sessions and devices.

    When facts change, M3 detects the contradiction, updates the record, and preserves the full history. No stale data. No manual cleanup. You just talk to your agent, and it knows what it should know.


    The Moment It Clicks

    Session You say Agent response
    Session 1 "Our API server runs on port 8080." Stored.
    Session 2 (3 days later) "We moved the API to port 9000." Contradiction detected. Updated. History preserved.
    Session 3 (a week later) "What port is the API on?"

    Without M3: "I don't have that information. Could you tell me?"

    With M3: "Port 9000. (Updated from 8080 — change recorded March 12th.)"

    No prompts. No manual logic. Automatic contradiction resolution with full history.


    Who This Is For

    For you if... Not for you if...
    You use Claude Code, Gemini CLI, Aider, or any MCP agent You're building LangChain/CrewAI pipelines — see Mem0
    You want memory that survives across sessions + devices You want a full agent runtime — see Letta
    You prefer local-first: no cloud, no API costs, works offline You only need short-term chat context in a single session
    You care about privacy and data ownership

    Use Cases

    Coding agents Remember architecture decisions, configs, and debugging steps across sessions
    Personal assistants Persist user preferences, goals, and history long-term
    Dev workflows Track environment changes, server configs, and fixes automatically
    Multi-device setups Write a memory on your MacBook, pick it up on your Windows desktop — same knowledge graph, synced locally

    Features

    Hybrid Search

    Three-stage pipeline: FTS5 keyword matching, semantic vector similarity, and MMR diversity re-ranking. Better recall than vector-only search, especially for technical content with exact names and versions.

    Automatic Contradiction Detection

    Write conflicting information and M3 detects it automatically. The outdated memory is superseded via bitemporal versioning, a supersedes relationship is recorded, and the full history is preserved.

    Bitemporal History

    Query as_of="2026-01-15" to see exactly what your agent believed on any past date. Every change is tracked with both the time the fact was true and the time it was recorded.

    Knowledge Graph

    Related facts are linked on write when cosine similarity exceeds 0.7. Eight relationship types (related, supports, contradicts, extends, supersedes, references, consolidates, message). Traverse up to 3 hops with memory_graph.

    Cross-Device Sync

    Bi-directional delta sync across SQLite, PostgreSQL, and ChromaDB. Write on your MacBook, continue on your Windows desktop. No cloud intermediary.

    GDPR Built-In

    gdpr_forget (Article 17 — Right to Erasure) and gdpr_export (Article 20 — Data Portability) as native MCP tools.

    Fully Local + Private

    Local embeddings via Ollama, LM Studio, or any OpenAI-compatible endpoint. Zero cloud calls. Zero API costs. Works completely offline.

    Self-Maintaining

    Automatic decay, expiry purging, orphan pruning, deduplication, and retention enforcement. Old memories consolidate into LLM-generated summaries.


    Core Tools

    Start with three — memory_write, memory_search, and memory_update — that covers 90% of daily use. The rest is there when you need it.

    Tool What it does
    memory_write Store a memory — facts, decisions, preferences, configs, observations
    memory_search Retrieve relevant memories using hybrid search
    memory_suggest Same as search, with full score breakdown (vector, BM25, MMR)
    memory_get Fetch a specific memory by ID
    memory_update Refine existing knowledge — content, title, metadata, importance

    Full list of all 25 tools


    How It Compares

    Feature M3-Memory Mem0 Letta LangChain Memory
    Local-first ✅ 100% ⚠️ partial ✅ good ⚠️ partial
    MCP native ✅ 25 tools ⚠️ wrappers ⚠️ indirect ❌ no
    Contradiction handling ✅ automatic ⚠️ LLM-based ⚠️ agent-driven ⚠️ manual
    GDPR tools ✅ built-in ⚠️ supported ⚠️ via tools ❌ custom
    Cross-device sync ✅ built-in ⚠️ limited ⚠️ git-based ⚠️ limited
    Setup ✅ 1 line ⚠️ SDK needed ❌ full runtime ❌ framework only
    Cost ✅ free, MIT ⚠️ $249/mo Pro ⚠️ OSS + SaaS ✅ free

    Architecture

    graph TD
        subgraph "AI Agents"
            C[Claude Code]
            G[Gemini CLI]
            A[Aider / OpenClaw]
        end
    
        subgraph "MCP Bridge"
            MB[memory_bridge.py — 25 MCP tools]
        end
    
        subgraph "Storage Layers"
            SQ[(SQLite — Local L1)]
            PG[(PostgreSQL — Sync L2)]
            CH[(ChromaDB — Federated L3)]
        end
    
        C & G & A <--> MB
        MB <--> SQ
        SQ <-->|Bi-directional Delta Sync| PG
        SQ <-->|Push/Pull| CH
    
    Loading
    Memory Write Pipeline
    sequenceDiagram
        participant A as Agent
        participant M as M3 Memory
        participant L as Local LLM
        participant S as SQLite
    
        A->>M: memory_write(content)
        M->>M: Safety Check (XSS / injection / poisoning)
        M->>L: Generate Embedding
        L-->>M: Vector [0.12, -0.05, ...]
        M->>M: Contradiction Detection
        M->>M: Auto-Link Related Memories
        M->>M: SHA-256 Content Hash
        M->>S: Store Memory + Vector
        S-->>M: Success
        M-->>A: Created: <uuid>
    
    Loading

    See It in Action

    Contradiction Resolution

    Agent writes two conflicting facts — the old one is automatically superseded:

    Demo: automatic contradiction detection and resolution

    Hybrid Search with Score Breakdown

    FTS5 keyword + semantic vector + MMR diversity re-ranking — with full explainability:

    Demo: hybrid search with FTS5, vector, and MMR score breakdown

    Cross-Device Sync

    Write a memory on your MacBook, search it on your Windows desktop — no cloud:

    Demo: cross-device memory sync between MacBook and Windows

    Have a real recording to share? See CONTRIBUTING.md or post in #showcase on Discord.


    Documentation

    File Purpose
    QUICKSTART.md New here? Start here
    CORE_FEATURES.md Feature overview
    ARCHITECTURE.md Full system internals + all 25 MCP tools
    TECHNICAL_DETAILS.md Search pipeline, schema, sync, security
    COMPARISON.md M3 vs Mem0 vs Letta vs LangChain vs Zep
    ENVIRONMENT_VARIABLES.md Config and credential setup
    ROADMAP.md Upcoming milestones
    CHANGELOG.md Release history
    CONTRIBUTING.md How to contribute
    GOOD_FIRST_ISSUES.md Good first issues

    Community

    DiscordGet help, share your setup, and follow development. M3_Bot is live — use !ask <question> in any channel.


    Milestone Highlights
    v0.2 Docker image, auto MCP Registry, CLI polish
    v0.3 Local web dashboard, Prometheus metrics, search explain mode
    v0.4 Multi-agent shared namespaces, P2P encrypted sync
    v1.0 Public benchmark suite, stable Python SDK, full docs site

    Vote on features in ROADMAP.md


    Project Structure

    bin/          MCP bridge, core engine, sync, and maintenance scripts
    m3_memory/    Python package — CLI entry point (mcp-memory)
    memory/       SQLite database and migrations
    docs/         Architecture diagrams and install guides
    examples/     Demo notebooks and ready-to-paste mcp.json configs
    tests/        End-to-end test suite (41 tests)
    

    Next Steps

    1. Star the repo — helps others find it
    2. Try a real session — install, write a memory, close your agent, reopen it, and search
    3. Share feedback — what worked, what didn't
    4. Open an issue — bugs, questions, feature requests
    5. Contribute — good first issues listed

    Contributing

    See CONTRIBUTING.md | Good first issues: GOOD_FIRST_ISSUES.md


    Star History Chart

    Your AI should remember. Your data should stay yours.

    M3 Memory: the foundation for agents that don't forget.

    Release History

    VersionChangesUrgencyDate
    v2026.6.1.0Faster, more resilient, more efficient and more robust while maintaining backward compatibility. FIPS 140-3 ready. Local first, cloud capable memory engine.High6/1/2026
    v2026.5.30.0## Entity coalescing v2 (reversible apply/unapply) + catalog registration + CLI exit-code fix ### Added - **Entity-coalescing v2 — reversible overlay apply/unapply** (`files_entity_coalesce_apply` / `files_entity_coalesce_unapply` MCP tools; `entity-coalesce-apply` / `entity-coalesce-unapply` CLI). Materializes reviewed/auto-merge candidates as a reversible `same_as` + shared-`cluster_id` overlay — members are never deleted, the canonical view is a read-time projection, a deterministic represeHigh5/30/2026
    v2026.5.21.0## v2026.5.21.0 — green-CI maintenance release First release on fully-green CI (Lint, Type Check, Security, and Tests on ubuntu/macos/windows all passing). ### Fixes - **F821 undefined-name errors (30)** — the Phase 7+8 modularization left dangling symbol references in `memory/write.py`, `search.py`, `enrich.py`; restored the missing imports and re-exports. - **Mypy type errors (64)** — resolved across `bin/`: missing `memory_core` re-exports, `m3_core_rs` typing, exception-base annotations, hHigh5/21/2026
    v2026.5.18.1**Full Changelog**: https://github.com/skynetcmd/m3-memory/compare/v2026.5.18.0...v2026.5.18.1High5/18/2026
    v2026.5.6.3## Highlights - **GitHub Actions Node-24 upgrade.** Pins every workflow action to its latest Node-24-compatible release-tag SHA so CI keeps working past GitHub's Node 20 removal on 2026-09-16. | action | from | to | | --- | --- | --- | | `actions/checkout` | v4 | **v6.0.2** | | `actions/setup-python` | v5 | **v6.2.0** | | `actions/upload-artifact` | v4 | **v7.0.1** | | `actions/download-artifact` | v4 | **v8.0.1** | - **New banner art** at `docs/M3-banner.jpg`. ## Migration notes Major-versHigh5/7/2026
    v2026.5.1.1## Highlights This release rolls up roughly five weeks of ingest-pipeline work plus a documentation, hygiene, and security pass. - **Tool count: 66 → 72.** Six new MCP tools: `entity_search`, `entity_get`, `extract_pending`, `enrich_pending`, `memory_search_routed`, `memory_write_from_file`. See [`docs/MCP_TOOLS.md`](https://github.com/skynetcmd/m3-memory/blob/main/docs/MCP_TOOLS.md). - **`bin/m3_enrich.py` CLI** — first-class user-facing enrichment over the Observer/Reflector pipeline. DurablHigh5/1/2026
    v2026.4.24.12## Two pain points caught testing the plugin on Windows ### Plugin commands now self-resolve Caught when `/m3:doctor` ran on Windows: `pip install --user m3-memory` puts `mcp-memory.exe` at `%APPDATA%\Python\Python<NN>\Scripts`, which is **not** on Windows PATH by default. The plugin command had Claude spelunking through 8 fallback paths before finding `python -m m3_memory.cli` works. `/m3:doctor`, `/m3:status`, and `/m3:install` now explicitly list the resolver chain in their command bodies:High4/25/2026
    v2026.4.20## Fixes - Resolve SQLite deadlock in `memory_consolidate` via connection reuse in `memory_link_impl` - Resolve database contention and sync hangs on large DBs (migration timeout bump, SAVEPOINT-wrapped pg_sync, VACUUM skip for >500MB DBs, WAL contention fix in `record_history`) ## Features - `memory_search` gains `recency_bias` (float) and `adaptive_k` (bool) params - `conversation_search` auto-pairs user turns with adjacent assistant replies (0.85x score) - `precedes` / `follows` added to `VAHigh4/17/2026
    v2026.4.19Fix PyPI rendering: absolute URLs for all links and images, markdown banner fallback, incorporate doc edits.High4/16/2026
    v2026.4.18Fix PyPI page rendering: banner image, absolute links, demo SVGs.High4/16/2026
    v2026.4.17Docs-only release: Unicode emoji rendering fix for PyPI page. All markdown files now use Unicode emoji characters instead of GitHub `:shortcode:` syntax, which PyPI's renderer doesn't support.High4/16/2026
    v2026.4.16## What's new since v2026.4.8 - **46 MCP tools** (was 25) — added agent registry, handoffs, task trees, notifications, scoped memory - **89% on LongMemEval-S** (445/500) — full writeup with methodology and caveats in `benchmarks/longmemeval/README.md` - **Multi-agent orchestration** — coordinate multiple agents on shared local memory with built-in handoffs, inbox, and task assignment - **Conversation grouping** — `conversation_id` on write/search/update for session-aware retrieval - **Refresh lHigh4/16/2026
    v2026.4.6## What's New M3 Memory is a local-first agentic memory layer for MCP agents — 25 tools, hybrid search (FTS5 + vector + MMR), contradiction detection, cross-device sync, GDPR-ready, 100% local. ## Install ```bash pip install m3-memory ``` Or clone for development: ```bash git clone https://github.com/skynetcmd/m3-memory.git cd m3-memory pip install -r requirements.txt ``` ## Highlights - **25 MCP tools** — write, search, link, graph, verify, sync, export, and more - **Hybrid search** — FTHigh4/10/2026
    v1.0.03![icon](https://github.com/user-attachments/assets/9c1dd45f-2bbd-498e-ae2d-0bef4204b2cb) Intelligent Agentic Memory Most agent memory systems solve one problem well — vector search, or persistence, or multi-tenancy. M3 Memory solves all of them in a single, tested, local-first package that runs on your hardware without sending a byte to the cloud. *Here's how it actually gets used.* You're working on your MacBook at a coffee shop, asking Claude to debug a deployment issue. It remembersMedium4/7/2026

    Dependencies & License Audit

    Loading dependencies...

    Similar Packages

    zotero-mcp-lite🚀 Run a high-performance MCP server for Zotero, enabling customizable workflows without cloud dependency or API keys.main@2026-06-01
    sqltools_mcp🔌 Access multiple databases seamlessly with SQLTools MCP, a versatile service supporting MySQL, PostgreSQL, SQL Server, DM8, and SQLite without multiple servers.main@2026-06-07
    claude-code-configClaude Code skills, architectural principles, and alternative approaches for AI-assisted developmentmain@2026-06-06
    antigravity-awesome-skills🌌 Explore 255+ essential skills for AI coding assistants like Claude Code and GitHub Copilot to enhance your development workflow.main@2026-06-05
    mcp-videoVideo editing MCP server for AI agents. 83 tools, 858 tests collected, 3 interfaces. Works with Claude Code, Cursor, and any MCP client. Local, fast, free.v1.5.1

    More in MCP Servers

    PlanExeCreate a plan from a description in minutes
    agentroveYour own Claude Code UI, sandbox, in-browser VS Code, terminal, multi-provider support (Anthropic, OpenAI, GitHub Copilot, OpenRouter), custom skills, and MCP servers.
    ProxmoxMCP-PlusEnhanced Proxmox MCP server with advanced virtualization management and full OpenAPI integration.
    node9-proxyThe Execution Security Layer for the Agentic Era. Providing deterministic "Sudo" governance and audit logs for autonomous AI agents.