Mem0 Memory MCP Server

Mem0 Memory MCP Server

Enables memory storage and retrieval using Mem0, allowing users to store context-specific memories and search through them with relevance scoring.

Category
Visit Server

README

Mem0 Memory MCP Server

A Model Context Protocol (MCP) server that provides memory storage and retrieval capabilities using Mem0. This tool allows you to store and search through memories, making it useful for maintaining context and making informed decisions based on past interactions.

Features

  • Store memories with user-specific context
  • Search through stored memories with relevance scoring
  • Simple and intuitive API
  • Built on the Model Context Protocol
  • Automatic error handling
  • Support for multiple user contexts

Usage

This server now supports StreamableHTTP via Smithery CLI while retaining optional STDIO compatibility.

StreamableHTTP (recommended)

  • Development (opens Smithery Playground and exposes HTTP transport):
npm run dev
  • Build for HTTP/StreamableHTTP (Smithery):
npm run build
  • Start the HTTP server locally (Smithery-built entrypoint):
npm run start:http

You can configure the server using Smithery’s generated form in the playground or by setting environment variables (e.g., MEM0_API_KEY).

STDIO (backward compatible)

Run the server over STDIO (useful for local clients that only support STDIO):

env MEM0_API_KEY=your-api-key-here npm run build:stdio && npm run start:stdio

Configuration for AI Tools

Running on Cursor (STDIO)

Configuring Cursor 🖥️

To configure Mem0 MCP in Cursor:

  1. Open Cursor Settings
  2. Go to Features > MCP Servers
  3. Click "+ Add New MCP Server"
  4. Enter the following:
    • Name: "mem0-mcp" (or your preferred name)
    • Type: "command"
    • Command: env MEM0_API_KEY=your-api-key-here npx -y @mem0/mcp (or use start:stdio from this repo)

To configure Mem0 MCP using JSON configuration:

{
  "mcpServers": {
    "mem0-mcp": {
      "command": "npx",
      "args": ["-y", "@mem0/mcp"],
      "env": {
        "MEM0_API_KEY": "YOUR-API-KEY-HERE"
      }
    }
  }
}

Running on VS Code (STDIO)

Add the following JSON block to your User Settings (JSON) file in VS Code:

{
  "mcp": {
    "inputs": [
      {
        "type": "promptString",
        "id": "apiKey",
        "description": "Mem0 API Key",
        "password": true
      }
    ],
    "servers": {
      "mem0-memory": {
        "command": "npx",
        "args": ["-y", "@mem0/mcp"],
        "env": {
          "MEM0_API_KEY": "${input:apiKey}"
        }
      }
    }
  }
}

Available Tools

1. Add Memory Tool (add-memory)

Store new memories with user-specific context.

{
  "name": "add-memory",
  "arguments": {
    "content": "User prefers dark mode interface",
    "userId": "user123"
  }
}

2. Search Memories Tool (search-memories)

Search through stored memories to retrieve relevant information.

{
  "name": "search-memories",
  "arguments": {
    "query": "What are the user's interface preferences?",
    "userId": "user123"
  }
}

Response Format

Add Memory Response

{
  "content": [
    {
      "type": "text",
      "text": "Memory added successfully"
    }
  ],
  "isError": false
}

Search Memory Response

{
  "content": [
    {
      "type": "text",
      "text": "Memory: User prefers dark mode interface\nRelevance: 0.95\n---\nMemory: User mentioned liking minimal UI\nRelevance: 0.82\n---"
    }
  ],
  "isError": false
}

Configuration

Environment Variables

  • MEM0_API_KEY: Your Mem0 API key (required)

Development

Prerequisites

  • Node.js >= 18
  • A Mem0 API key

Setup

  1. Install dependencies:
npm install
  1. Optionally create a .env file in the project directory and add your Mem0 API key:
MEM0_API_KEY=your-api-key-here
DEFAULT_USER_ID=mem0-mcp-user

HTTP/StreamableHTTP Dev

npm run dev

STDIO Dev

npm run build:stdio
npm run start:stdio

Error Handling

The server includes error handling for:

  • API connection issues
  • Invalid memory operations
  • Search errors
  • Authentication failures

Example error response:

{
  "content": [
    {
      "type": "text",
      "text": "Error: Failed to search memories: Invalid API key"
    }
  ],
  "isError": true
}

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured