ME

mem0-mcp

Created 6 months ago

MCP Server with Mem0 for Managing Coding Preferences.

development documentation public

What is mem0-mcp?

A Model Context Protocol server for Mem0, which helps with managing coding preferences.

Documentation

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.

Installation

  1. Clone this repository
  2. Initialize the uv environment:
    uv venv
    
  3. Activate the virtual environment:
    source .venv/bin/activate
    
  4. Install the dependencies using uv:
    # Install in editable mode from pyproject.toml
    uv pip install -e .
    
  5. 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
    
  2. In Cursor, connect to the SSE endpoint, follow this doc for reference:
    http://0.0.0.0:8080/sse
    
  3. Open the Composer in Cursor and switch to Agent mode.

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
  1. get_all_coding_preferences: Retrieve all stored coding preferences to analyze patterns, review implementations, and ensure no relevant information is missed.
  2. 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 --port

Server Config

{
  "mcpServers": {
    "mem0-mcp-server": {
      "command": "npx",
      "args": [
        "mem0-mcp"
      ]
    }
  }
}

Links & Status

Repository: github.com
Hosted: Yes
Global: Yes
Official: No

Project Info

Hosted Featured
Created At: May 23, 2025
Updated At: Aug 07, 2025
Author: mem0ai
Category: community
License: MIT
Tags:
development documentation public