mcp-mem0

315

MCP-Mem0 is a template MCP server for AI agents to use long-term memory, integrated with Mem0. It provides persistent memory capabilities, allowing storage, retrieval, and semantic search functionalities, serving as a basis for developing other MCP servers.

Overview

This project demonstrates how to build an MCP server that enables AI agents to store, retrieve, and search memories using semantic search. It serves as a practical template for creating your own MCP servers, simply using Mem0 and a practical example.

Features

  • Store any information in long-term memory with semantic indexing
  • Retrieve all stored memories for comprehensive context
  • Find relevant memories using semantic search

Prerequisites

  • Python 3.12+
  • Supabase or any PostgreSQL database
  • API keys for your chosen LLM provider
  • Docker if running the MCP server as a container

Installation

Using uv

  1. Install uv
  2. Clone this repository
  3. Install dependencies
  4. Create a .env file based on .env.example
  5. Configure your environment variables in the .env file

Using Docker (Recommended)

  1. Build the Docker image
  2. Create a .env file and configure your environment variables

Running the Server

Using uv

  • Set TRANSPORT=sse in .env then: uv run src/main.py

Using Docker

  • Run: docker run --env-file .env -p:8050:8050 mcp/mem0

Integration with MCP Clients

Building Your Own Server

  1. Add your own tools by creating methods
  2. Create your own lifespan function
  3. Modify the utils.py file
  4. Add prompts and resources if needed.