- Home
- MCP servers
- Mem0
Mem0
- javascript
87
GitHub Stars
javascript
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"pinkpixel-dev-mem0-mcp": {
"command": "mem0-mcp",
"args": [],
"env": {
"MEM0_API_KEY": "YOUR_MEM0_API_KEY_HERE",
"DEFAULT_APP_ID": "my-project",
"OPENAI_API_KEY": "sk-...",
"DEFAULT_USER_ID": "user123",
"DEFAULT_AGENT_ID": "my-agent"
}
}
}
}You deploy the Mem0 MCP Server to give your AI agents persistent memory that survives sessions. It stores and retrieves memories using Mem0 or in your own storage backend, enabling your assistants to recall past interactions, context, and metadata across runs.
How to use
You connect your MCP client to one or more MCP server configurations and then issue tool calls like add_memory, search_memory, or delete_memory. Use CloudStorage for production-ready persistence with Mem0, Supabase Storage for self-hosted persistence, or Local Storage for development and testing. When you call add_memory, provide the content you want remembered along with user and optional agent, app, and session identifiers. When you call search_memory, supply a natural language query and the user identifier to retrieve relevant memories. Use delete_memory to remove a specific memory by its memoryId and userId. The server reads your identifiers with a clear priority: values from the tool call take precedence over fallback defaults you configure via environment variables. Ensure your client is configured to point to the correct MCP server and that the server has the necessary API keys or credentials for the storage backend you choose.
How to install
Prerequisites: Node.js and npm must be available on your system. You will also need access to a storage backend depending on your chosen mode (Mem0 Cloud, Supabase, or OpenAI embeddings for local storage). Follow the concrete steps below to set up and run the MCP server.
Step 1: Install dependencies for development and build the server if you clone the repository.
git clone https://github.com/pinkpixel-dev/mem0-mcp
cd mem0-mcp
npm install
npm run build
Step 2: Run the server locally using the built file or a package manager method described in your configuration. For a built local start, use node with the built script path, or use npx/global install if that is your preferred workflow.
# If you built the project
node /absolute/path/to/mem0-mcp/build/index.js
Step 3: Configure your MCP client to point to the running server configuration you chose (Cloud, Supabase, or Local). You will supply the necessary environment variables for the chosen mode.
Configuration and environments
The server supports multiple storage modes with distinct environment requirements.
Storage modes overview
Cloud Storage mode uses a Mem0 API key to persist memories on Mem0 servers. Supabase Storage mode stores memories in your own Supabase database and may require an OpenAI API key for embeddings. Local Storage mode runs entirely on your machine using an in-memory vector database for development.
Tools and capabilities
The MCP server exposes core memory operations you can call from your MCP client:
- add_memory — Stores a piece of text as a memory associated with a user. Requires content and userId; supports optional sessionId, agentId, appId, and metadata for advanced control.
- search_memory — Retrieves memories by a natural language query for a specific userId; supports optional session, agent, app, and filtering parameters.
- delete_memory — Removes a memory by its memoryId and userId; supports optional agentId and appId.
Security notes
Keep API keys and access credentials secure. When debugging, prefer directing standard console output to non-protocol streams and use provided SafeLogger mechanisms to avoid interfering with MCP protocol traffic.
Troubleshooting
If the MCP protocol seems noisy or behavior is unexpected, use dedicated tooling to inspect protocol communications and ensure stdout remains clean for protocol messages. For development, use a .env file to manage keys and defaults locally.
Notes on defaults and parameters
You can define default identifiers (DEFAULT_USER_ID, DEFAULT_AGENT_ID, DEFAULT_APP_ID) in your MCP configuration. Tool-supplied parameters take priority over these defaults, giving you precise control when the LLM supplies explicit IDs.
Development and debugging tips
For automatic rebuilds during development, run the watch workflow if available. Use tooling to inspect MCP protocol traffic and prefer console.error for auxiliary logging to avoid interfering with protocol communication.
Available tools
add_memory
Stores a piece of text as memory associated with a user. Requires content and userId; supports optional sessionId, agentId, appId, and metadata for advanced control.
search_memory
Searches stored memories based on a natural language query for a specific userId; supports optional sessionId, agentId, appId, filters, and threshold.
delete_memory
Deletes a specific memory by its memoryId and userId; supports optional agentId and appId.