Memory Service MCP server

Integrates with ChromaDB using sentence transformers for efficient text embedding, enabling semantic search and content recommendation via websocket connections.
Back to servers
Setup instructions
Provider
doobidoo
Release date
Dec 26, 2024
Language
Python
Stats
427 stars

The MCP Memory Service provides semantic memory and persistent storage capabilities for Claude Desktop using ChromaDB and sentence transformers. It enables long-term memory with semantic search, making it ideal for maintaining context across conversations.

Installation

Quick Start (Recommended)

# Clone the repository
git clone https://github.com/doobidoo/mcp-memory-service.git
cd mcp-memory-service

# Create and activate a virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Run the installation script
python install.py

The install.py script will:

  1. Detect your system architecture and available hardware accelerators
  2. Install the appropriate dependencies for your platform
  3. Configure the optimal settings for your environment
  4. Verify the installation and provide diagnostics if needed

Docker Installation

# Using Docker Compose (recommended)
docker-compose up

# Using Docker directly
docker build -t mcp-memory-service .
docker run -p 8000:8000 -v /path/to/data:/app/chroma_db -v /path/to/backups:/app/backups mcp-memory-service

Alternative Docker Compose configurations:

docker-compose -f docker-compose.uv.yml up

Windows Installation (Special Case)

# After activating your virtual environment
python scripts/install_windows.py

Installing via Smithery

npx -y @smithery/cli install @doobidoo/mcp-memory-service --client claude

Claude MCP Configuration

Standard Configuration

Add the following to your claude_desktop_config.json file:

{
  "memory": {
    "command": "uv",
    "args": [
      "--directory",
      "your_mcp_memory_service_directory",  // e.g., "C:\\REPOSITORIES\\mcp-memory-service"
      "run",
      "memory"
    ],
    "env": {
      "MCP_MEMORY_CHROMA_PATH": "your_chroma_db_path",  // e.g., "C:\\Users\\John.Doe\\AppData\\Local\\mcp-memory\\chroma_db"
      "MCP_MEMORY_BACKUPS_PATH": "your_backups_path"  // e.g., "C:\\Users\\John.Doe\\AppData\\Local\\mcp-memory\\backups"
    }
  }
}

Windows-Specific Configuration (Recommended)

{
  "memory": {
    "command": "python",
    "args": [
      "C:\\path\\to\\mcp-memory-service\\memory_wrapper.py"
    ],
    "env": {
      "MCP_MEMORY_CHROMA_PATH": "C:\\Users\\YourUsername\\AppData\\Local\\mcp-memory\\chroma_db",
      "MCP_MEMORY_BACKUPS_PATH": "C:\\Users\\YourUsername\\AppData\\Local\\mcp-memory\\backups"
    }
  }
}

Usage Guide

The memory service is invoked through natural language commands in your conversations with Claude:

  • To store: "Please remember that my project deadline is May 15th."
  • To retrieve: "Do you remember what I told you about my project deadline?"
  • To delete: "Please forget what I told you about my address."

Memory Operations

Core Memory Operations

  1. store_memory - Store new information with optional tags
  2. retrieve_memory - Perform semantic search for relevant memories
  3. recall_memory - Retrieve memories using natural language time expressions
  4. search_by_tag - Find memories using specific tags
  5. exact_match_retrieve - Find memories with exact content match
  6. debug_retrieve - Retrieve memories with similarity scores

Database Management

  1. create_backup - Create database backup
  2. get_stats - Get memory statistics
  3. optimize_db - Optimize database performance
  4. check_database_health - Get database health metrics
  5. check_embedding_model - Verify model status

Memory Management

  1. delete_memory - Delete specific memory by hash
  2. delete_by_tag - Delete memories with specific tag(s) - supports both single tags and multiple tags
  3. delete_by_tags - Explicitly delete memories containing any of the specified tags (OR logic)
  4. delete_by_all_tags - Delete memories containing all specified tags (AND logic)
  5. cleanup_duplicates - Remove duplicate entries

Example Usage

