Skip to main content
Prerequisites
  • Mem0 Platform account (Sign up here)
  • API key (Get one from dashboard)
  • Python 3.10+, Docker, or Node.js 14+
  • An MCP-compatible client (Claude Desktop, Cursor, or custom agent)

What is Mem0 MCP?

Mem0 MCP Server exposes Mem0’s memory capabilities as MCP tools, letting AI agents decide when to save, search, or update information.

Deployment Options

Choose from three deployment methods:
  1. Python Package (Recommended) - Install locally with uvx for instant setup
  2. Docker Container - Isolated deployment with HTTP endpoint
  3. Smithery - Remote hosted service for managed deployments

Available Tools

The MCP server exposes these memory tools to your AI client:
ToolDescription
add_memorySave text or conversation history for a user/agent
search_memoriesSemantic search across existing memories with filters
get_memoriesList memories with structured filters and pagination
get_memoryRetrieve one memory by its memory_id
update_memoryOverwrite a memory’s text after confirming the ID
delete_memoryDelete a single memory by memory_id
delete_all_memoriesBulk delete all memories in scope
delete_entitiesDelete a user/agent/app/run entity and its memories
list_entitiesEnumerate users/agents/apps/runs stored in Mem0

Quickstart with Python (UVX)

1

Install the MCP Server

uv pip install mem0-mcp-server
2

Configure your MCP client

Add this to your MCP client (e.g., Claude Desktop):
{
  "mcpServers": {
    "mem0": {
      "command": "uvx",
      "args": ["mem0-mcp-server"],
      "env": {
        "MEM0_API_KEY": "m0-...",
        "MEM0_DEFAULT_USER_ID": "your-handle"
      }
    }
  }
}
Set your environment variables:
export MEM0_API_KEY="m0-..."
export MEM0_DEFAULT_USER_ID="your-handle"
3

Test with the Python agent

# Clone the mem0-mcp repository
git clone https://github.com/mem0ai/mem0-mcp.git
cd mem0-mcp

# Set your API keys
export MEM0_API_KEY="m0-..."
export OPENAI_API_KEY="sk-openai-..."

# Run the interactive agent
python example/pydantic_ai_repl.py
Sample Interactions:
User: Remember that I love tiramisu
Agent: Got it! I've saved that you love tiramisu.

User: What do you know about my food preferences?
Agent: Based on your memories, you love tiramisu.

User: Update my project: the mobile app is now 80% complete
Agent: Updated your project status successfully.
4

Verify the setup

Your AI client can now:
  • Automatically save information with add_memory
  • Search memories with search_memories
  • Update memories with update_memory
  • Delete memories with delete_memory
If you get “Connection failed”, ensure your API key is valid and the server is running.

Quickstart with Docker

1

Build the Docker image

docker build -t mem0-mcp-server https://github.com/mem0ai/mem0-mcp.git
2

Run the container

docker run --rm -d \
  --name mem0-mcp \
  -e MEM0_API_KEY="m0-..." \
  -p 8080:8081 \
  mem0-mcp-server
3

Configure your client for HTTP

For clients that connect via HTTP (instead of stdio):
{
  "mcpServers": {
    "mem0-docker": {
      "command": "curl",
      "args": ["-X", "POST", "http://localhost:8080/mcp", "--data-binary", "@-"],
      "env": {
        "MEM0_API_KEY": "m0-..."
      }
    }
  }
}
4

Verify the setup

# Check container logs
docker logs mem0-mcp

# Test HTTP endpoint
curl http://localhost:8080/health
The container should start successfully and respond to HTTP requests. If port 8080 is occupied, change it with -p 8081:8081.

Quickstart with Smithery (Hosted)

For the simplest integration, use Smithery’s hosted Mem0 MCP server - no installation required. Example: One-click setup in Cursor
  1. Visit smithery.ai/server/@mem0ai/mem0-memory-mcp and select Cursor as your client
Smithery Mem0 MCP Configuration
  1. Open Cursor → Settings → MCP
  2. Click mem0-mcp → Initiate authorization
  3. Configure Smithery with your environment:
    • MEM0_API_KEY: Your Mem0 API key
    • MEM0_DEFAULT_USER_ID: Your user ID
    • MEM0_ENABLE_GRAPH_DEFAULT: Optional, set to true for graph memories
  4. Return to Cursor settings and wait for tools to load
  5. Start chatting with Cursor and begin storing preferences
For other clients: Visit smithery.ai/server/@mem0ai/mem0-memory-mcp to connect any MCP-compatible client with your Mem0 credentials.

Quick Recovery

  • “uvx command not found” → Install with pip install uv or use pip install mem0-mcp-server instead. Make sure your Python environment has uv installed (or system-wide).
  • “Connection refused” → Check that the server is running and the correct port is configured
  • “Invalid API key” → Get a new key from Mem0 Dashboard
  • “Permission denied” → Ensure Docker has access to bind ports (try with sudo on Linux)

Next Steps

Additional Resources