@pinkpixel/mem0-mcp MCP Server
mem0ai Node.js SDK for its core functionality.Features
Tools
- `add_memory`: Stores a piece of text content as a memory associated with a specific
userId.
- `search_memory`: Searches stored memories based on a natural language query for a specific
userId.
- `delete_memory`: Deletes a specific memory from storage by its ID.
Prerequisites
- Cloud Storage Mode (Recommended)
- Local Storage Mode
Installation & Configuration
1. Using `npx` (Recommended for quick use)
npx:Cloud Storage Configuration (Recommended)
"YOUR_MEM0_API_KEY_HERE" with your actual Mem0 API key.Local Storage Configuration (Alternative)
"YOUR_OPENAI_API_KEY_HERE" with your actual OpenAI API key.2. Running from Cloned Repository
node:- Replace
/absolute/path/to/mem0-mcp/with the actual absolute path to your cloned repository
- Use the
build/index.jsfile, not thesrc/index.tsfile
- The MCP server requires clean stdout for protocol communication - any libraries or code that writes to stdout may interfere with the protocol
Default User ID (Optional Fallback)
add_memory and search_memory tools require a userId argument to associate memories with a specific user.DEFAULT_USER_ID environment variable when launching the server. If this variable is set, and the userId argument is omitted when calling the search_memory tool, the server will use the value of DEFAULT_USER_ID for the search.userId for both adding and searching memories to avoid ambiguity.DEFAULT_USER_ID:node:Cloud vs. Local Storage
Cloud Storage (Mem0 API)
- Persistent by default - Your memories remain available across sessions and server restarts
- No local database required - All data is stored on Mem0's servers
- Higher retrieval quality - Uses Mem0's optimized search algorithms
- Additional fields - Supports
agent_idandthresholdparameters
- Requires - A Mem0 API key
Local Storage (OpenAI API)
- In-memory by default - Data is stored only in RAM and is not persistent long-term. While some caching may occur, you should not rely on this for permanent storage.
- Data loss risk - Memory data will be lost on server restart, system reboot, or if the process is terminated
- Recommended for - Development, testing, or temporary use only
- For persistent storage - Use the Cloud Storage option with Mem0 API if you need reliable long-term memory
- Uses OpenAI embeddings - For vector search functionality
- Self-contained - All data stays on your machine
- Requires - An OpenAI API key
Development
Debugging
- Use the MCP Inspector: This tool can monitor the MCP protocol communication:
- Console Logging: When adding console logs, always use
console.error()instead ofconsole.log()to avoid interfering with the MCP protocol
- Environment Files: Use a
.envfile for local development to simplify setting API keys and other configuration options
Technical Implementation Notes
Advanced Mem0 API Parameters
metadata object when adding memories:Advanced Parameters for `add_memory`:
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
add_memory tool. For example:Advanced Parameters for `search_memory`:
filters parameter:[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
filters parameter supports complex logical operations (AND, OR) and various comparison operators:[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
search_memory tool:SafeLogger
SafeLogger class that selectively redirects console.log calls from the mem0ai library to stderr without disrupting MCP protocol:- Intercepts console.log calls and examines stack traces to determine source
- Only redirects log calls from mem0ai library or our own code
- Preserves clean stdout for MCP protocol communication
- Automatically cleans up resources on process exit
Environment Variables
MEM0_API_KEY: API key for cloud storage mode
OPENAI_API_KEY: API key for local storage mode (embeddings)
DEFAULT_USER_ID: Default user ID for memory operations
@pinkpixel/mem0-mcp MCP Server
mem0ai Node.js SDK for its core functionality.Features
Tools
- `add_memory`: Stores a piece of text content as a memory associated with a specific
userId.
- `search_memory`: Searches stored memories based on a natural language query for a specific
userId.
- `delete_memory`: Deletes a specific memory from storage by its ID.
Prerequisites
- Cloud Storage Mode (Recommended)
- Local Storage Mode
Installation & Configuration
1. Using `npx` (Recommended for quick use)
npx:Cloud Storage Configuration (Recommended)
"YOUR_MEM0_API_KEY_HERE" with your actual Mem0 API key.Local Storage Configuration (Alternative)
"YOUR_OPENAI_API_KEY_HERE" with your actual OpenAI API key.2. Running from Cloned Repository
node:- Replace
/absolute/path/to/mem0-mcp/with the actual absolute path to your cloned repository
- Use the
build/index.jsfile, not thesrc/index.tsfile
- The MCP server requires clean stdout for protocol communication - any libraries or code that writes to stdout may interfere with the protocol
Default User ID (Optional Fallback)
add_memory and search_memory tools require a userId argument to associate memories with a specific user.DEFAULT_USER_ID environment variable when launching the server. If this variable is set, and the userId argument is omitted when calling the search_memory tool, the server will use the value of DEFAULT_USER_ID for the search.userId for both adding and searching memories to avoid ambiguity.DEFAULT_USER_ID:node:Cloud vs. Local Storage
Cloud Storage (Mem0 API)
- Persistent by default - Your memories remain available across sessions and server restarts
- No local database required - All data is stored on Mem0's servers
- Higher retrieval quality - Uses Mem0's optimized search algorithms
- Additional fields - Supports
agent_idandthresholdparameters
- Requires - A Mem0 API key
Local Storage (OpenAI API)
- In-memory by default - Data is stored only in RAM and is not persistent long-term. While some caching may occur, you should not rely on this for permanent storage.
- Data loss risk - Memory data will be lost on server restart, system reboot, or if the process is terminated
- Recommended for - Development, testing, or temporary use only
- For persistent storage - Use the Cloud Storage option with Mem0 API if you need reliable long-term memory
- Uses OpenAI embeddings - For vector search functionality
- Self-contained - All data stays on your machine
- Requires - An OpenAI API key
Development
Debugging
- Use the MCP Inspector: This tool can monitor the MCP protocol communication:
- Console Logging: When adding console logs, always use
console.error()instead ofconsole.log()to avoid interfering with the MCP protocol
- Environment Files: Use a
.envfile for local development to simplify setting API keys and other configuration options
Technical Implementation Notes
Advanced Mem0 API Parameters
metadata object when adding memories:Advanced Parameters for `add_memory`:
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
add_memory tool. For example:Advanced Parameters for `search_memory`:
filters parameter:[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
filters parameter supports complex logical operations (AND, OR) and various comparison operators:[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
search_memory tool:SafeLogger
SafeLogger class that selectively redirects console.log calls from the mem0ai library to stderr without disrupting MCP protocol:- Intercepts console.log calls and examines stack traces to determine source
- Only redirects log calls from mem0ai library or our own code
- Preserves clean stdout for MCP protocol communication
- Automatically cleans up resources on process exit
Environment Variables
MEM0_API_KEY: API key for cloud storage mode
OPENAI_API_KEY: API key for local storage mode (embeddings)
DEFAULT_USER_ID: Default user ID for memory operations