MCP server for Mem0 agent memory management with multi-backend support
Project description
Mem0 Agent Memory
MCP server for Mem0 agent memory management with multi-backend support.
Features
- Multi-backend: FAISS (local), OpenSearch (AWS), Mem0 Platform (cloud)
- AWS Bedrock integration: Uses Amazon Titan embeddings and Claude 3.5 Haiku for processing
- Auto user detection: Uses system username when no user_id provided
- Relevance filtering: Returns memories with score > 0.7
- Complete memory operations: store, search, list, get, delete, history
- Pagination support: Handle large memory collections efficiently
- Recent memory tracking: Get latest updates for session continuity
- Robust error handling: Graceful fallbacks and clear error messages
Installation
pip install mem0-agent-memory
Quick Start
# Run directly with uvx
uvx mem0-agent-memory
# Or install and run
pip install mem0-agent-memory
python -m mem0_agent_memory
Configuration
AWS Configuration
For AWS Bedrock integration (used by default), ensure AWS credentials are configured:
# Option 1: AWS CLI configuration
aws configure
# Option 2: Environment variables
export AWS_ACCESS_KEY_ID="your-access-key"
export AWS_SECRET_ACCESS_KEY="your-secret-key"
export AWS_REGION="us-west-2"
Environment Variables
# FAISS (default - uses .mem0/memory in current directory)
export FAISS_PATH="/path/to/memory/storage" # Optional
# OpenSearch
export OPENSEARCH_HOST="your-opensearch-endpoint"
export AWS_REGION="us-west-2"
# Mem0 Platform
export MEM0_API_KEY="your-api-key"
# User/Agent ID (optional - auto-detects if not provided)
export MEM0_USER_ID="custom-user-id" # Defaults to system username
export MEM0_AGENT_ID="custom-agent-id" # Defaults to workspace name
MCP Client Setup
Amazon Q CLI
Create or edit the MCP configuration file:
Global Scope: ~/.aws/amazonq/mcp.json
Local Scope: .amazonq/mcp.json (project-specific)
{
"mcpServers": {
"mem0-agent-memory": {
"command": "uvx",
"args": ["mem0-agent-memory"],
"env": {
"FAISS_PATH": "/Users/yourname/.mem0/agent",
"MEM0_USER_ID": "john",
"MEM0_AGENT_ID": "my-project"
}
}
}
}
KIRO
Add to your KIRO MCP configuration:
{
"mcpServers": {
"mem0-agent-memory": {
"command": "uvx",
"args": ["mem0-agent-memory"],
"env": {
"FAISS_PATH": "/Users/yourname/.mem0/agent",
"MEM0_USER_ID": "john",
"MEM0_AGENT_ID": "my-project"
}
}
}
}
Agent Steering: Use the content from docs/KIRO_AGENT_STEERING.md as your agent steering document to enable memory-first development workflows.
Tools
store_memory(content, user_id?, agent_id?, metadata?)- Store memory with metadatasearch_memories(query, user_id?, agent_id?, limit?, page?, page_size?)- Search with relevance filtering & paginationlist_memories(user_id?, agent_id?, page?, page_size?)- List all memories with paginationget_memory(memory_id)- Get specific memory by IDdelete_memory(memory_id)- Delete memory by ID (permanent)get_memory_history(memory_id)- Get change history for memoryget_recent_memory(days?, limit?, user_id?, agent_id?)- Get recent memories for session continuity
Usage Examples
Store Memory
Auto-detect user:
{"content": "User prefers React over Vue"}
With metadata:
{"content": "API endpoint changed", "metadata": {"type": "technical", "priority": "high"}}
Specific user:
{"content": "Project deadline is next Friday", "user_id": "john"}
Search Memories
Basic search:
{"query": "React preferences"}
With pagination:
{"query": "API endpoints", "limit": 5, "page": 2}
Specific user:
{"query": "project status", "user_id": "john"}
List Memories
Auto-detect user with pagination:
{"page": 1, "page_size": 10}
Specific user:
{"user_id": "john", "page": 2, "page_size": 25}
Get Recent Memories
Last week (default):
{}
Last 3 days, limit 5:
{"days": 3, "limit": 5}
Specific user:
{"days": 7, "user_id": "john"}
Memory Management
Get specific memory:
{"memory_id": "cafdf73c-f8c7-4729-b840-e88ce7d8a67c"}
Get memory history:
{"memory_id": "cafdf73c-f8c7-4729-b840-e88ce7d8a67c"}
Delete memory (permanent):
{"memory_id": "cafdf73c-f8c7-4729-b840-e88ce7d8a67c"}
Architecture
Backend Auto-Detection
- Mem0 Platform: If
MEM0_API_KEYis set - OpenSearch: If
OPENSEARCH_HOSTis set - FAISS: Default fallback (local storage in
.mem0/memory)
Auto User/Agent Detection
When neither user_id nor agent_id is provided, automatically detects:
user_id:MEM0_USER_IDenv var → system usernameagent_id:MEM0_AGENT_IDenv var → workspace name (current directory)
This enables dual memories: user memories are personal, agent memories are workspace-specific.
Relevance Filtering
Search results automatically filtered to return only memories with relevance score > 0.7, ensuring high-quality results.
Error Handling
- Automatic fallback to
/tmpif FAISS path is not writable - Clear error messages for missing dependencies
- Graceful handling of network issues and invalid parameters
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Citation
If you use this software in your research or project, please cite it as:
@software{selvam_mem0_agent_memory_2025,
author = {Selvam, Arunkumar},
title = {Mem0 Agent Memory - MCP Server},
url = {https://github.com/arunkumars-mf/mem0-agent-memory},
version = {1.0.0},
year = {2025}
}
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mem0_agent_memory-1.0.5.tar.gz.
File metadata
- Download URL: mem0_agent_memory-1.0.5.tar.gz
- Upload date:
- Size: 111.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
518e9b7dc7780f779297b82106c62ecbe075699d81e85130b2065ee19197a664
|
|
| MD5 |
b7e8cb6e728c741ccb9eb76fce928554
|
|
| BLAKE2b-256 |
378e5c1d014e9222d60923ab1a7003432c0476acd4224d2e8485378a67308693
|
File details
Details for the file mem0_agent_memory-1.0.5-py3-none-any.whl.
File metadata
- Download URL: mem0_agent_memory-1.0.5-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3540c68cb0907012ca0e472acbea55bf3e1935e4b1778e78639f539e09781e5d
|
|
| MD5 |
f86b026a7d9de9c5b6bc3812cf559600
|
|
| BLAKE2b-256 |
62cdae5b76f16c6294d008d109e23f5a93ae7625f9c21bb86bf8a1afd092086a
|