mem0-mcp

This repository provides an MCP server integrated with mem0 for efficient coding preference management, enabling storage, retrieval, and semantic search of code snippets and best practices within Cursor.

337
8

MCP Server with Mem0 for Managing Coding Preferences

This project demonstrates using an MCP server with mem0 to manage coding preferences. It provides tools for storing, retrieving, and searching coding preferences, designed for use with Cursor.

Installation

  1. Clone the repository.
  2. Initialize a uv virtual environment.
  3. Activate the environment.
  4. Install dependencies using uv pip install -e ..
  5. Set your mem0 API key in the .env file.

Usage

  1. Start the MCP server using uv run main.py.
  2. Connect to the SSE endpoint (http://0.0.0.0:8080/sse) in Cursor, following the Cursor documentation.
  3. Use the Composer in Cursor in Agent mode.

Features

The server offers:

  1. add_coding_preference: Stores code snippets with context (code, language versions, setup, docs, examples, best practices).
  2. get_all_coding_preferences: Retrieves all stored preferences for analysis.
  3. search_coding_preferences: Semantically searches preferences for code, solutions, best practices, setup guides, and documentation.

This system provides a persistent coding preferences solution accessible via MCP. The SSE server can run independently, allowing agents to connect, use, and disconnect as needed, fitting cloud-native architectures. The server, running on 0.0.0.0:8080 by default, is configurable via command-line arguments (--host, --port).

Repository

ME
mem0ai

mem0ai/mem0-mcp

Created

February 18, 2025

Updated

March 28, 2025

Language

Python

Category

Developer Tools