Skip to main content
Glama

mem0-mcp-local-docker

A self-hosted Mem0 MCP server adapted from the official mem0-mcp to run entirely on your own infrastructure using Docker containers (PostgreSQL with pgvector + Neo4j).

The official server connects to Mem0's cloud API via MemoryClient. This fork replaces it with the local Memory class, pointing to your own Postgres and Neo4j instances.

Prerequisites

  • Docker & Docker Compose

  • Python >= 3.10

  • An OpenAI API key (used by Mem0 internally for embeddings and LLM)

Related MCP server: Memoria

Architecture

┌─────────────────────────────────┐
│  MCP Client (OpenCode, Claude)  │
└──────────────┬──────────────────┘
               │ stdio
┌──────────────▼──────────────────┐
│     mem0-mcp-server (Python)    │
│  src/mem0_mcp_server/server.py  │
└──┬───────────────────────────┬──┘
   │                           │
┌──▼─────────────┐  ┌─────────▼──────────┐
│  PostgreSQL    │  │      Neo4j         │
│  (pgvector)    │  │  (graph store)     │
│  port: 8432    │  │  port: 8687        │
└────────────────┘  └────────────────────┘

Setup

1. Clone and configure

git clone https://github.com/materializerx/mem0-mcp-local-docker.git
cd mem0-mcp-local-docker
cp .env.example .env

Edit .env and set your OPENAI_API_KEY. The other defaults match the included docker-compose.yml.

2. Start backing services

docker compose up -d

This starts PostgreSQL (pgvector) on port 8432 and Neo4j on port 8687. Both are configured with restart: unless-stopped so they survive reboots.

Wait for healthy status:

docker compose ps

3. Install dependencies

uv sync
# or
pip install -e .

4. Run the server

uv run mem0-mcp-server
# or
python -m mem0_mcp_server.server

The server runs over stdio by default (for MCP client integration).

MCP Client Configuration

OpenCode (oh-my-opencode.json)

{
  "mcp": {
    "mem0": {
      "type": "stdio",
      "command": "/path/to/mem0-mcp/.venv/bin/python",
      "args": ["-m", "mem0_mcp_server.server"],
      "env": {
        "OPENAI_API_KEY": "sk-...",
        "MEM0_DEFAULT_USER_ID": "sisyphus",
        "MEM0_ENABLE_GRAPH_DEFAULT": "true"
      }
    }
  }
}

Claude Desktop

{
  "mcpServers": {
    "mem0": {
      "command": "uvx",
      "args": ["mem0-mcp-server"],
      "env": {
        "OPENAI_API_KEY": "sk-...",
        "MEM0_DEFAULT_USER_ID": "your-handle",
        "MEM0_ENABLE_GRAPH_DEFAULT": "true"
      }
    }
  }
}

Tools

Tool

Description

add_memory

Store a preference, fact, or conversation snippet

search_memories

Semantic search over existing memories

get_memories

List memories with filters and pagination

get_memory

Fetch a single memory by ID

update_memory

Overwrite a memory's text

delete_memory

Delete a single memory

delete_all_memories

Bulk delete all memories in a scope

delete_entities

Remove a user/agent/run and cascade-delete its memories

Key Differences from Official

Aspect

Official (mem0ai/mem0-mcp)

This Fork

Backend

Mem0 Cloud API (MemoryClient)

Local Memory class

Vector Store

Mem0 Cloud

Self-hosted PostgreSQL + pgvector

Graph Store

Mem0 Cloud

Self-hosted Neo4j

LLM

Mem0 Cloud

OpenAI API (configurable model)

Embedder

Mem0 Cloud

OpenAI text-embedding-3-small

Auth

MEM0_API_KEY

OPENAI_API_KEY + DB credentials

list_entities

Supported

Not available (returns error)

License

Apache License 2.0

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Self-hosted Mem0 MCP server integrating Qdrant, Neo4j, and Ollama for semantic memory search, graph entity relationships, and memory management via OpenMemory API.
      6
      4
      MIT
    • A
      license
      Not graded
      quality
      F
      maintenance
      A self-hosted memory backend for MCP clients, providing tools for storing, searching, updating, and deleting memories with per-user scoping and OIDC support.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Provides AI agents and teams with self-hosted adaptive memory, combining hybrid search and a self-improving neural memory graph to enable precise recall and serendipitous discovery across MCP-compatible clients.
      14
      Apache 2.0