Mem0 MCP Server for Coding Preferences
Customize coding preferences with the Mem0 MCP server to streamline settings, synchronize profiles, and enforce best practices across projects.
npx -y @mem0ai/mem0-mcpOverview
Mem0 MCP Server exposes the Mem0 Memory API as a Model Context Protocol (MCP) server so MCP-compatible clients (Claude Desktop, Cursor, VS Code extensions, custom agents) can persist, query, and manage long-term memories for users and agents. It acts as a lightweight HTTP/CLI bridge that standardizes memory operations (add, search, update, delete) for any tool that speaks MCP.
Note: this repository has been archived and is no longer actively maintained. Mem0 provides an official hosted MCP server; see the Mem0 docs for the current managed option. The archived server is still useful as a reference, local deployment, or for self-hosted scenarios. Source: https://github.com/mem0ai/mem0-mcp
Features
- Standard MCP endpoint that forwards memory operations to the Mem0 Memory API
- CRUD operations for memories (create, retrieve, update, delete) and entities (users/agents/apps/runs)
- Semantic search across stored memories with filters and pagination
- CLI / uvx-executable for running a local MCP server and quick integration with MCP clients
- Docker-ready container for isolated deployments
- Example Python agent for testing and demonstration
- All tool responses are returned as raw JSON from the Mem0 API (no additional transformation)
Installation / Configuration
Install from PyPI:
# OR (via uv)
Run locally with uvx (example MCP server process):
Minimum environment variables:
# required
# optional (default: mem0-mcp)
# optional
# optional for example agent
Example MCP client configuration (JSON snippet):
Docker quickstart:
# build
# run (exposes /mcp endpoint inside container)
Testing with the included example Python agent:
# clone and run the REPL agent
Available Tools
The MCP server exposes these tools to connected LLMs and clients. Each tool returns raw JSON responses from Mem0.
| Tool | Purpose |
|---|---|
| add_memory | Save text, conversation history, or structured message objects |
| search_memories | Semantic search with filters and result limits |
| get_memories | List memories with filter fields and pagination |
| get_memory | Retrieve a single memory by memory_id |
| update_memory | Overwrite or modify a memory after confirming memory_id |
| delete_memory | Delete a single memory by memory_id |
| delete_all_memories | Bulk delete all memories in a confirmed scope (user/agent/app/run) |
| delete_entities | Remove an entity (user/agent/app/run) and its associated memories |
| list_entities | Enumerate stored users, agents, apps, and runs |
Use Cases
- Personalization: persist preferences like coding style (indentation, preferred languages, testing approach) so assistants can apply them across sessions.
- Project context: store project-specific details (architecture notes, component owners, deployment commands) to surface during code reviews or generation tasks.
- Research logging: record experiment parameters and outcomes (trial size, configuration, results) for later retrieval and comparison.
- Compliance / housekeeping: bulk-delete memories from a date range or remove an account’s memories when requested.
- Agent coordination: share agent-visible context (current task, status, recent messages) across multiple agents or tools via the MCP layer.
Concrete examples:
- “Remember that my projects prefer 2-space indentation and use pytest” → add_memory
- “Find everything I’ve saved about feature flag toggles” → search_memories with a topic filter
- “Update the Phoenix app status to 80% complete” → update_memory with confirmed memory_id
- “Delete all memories tagged 2023” → delete_all_memories with scope filters
Notes and Next Steps
- All responses are the Mem0 API JSON; client-side parsing may be required.
- The repository is archived—consider using Mem0’s hosted MCP option for production use (see Mem0 docs).
- For customization, the server is simple to extend: add middleware, enforce org-specific policies, or adapt filters to your authorization model.
Repository and reference: https://github.com/mem0ai/mem0-mcp (archived).