
Store and retrieve entities, relations and observations in a persistent local knowledge graph.

A template Model Context Protocol server integrated with Mem0 that provides AI agents with persistent memory capabilities using semantic search.
MCP-Mem0: Long-Term Memory MCP Server is cataloged as an MCP server attributed to coleam00. A template Model Context Protocol server integrated with Mem0 that provides AI agents with persistent memory capabilities using semantic search. It is categorized under ai agents-models. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.
Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.
Catalog license label: Not specified. Check the source repository's current license and terms before using, modifying or distributing this software.
Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.
No reviewed records to display. This does not establish that upstream lacks this capability.
No reviewed records to display. This does not establish that upstream lacks this capability.
No reviewed records to display. This does not establish that upstream lacks this capability.
Email delivery is not connected. This page does not collect email addresses or create subscriptions.
Browse the registry for current listings instead.
Reviews for MCP-Mem0: Long-Term Memory MCP Server are not available yet
Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.
README.md · 22fb7af0432e · Fetched 2026-11-13 12:03:27 UTC
Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.
Showing the last retrieved documentation snapshot; check the source for current changes.
A template implementation of the Model Context Protocol (MCP) server integrated with Mem0 for providing AI agents with persistent memory capabilities.
Use this as a reference point to build your MCP servers yourself, or give this as an example to an AI coding assistant and tell it to follow this example for structure and code correctness!
This project demonstrates how to build an MCP server that enables AI agents to store, retrieve, and search memories using semantic search. It serves as a practical template for creating your own MCP servers, simply using Mem0 and a practical example.
The implementation follows the best practices laid out by Anthropic for building MCP servers, allowing seamless integration with any MCP-compatible client.
The server provides three essential memory management tools:
save_memory: Store any information in long-term memory with semantic indexingget_all_memories: Retrieve all stored memories for comprehensive contextsearch_memories: Find relevant memories using semantic searchInstall uv if you don't have it:
pip install uv
Clone this repository:
git clone https://github.com/coleam00/mcp-mem0.git
cd mcp-mem0
Install dependencies:
uv pip install -e .
Create a .env file based on .env.example:
cp .env.example .env
Configure your environment variables in the .env file (see Configuration section)
Build the Docker image:
docker build -t mcp/mem0 --build-arg PORT=8050 .
Create a .env file based on .env.example and configure your environment variables
The following environment variables can be configured in your .env file:
| Variable | Description | Example |
|---|---|---|
TRANSPORT | Transport protocol (sse or stdio) | sse |
HOST | Host to bind to when using SSE transport | 0.0.0.0 |
PORT | Port to listen on when using SSE transport | 8050 |
LLM_PROVIDER | LLM provider (openai, openrouter, or ollama) | openai |
LLM_BASE_URL | Base URL for the LLM API | https://api.openai.com/v1 |
LLM_API_KEY | API key for the LLM provider | sk-... |
LLM_CHOICE | LLM model to use | gpt-4o-mini |
EMBEDDING_MODEL_CHOICE | Embedding model to use | text-embedding-3-small |
DATABASE_URL | PostgreSQL connection string | postgresql://user:pass@host:port/db |
# Set TRANSPORT=sse in .env then:
uv run src/main.py
The MCP server will essentially be run as an API endpoint that you can then connect to with config shown below.
With stdio, the MCP client iself can spin up the MCP server, so nothing to run at this point.
docker run --env-file .env -p:8050:8050 mcp/mem0
The MCP server will essentially be run as an API endpoint within the container that you can then connect to with config shown below.
With stdio, the MCP client iself can spin up the MCP server container, so nothing to run at this point.
Once you have the server running with SSE transport, you can connect to it using this configuration:
{
"mcpServers": {
"mem0": {
"transport": "sse",
"url": "http://localhost:8050/sse"
}
}
}
Note for Windsurf users: Use
serverUrlinstead ofurlin your configuration:{ "mcpServers": { "mem0": { "transport": "sse", "serverUrl": "http://localhost:8050/sse" } } }
Note for n8n users: Use host.docker.internal instead of localhost since n8n has to reach outside of it's own container to the host machine:
So the full URL in the MCP node would be: http://host.docker.internal:8050/sse
Make sure to update the port if you are using a value other than the default 8050.
Add this server to your MCP configuration for Claude Desktop, Windsurf, or any other MCP client:
{
"mcpServers": {
"mem0": {
"command": "your/path/to/mcp-mem0/.venv/Scripts/python.exe",
"args": ["your/path/to/mcp-mem0/src/main.py"],
"env": {
"TRANSPORT": "stdio",
"LLM_PROVIDER": "openai",
"LLM_BASE_URL": "https://api.openai.com/v1",
"LLM_API_KEY": "YOUR-API-KEY",
"LLM_CHOICE": "gpt-4o-mini",
"EMBEDDING_MODEL_CHOICE": "text-embedding-3-small",
"DATABASE_URL": "YOUR-DATABASE-URL"
}
}
}
}
{
"mcpServers": {
"mem0": {
"command": "docker",
"args": ["run", "--rm", "-i",
"-e", "TRANSPORT",
"-e", "LLM_PROVIDER",
"-e", "LLM_BASE_URL",
"-e", "LLM_API_KEY",
"-e", "LLM_CHOICE",
"-e", "EMBEDDING_MODEL_CHOICE",
"-e", "DATABASE_URL",
"mcp/mem0"],
"env": {
"TRANSPORT": "stdio",
"LLM_PROVIDER": "openai",
"LLM_BASE_URL": "https://api.openai.com/v1",
"LLM_API_KEY": "YOUR-API-KEY",
"LLM_CHOICE": "gpt-4o-mini",
"EMBEDDING_MODEL_CHOICE": "text-embedding-3-small",
"DATABASE_URL": "YOUR-DATABASE-URL"
}
}
}
}
This template provides a foundation for building more complex MCP servers. To build your own:
@mcp.tool() decoratorutils.py file for any helper functions you need for your MCP server@mcp.resource() and @mcp.prompt()Claim this server with your GitHub account to request manual ownership verification.
Link to the catalog listing for MCP-Mem0: Long-Term Memory MCP Server from your README. This badge does not certify ownership, compatibility or security.
[](https://awesome-mcp.com/servers/mem0-mcp-server-sonjuane)Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.
Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.
No reviewed package or image identity; download statistics are not listed yet.
Alternative and complementary servers in the same category

Store and retrieve entities, relations and observations in a persistent local knowledge graph.

Organize problem solving into revisable, branching thought steps through an MCP tool.

Query-aware context compression with an MCP plugin for coding agents, plus Python and HTTP interfaces for reducing the context sent to a language model.