Self-hosted MCP server exposing Mem0 v2 for long-term agent memory

Self-hosted MCP server exposing Mem0 v2 for long-term agent memory

mem0-mcp-server-olk•byolk

A self-hosted Model Context Protocol server that connects AI agents to Mem0's persistent memory storage with semantic search, multi-tenant isolation, and stdio or SSE transports.

License: Not specified•Runtime: Awaiting documentation review•Category: ai agents-models

WHAT IT DOES

  • •Adds a memory to long-term storage with semantic indexing via the add_memory tool.
  • •Searches stored memories using semantic similarity through the search_memories tool.
  • •Supports retrieving, updating, deleting, and listing memories with filtering and pagination.
  • •Isolates memory per user, agent, and session for multi-tenant use.

BEST FOR

  • •AI agents that need to retain context across conversations and sessions.
  • •Users who want local agents connected via stdio or remote connections via SSE.

ABOUT MEM0-MCP-SERVER-OLK

Self-hosted MCP server exposing Mem0 v2 for long-term agent memory is cataloged as an MCP server attributed to olk. A self-hosted Model Context Protocol server that connects AI agents to Mem0's persistent memory storage with semantic search, multi-tenant isolation, and stdio or SSE transports. It is categorized under ai agents-models. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: Not specified. Check the source repository's current license and terms before using, modifying or distributing this software.

Capability inspector

Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.

