Mem0 MCP Server

Mem0 MCP Server

Enables AI applications to add, search, update, and delete long-term memories using the Mem0 Memory API, allowing agents to persistently remember user preferences, conversation history, and contextual information across sessions.

Category
访问服务器

README

Mem0 MCP Server

PyPI version License: Apache 2.0

mem0-mcp-server wraps the official Mem0 Memory API as a Model Context Protocol (MCP) server so any MCP-compatible client (Claude Desktop, Cursor, custom agents) can add, search, update, and delete long-term memories.

Tools

The server exposes the following tools to your LLM:

Tool Description
add_memory Save text or conversation history (or explicit message objects) for a user/agent.
search_memories Semantic search across existing memories (filters + limit supported).
get_memories List memories with structured filters and pagination.
get_memory Retrieve one memory by its memory_id.
update_memory Overwrite a memory's text once the user confirms the memory_id.
delete_memory Delete a single memory by memory_id.
delete_all_memories Bulk delete all memories in the confirmed scope (user/agent/app/run).
delete_entities Delete a user/agent/app/run entity (and its memories).
list_entities Enumerate users/agents/apps/runs stored in Mem0.

All responses are JSON strings returned directly from the Mem0 API.

Usage Options

There are three ways to use the Mem0 MCP Server:

  1. Python Package - Install and run locally using uvx with any MCP client
  2. Docker - Containerized deployment that creates an /mcp HTTP endpoint
  3. Smithery - Remote hosted service for managed deployments

Quick Start

Installation

uv pip install mem0-mcp-server

Or with pip:

pip install mem0-mcp-server

Client Configuration

Add this configuration to your MCP client:

{
  "mcpServers": {
    "mem0": {
      "command": "uvx",
      "args": ["mem0-mcp-server"],
      "env": {
        "MEM0_API_KEY": "sk_mem0_...",
        "MEM0_DEFAULT_USER_ID": "your-handle"
      }
    }
  }
}

Test with the Python Agent

<details> <summary><strong>Click to expand: Test with the Python Agent</strong></summary>

To test the server immediately, use the included Pydantic AI agent:

# Install the package
pip install mem0-mcp-server
# Or with uv
uv pip install mem0-mcp-server

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

# Clone and test with the agent
git clone https://github.com/mem0ai/mem0-mcp-server.git
cd mem0-mcp-server
python example/pydantic_ai_repl.py

Using different server configurations:

# Use with Docker container
export MEM0_MCP_CONFIG_PATH=example/docker-config.json
export MEM0_MCP_CONFIG_SERVER=mem0-docker
python example/pydantic_ai_repl.py

# Use with Smithery remote server
export MEM0_MCP_CONFIG_PATH=example/config-smithery.json
export MEM0_MCP_CONFIG_SERVER=mem0-memory-mcp
python example/pydantic_ai_repl.py

</details>

What You Can Do

The Mem0 MCP server enables powerful memory capabilities for your AI applications:

  • Remember that I'm allergic to peanuts and shellfish - Add new health information to memory
  • Store these trial parameters: 200 participants, double-blind, placebo-controlled study - Save research data
  • What do you know about my dietary preferences? - Search and retrieve all food-related memories
  • Update my project status: the mobile app is now 80% complete - Modify existing memory with new info
  • Delete all memories from 2023, I need a fresh start - Bulk remove outdated memories
  • Show me everything I've saved about the Phoenix project - List all memories for a specific topic

Configuration

Environment Variables

  • MEM0_API_KEY (required) – Mem0 platform API key.
  • MEM0_DEFAULT_USER_ID (optional) – default user_id injected into filters and write requests (defaults to mem0-mcp).
  • MEM0_MCP_AGENT_MODEL (optional) – default LLM for the bundled agent example (defaults to openai:gpt-4o-mini).

Advanced Setup

<details> <summary><strong>Click to expand: Docker, Smithery, and Development</strong></summary>

Docker Deployment

To run with Docker:

  1. Build the image:

    docker build -t mem0-mcp-server .
    
  2. Run the container:

    docker run --rm -d \
      --name mem0-mcp \
      -e MEM0_API_KEY=sk_mem0_... \
      -p 8080:8081 \
      mem0-mcp-server
    
  3. Monitor the container:

    # View logs
    docker logs -f mem0-mcp
    
    # Check status
    docker ps
    

Running with Smithery Remote Server

To connect to a Smithery-hosted server:

  1. Install with Smithery support:

    pip install "mem0-mcp-server[smithery]"
    
  2. Configure MCP client with Smithery:

    {
      "mcpServers": {
        "mem0-memory-mcp": {
          "command": "npx",
          "args": [
            "-y",
            "@smithery/cli@latest",
            "run",
            "@mem0ai/mem0-memory-mcp",
            "--key",
            "your-smithery-key",
            "--profile",
            "your-profile-name"
          ],
          "env": {
            "MEM0_API_KEY": "sk_mem0_..."
          }
        }
      }
    }
    

Development Setup

Clone and run from source:

git clone https://github.com/mem0ai/mem0-mcp-server.git
cd mem0-mcp-server
pip install -e ".[dev]"

# Run locally
mem0-mcp-server

# Or with uv
uv sync
uv run mem0-mcp-server

</details>

License

Apache License 2.0

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选