Skip to main content
Glama
mem0-local-mcp

mem0-local-mcp

by ShmuelOps

mem0-local-mcp

CI License: MIT

Long-term, semantic memory for Claude Code (or any MCP client), powered by mem0, and running entirely on your machine.

  • No API key. No OpenAI, no mem0 cloud account.

  • No local LLM needed. Your agent (e.g. Claude) decides what's worth remembering. mem0 handles storage, embeddings, and semantic search.

  • Light. Embeddings run through FastEmbed (ONNX, no PyTorch). The default model is ~67 MB and is downloaded once.

  • Private. Memories are stored in a local Chroma DB. mem0 telemetry is disabled.

How it works

Claude Code ──MCP (stdio)──▶ mem0-local-mcp ──▶ mem0 ──▶ FastEmbed (local embeddings)
                                                     └─▶ Chroma (~/.mem0-local-mcp)

The server exposes three tools:

Tool

What it does

add_memory(text)

Stores one fact verbatim and returns its id

search_memory(query, limit=5)

Runs a semantic search and returns id: memory lines

delete_memory(memory_id)

Removes a stale or wrong memory

Related MCP server: mcp-memory

Requirements

  • uv

  • Python 3.10+ (uv can install it for you)

Install in Claude Code

claude mcp add mem0 -s user -- \
  uvx --from git+https://github.com/ShmuelOps/mem0-local-mcp mem0-local-mcp

-s user makes the memory available in every project. Use -s project to share the config through .mcp.json, or -s local for the current project only.

Verify:

claude mcp list        # mem0: ... ✔ Connected

The first start downloads the dependencies and the embedding model, so it can take a minute. Later starts take a few seconds.

Tell Claude when to use it

Add this to ~/.claude/CLAUDE.md (global) or to a project's CLAUDE.md:

## Long-term memory (mem0 MCP)
- At the start of a non-trivial task, call `search_memory` with the task topic.
- When you learn a durable fact (user preference, project decision, gotcha), `search_memory`
  first, then `add_memory` one concise sentence if it's new.
- `delete_memory` entries that turn out wrong or stale.

Other MCP clients

Any client that speaks MCP over stdio works. For example, Claude Desktop's claude_desktop_config.json:

{
  "mcpServers": {
    "mem0": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/ShmuelOps/mem0-local-mcp", "mem0-local-mcp"]
    }
  }
}

Configuration

All configuration is optional and set through environment variables. With claude mcp add, pass them as -e KEY=value.

Variable

Default

Purpose

MEM0_USER

default

Memory namespace. Use different values to keep separate memory sets

MEM0_DATA_DIR

~/.mem0-local-mcp

Where the Chroma DB and history are stored

MEM0_EMBED_MODEL

BAAI/bge-small-en-v1.5

Any FastEmbed-supported model

Example with a per-project namespace:

claude mcp add mem0 -s project -e MEM0_USER=my-project -- \
  uvx --from git+https://github.com/ShmuelOps/mem0-local-mcp mem0-local-mcp

Changing MEM0_EMBED_MODEL after you've stored memories requires a fresh MEM0_DATA_DIR, because vectors from different models are not compatible.

Data & privacy

  • Everything is stored in MEM0_DATA_DIR. Delete that directory to wipe all memories.

  • The only network access is the one-time download of packages and the embedding model.

  • mem0 telemetry is turned off (MEM0_TELEMETRY=False).

Troubleshooting

Symptom

Fix

claude mcp list shows a timeout on first run

The first launch is still downloading. Run the uvx ... command once in a terminal, then retry

Duplicate memories

This happens because infer=False skips mem0's LLM dedup. Keep the "search first" instruction in CLAUDE.md

Want to wipe everything

rm -rf ~/.mem0-local-mcp

Development

git clone https://github.com/ShmuelOps/mem0-local-mcp && cd mem0-local-mcp
uv sync
uv run pytest          # real end-to-end tests: mem0 + Chroma + FastEmbed, no mocks
uv run ruff check . && uv run ruff format --check .

Run the server from source:

claude mcp add mem0-dev -- uv run --directory "$PWD" mem0-local-mcp

See CONTRIBUTING.md.

License

MIT

Available Tools

3 tools
add_memoryA

Store one concise, durable fact worth remembering across sessions.

Search first to avoid duplicates. Returns the new memory id.

Inputs: text (required). Returns: result

delete_memoryB

Delete a stale or wrong memory by id.

Inputs: memory_id (required). Returns: result

search_memoryB

Semantic search over long-term memory. Returns one 'id: memory' per line.

Inputs: query (required), limit. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 3 tools

    Disambiguation5/5

    The three tools map to clearly distinct operations: add_memory (create), search_memory (read/query), and delete_memory (remove). Descriptions reinforce the boundaries, e.g. add_memory explicitly tells the agent to search first, eliminating overlap.

    Naming Consistency5/5

    All three tools follow the identical verb_noun pattern (add_memory, search_memory, delete_memory) with the same noun for the resource. This is a textbook consistent naming scheme.

    Tool Count5/5

    Three tools is a tight, well-scoped surface for a simple local long-term memory store. Each tool earns its place with no redundancy or filler.

    Completeness4/5

    Create, query, and delete cover the core memory lifecycle, and semantic search serves as retrieval. An explicit update/edit tool and a get-by-id or list operation are missing, though delete+add can work around the gap.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      A
      maintenance
      Provides persistent memory for AI coding agents via MCP, enabling agents to store and semantically recall facts, events, and lessons across sessions, all running locally without cloud dependencies.
      Apache 2.0
    • A
      license
      A
      quality
      D
      maintenance
      Provides persistent memory with semantic search for MCP-based AI agents, enabling them to store and recall information across sessions using vector embeddings.
      4
      1
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Provides persistent, searchable memory for AI agents across any MCP-compatible client, storing project context, user preferences, and session learnings locally in SQLite with tools to save, retrieve, search, and manage them.
      12
      MIT