Tools (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Resources (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Prompts (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Self-hosted MCP server exposing Mem0 v2 for long-term agent memory are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

What memory tools does the server expose?

It provides add_memory, search_memories, get_memory, update_memory, delete_memory, and list_memories.

Which transports are supported?

Stdio for local agents and SSE for remote connections.

Upstream README

View this exact version on GitHub

README.md · 366442fc8003 · Fetched 2026-11-13 11:23:55 UTC

Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.

Showing the last retrieved documentation snapshot; check the source for current changes.

mem0-mcp-server

MCP server exposing Mem0 v2 API for AI agents to store, retrieve, and search long-term memories using semantic search through the standardized MCP protocol.

Overview

Mem0-MCP Server is a self-hosted MCP (Model Context Protocol) server that bridges AI agents with persistent memory storage. It enables intelligent context retention across conversations and sessions using Mem0's AsyncMemory API.

Key Features:

  • MCP Protocol Integration - Exposes Mem0 functionality via MCP tools
  • Semantic Memory Search - Similarity-based memory retrieval with vector search
  • Multi-Tenant Isolation - User/Agent/Session scoped memory isolation
  • Flexible Transport - stdio for local agents, SSE for remote connections
  • Configuration Management - Pydantic-based validation with environment variable support

Documentation

SectionDescription
API ReferenceComplete API documentation for all modules and tools
Pattern GuidesDesign pattern documentation (Singleton, Repository, etc.)
Usage ExamplesGetting started and advanced usage guides
DeploymentDocker Compose configuration and service details
ArchitectureSystem architecture and component interactions

Quick Start

Installation

# Clone and install
git clone https://github.com/your-org/mem0-mcp-server.git
cd mem0-mcp-server
uv sync

# Set environment variables
export OPENAI_API_KEY="your-api-key"

Configuration

Create ~/.config/mem0-mcp-server/settings.json:

{
  "vector_store": {
    "provider": "redis",
    "config": {
      "redis_url": "redis://localhost:6379"
    }
  },
  "llm": {
    "provider": "openai",
    "config": {
      "model": "gpt-4o"
    }
  },
  "embedder": {
    "provider": "openai",
    "config": {
      "model": "text-embedding-3-small"
    }
  }
}

Running the Server

# SSE Transport (remote connections)
uv run python -m mcp_server.main

# stdio Transport (local AI agents)
export MCP_TRANSPORT=stdio
uv run python -m mcp_server.main

OpenCode Configuration

In ~/config/opencode/opencode.json

OpenCode Configuration

In ~/config/opencode/opencode.json

	"mcp": {
		"mem0": {
			"type": "remote",
			"enabled": true,
			"url": "http://localhost:8050/sse"
		}
    }

MCP Tools

ToolDescription
add_memoryStore information in long-term memory with semantic indexing
search_memoriesSearch memories using semantic similarity
get_memoryRetrieve specific memory by ID
update_memoryUpdate existing memory content
delete_memoryRemove memory from storage
list_memoriesList memories with filtering and pagination

Usage Example

# Add memory
result = await client.call_tool("add_memory", {
    "messages": [{"role": "user", "content": "I prefer dark mode"}],
    "user_id": "alice"
})

# Search memories
result = await client.call_tool("search_memories", {
    "query": "theme preferences",
    "filters": {"user_id": "alice"},
    "limit": 5
})

Architecture

AI Agent → FastMCP Server → MemoryManager → Mem0 AsyncMemory → Redis
              │                                  │
              ├── SafeLogger (stdout/stderr)     │
              ├── Transport (stdio/SSE)          │
              └── Config (Pydantic validation)   │

Components:

  • COMP-1: ConfigLoader - Configuration loading and validation
  • COMP-2: FastMCP Server - MCP protocol server
  • COMP-3: MemoryManager - Memory operations with multi-tenant isolation
  • COMP-4: MCP Tools - Tool definitions
  • COMP-5: SafeLogger - Output stream separation

Configuration

Parameter Precedence

Configuration values are resolved in order:

  1. Tool parameters (direct)
  2. Environment variables (with MCP_ prefix)
  3. Config file values
  4. Hardcoded defaults

Environment Variables

VariableDefaultDescription
OPENAI_API_KEY(required)OpenAI API key for LLM
MCP_TRANSPORTsseTransport type (stdio, sse)
MCP_HOST0.0.0.0Server bind address
MCP_PORT8080Server bind port

Deployment

Docker

# Using docker-compose
docker-compose up -d

# Using Makefile
make docker-up      # Start services with docker compose
make docker-down    # Stop services
make docker-logs    # Show logs

Services:

ServiceDescription
mem0-mcpMCP server exposing Mem0 API on port 8050
ollama-qwen3-embeddingOllama with qwen3-embedding:8b for vector embeddings (port 11434)
ollama-qwenOllama with qwen2.5:7b for chat completions (port 11435)

See Deployment → Docker for detailed configuration.

Kubernetes

# Using Helm chart
helm install mem0-mcp ./charts/mem0-mcp-server

Development

CommandDescription
make installInstall dependencies with uv
make lintLint code with ruff
make lint-fixAuto-fix linting issues
make typecheckType check with pyright
make testRun all tests
make test-unitRun unit tests only
make test-coverageRun tests with coverage report
make buildBuild Docker image
make runRun development server

Run multiple commands: make install && make lint && make typecheck && make test

See Makefile for all available commands including Docker management (docker-up, docker-down, docker-logs, etc.).

Project Structure

mem0-mcp/
├── src/mcp_server/
│   ├── __init__.py          # FastMCP singleton
│   ├── lifespan.py          # Resource lifecycle
│   ├── transport.py         # Transport selection
│   ├── memory/
│   │   ├── manager.py        # MemoryManager
│   │   └── lifespan.py       # AsyncMemory lifecycle
│   ├── config/
│   │   ├── settings.py       # Pydantic models
│   │   └── loader.py        # Config file loading
│   ├── tools/
│   │   ├── add_memory.py
│   │   ├── search_memories.py
│   │   └── ...
│   └── utils/
│       └── safe_logger.py   # Output separation
├── doc/
│   ├── api/                 # API reference
│   ├── patterns/            # Pattern guides
│   ├── examples/            # Usage examples
│   └── architecture/        # Architecture docs
├── tests/
├── Makefile
├── Dockerfile
└── docker-compose.yml

License

MIT License

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Self-hosted MCP server exposing Mem0 v2 for long-term agent memory from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/mem0-mcp-server-olk)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

Downloads and pulls

Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.

No reviewed package or image identity; download statistics are not listed yet.

Related ai agents-models MCP Servers

Alternative and complementary servers in the same category

View all in ai agents-models →
Knowledge Graph Memory
@modelcontextprotocol/server-memory•Model Context Protocol

Store and retrieve entities, relations and observations in a persistent local knowledge graph.

create_entitiescreate_relationsadd_observations+6 more
92K
AI & Multi-Agent
Sequential Thinking
@modelcontextprotocol/server-sequential-thinking•Model Context Protocol

Organize problem solving into revisable, branching thought steps through an MCP tool.

sequential_thinking
92K
AI & Multi-Agent

Query-aware context compression with an MCP plugin for coding agents, plus Python and HTTP interfaces for reducing the context sent to a language model.

146
AI & Multi-Agent