Mem0 MCP Server
A Model Context Protocol (MCP) server that provides memory capabilities using Mem0, backed by local Postgres (graph store) and Qdrant (vector store).
Features
Tools:
add_memory,add_fact,search_memories,get_all_memories,database_historyStorage: Local Postgres (Graph) & Qdrant (Vector)
Transport: Supports both
stdio(local) andsse(remote/docker)Deployment: Ready for Docker Compose and GitHub Actions
Prerequisites
Docker & Docker Compose
Python 3.12+ (for local development)
Quick Start (Docker)
The easiest way to run the full stack (Database + MCP Server) is via Docker Compose:
Configure Environment
cp .env.example .env # Edit .env to add your OPENAI_API_KEY if neededStart Services
# Starts Postgres, Qdrant, and the MCP Server (SSE mode on port 8000) docker-compose -f docker-compose.mem0.yml up -d --buildConnect Client
The server runs in SSE mode on port
8000.SSE Endpoint:
http://localhost:8000/sse
Local Development (Python)
If you want to run the server code locally while keeping databases in Docker:
Start Databases Only
docker-compose -f docker-compose.mem0.yml up -d db qdrantInstall Dependencies
python -m venv .venv source .venv/bin/activate # or .venv\Scripts\activate on Windows pip install .Run Server
Stdio Mode (Default, for use with local MCP clients like Claude Desktop):
python src/main.pySSE Mode (Network accessible):
export MCP_TRANSPORT=sse python src/main.py # Server lists on 0.0.0.0:8000
Deployment
The repository includes a GitHub Actions workflow (.github/workflows/deploy.yml) to deploy to a remote server (e.g., 192.168.254.202).
DB Deploy: Deploys
dbandqdrantservices.App Deploy: Deploys the
mcp-servercontainer in SSE mode, mapping port8000.
Configuration
Variable | Description | Default |
| Postgres Username |
|
| Postgres Password |
|
| Database Name |
|
| Qdrant Host |
|
| Server Transport (
or
) |
|
| (Optional) For OpenAI Embeddings | - |
Tools
add_memory(content, user_id, metadata): Stores a user message.add_fact(content, user_id, metadata): Stores a specific fact (tagged withtype: fact).search_memories(query, user_id, limit): Semantic search for relevant memories.get_all_memories(user_id, limit): Retrieves all stored memories for a specific user.