// Store memories with tags
store_memory("Project deadline is May 15th", {tags: ["work", "deadlines", "important"]})
store_memory("Grocery list: milk, eggs, bread", {tags: ["personal", "shopping"]})
store_memory("Meeting notes from sprint planning", {tags: ["work", "meetings", "important"]})

// Search by multiple tags
search_by_tag(["work", "important"])  // Returns memories with either tag

// Enhanced deletion options
delete_by_tag("temporary")                    // Delete single tag
delete_by_tag(["temporary", "outdated"])     // Delete memories with any of these tags
delete_by_tags(["personal", "shopping"])     // Explicit multi-tag deletion
delete_by_all_tags(["work", "important"])    // Delete only memories with BOTH tags

Configuration Options

Configure through environment variables:

CHROMA_DB_PATH: Path to ChromaDB storage
BACKUP_PATH: Path for backups
AUTO_BACKUP_INTERVAL: Backup interval in hours (default: 24)
MAX_MEMORIES_BEFORE_OPTIMIZE: Threshold for auto-optimization (default: 10000)
SIMILARITY_THRESHOLD: Default similarity threshold (default: 0.7)
MAX_RESULTS_PER_QUERY: Maximum results per query (default: 10)
BACKUP_RETENTION_DAYS: Number of days to keep backups (default: 7)
LOG_LEVEL: Logging level (default: INFO)

# Hardware-specific environment variables
PYTORCH_ENABLE_MPS_FALLBACK: Enable MPS fallback for Apple Silicon (default: 1)
MCP_MEMORY_USE_ONNX: Use ONNX Runtime for CPU-only deployments (default: 0)
MCP_MEMORY_USE_DIRECTML: Use DirectML for Windows acceleration (default: 0)
MCP_MEMORY_MODEL_NAME: Override the default embedding model
MCP_MEMORY_BATCH_SIZE: Override the default batch size

Hardware Compatibility

Platform Architecture Accelerator Status
macOS Apple Silicon (M1/M2/M3) MPS ✅ Fully supported
macOS Apple Silicon under Rosetta 2 CPU ✅ Supported with fallbacks
macOS Intel CPU ✅ Fully supported
Windows x86_64 CUDA ✅ Fully supported
Windows x86_64 DirectML ✅ Supported
Windows x86_64 CPU ✅ Supported with fallbacks
Linux x86_64 CUDA ✅ Fully supported
Linux x86_64 ROCm ✅ Supported
Linux x86_64 CPU ✅ Supported with fallbacks
Linux ARM64 CPU ✅ Supported with fallbacks

Troubleshooting

Quick Troubleshooting Tips

  • Windows PyTorch errors: Use python scripts/install_windows.py
  • macOS Intel dependency conflicts: Use python install.py --force-compatible-deps
  • Recursion errors: Run python scripts/fix_sitecustomize.py
  • Environment verification: Run python scripts/verify_environment_enhanced.py
  • Memory issues: Set MCP_MEMORY_BATCH_SIZE=4 and try a smaller model
  • Apple Silicon: Ensure Python 3.10+ built for ARM64, set PYTORCH_ENABLE_MPS_FALLBACK=1
  • Installation testing: Run python scripts/test_installation.py

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "memory" '{"command":"uv","args":["--directory","your_mcp_memory_service_directory","run","memory"],"env":{"MCP_MEMORY_CHROMA_PATH":"your_chroma_db_path","MCP_MEMORY_BACKUPS_PATH":"your_backups_path"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "memory": {
            "command": "uv",
            "args": [
                "--directory",
                "your_mcp_memory_service_directory",
                "run",
                "memory"
            ],
            "env": {
                "MCP_MEMORY_CHROMA_PATH": "your_chroma_db_path",
                "MCP_MEMORY_BACKUPS_PATH": "your_backups_path"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "memory": {
            "command": "uv",
            "args": [
                "--directory",
                "your_mcp_memory_service_directory",
                "run",
                "memory"
            ],
            "env": {
                "MCP_MEMORY_CHROMA_PATH": "your_chroma_db_path",
                "MCP_MEMORY_BACKUPS_PATH": "your_backups_path"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later