Skip to main content
Glama

Mem0 MCP Server

Official
by mem0ai

MCP Server with Mem0 for Managing Coding Preferences

This demonstrates a structured approach for using an MCP server with mem0 to manage coding preferences efficiently. The server can be used with Cursor and provides essential tools for storing, retrieving, and searching coding preferences.

Installation

  1. Clone this repository
  2. Initialize the uv environment:
uv venv
  1. Activate the virtual environment:
source .venv/bin/activate
  1. Install the dependencies using uv:
# Install in editable mode from pyproject.toml uv pip install -e .
  1. Update .env file in the root directory with your mem0 API key:
MEM0_API_KEY=your_api_key_here

Usage

  1. Start the MCP server:
uv run main.py
  1. In Cursor, connect to the SSE endpoint, follow this doc for reference:
http://0.0.0.0:8080/sse
  1. Open the Composer in Cursor and switch to Agent mode.

Demo with Cursor

https://github.com/user-attachments/assets/56670550-fb11-4850-9905-692d3496231c

Features

The server provides three main tools for managing code preferences:

  1. add_coding_preference: Store code snippets, implementation details, and coding patterns with comprehensive context including:
    • Complete code with dependencies
    • Language/framework versions
    • Setup instructions
    • Documentation and comments
    • Example usage
    • Best practices
  2. get_all_coding_preferences: Retrieve all stored coding preferences to analyze patterns, review implementations, and ensure no relevant information is missed.
  3. search_coding_preferences: Semantically search through stored coding preferences to find relevant:
    • Code implementations
    • Programming solutions
    • Best practices
    • Setup guides
    • Technical documentation

Why?

This implementation allows for a persistent coding preferences system that can be accessed via MCP. The SSE-based server can run as a process that agents connect to, use, and disconnect from whenever needed. This pattern fits well with "cloud-native" use cases where the server and clients can be decoupled processes on different nodes.

Server

By default, the server runs on 0.0.0.0:8080 but is configurable with command line arguments like:

uv run main.py --host <your host> --port <your port>

The server exposes an SSE endpoint at /sse that MCP clients can connect to for accessing the coding preferences management tools.

-
security - not tested
F
license - not found
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

An MCP server that integrates with mem0.ai to help users store, retrieve, and search coding preferences for more consistent programming practices.

  1. Installation
    1. Usage
      1. Demo with Cursor
        1. Features
          1. Why?
            1. Server

          Related MCP Servers

          • A
            security
            A
            license
            A
            quality
            A custom Memory MCP Server that acts as a cache for Infrastructure-as-Code information, allowing users to store, summarize, and manage notes with a custom URI scheme and simple resource handling.
            Last updated -
            23
            1
            Python
            MIT License
            • Apple
          • -
            security
            F
            license
            -
            quality
            Model Context Protocol (MCP) server implementation for semantic search and memory management using TxtAI. This server provides a robust API for storing, retrieving, and managing text-based memories with semantic search capabilities. You can use Claude and Cline AI Also
            Last updated -
            6
            Python
            • Apple
          • -
            security
            A
            license
            -
            quality
            A Model Context Protocol server that integrates AI assistants with Mem0.ai's persistent memory system, allowing models to store, retrieve, search, and manage different types of memories.
            Last updated -
            9
            Python
            MIT License
            • Apple
          • -
            security
            A
            license
            -
            quality
            A Code Indexing MCP Server that connects AI coding assistants to external codebases, providing accurate and up-to-date code snippets to reduce mistakes and hallucinations.
            Last updated -
            72
            Python
            Apache 2.0

          View all related MCP servers

          MCP directory API

          We provide all the information about MCP servers via our MCP API.

          curl -X GET 'https://glama.ai/api/mcp/v1/servers/mem0ai/mem0-mcp'

          If you have feedback or need assistance with the MCP directory API, please join our Discord server