
coleam00/mcp-mem0
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
Mem0を使った長期エージェントメモリ用のMCPサーバー。Pythonで自分でMCPサーバーを構築する際のテンプレートとしても役立ちます!
概要
MCP-Mem0:AIエージェントのための長期記憶 モデルコンテキストプロトコル(MCP)サーバーのテンプレート実装で、Mem0と統合され、AIエージェントに永続的なメモリ機能を提供します。 これを参考にして自分でMCPサーバーを作るか、AIコーディングアシスタントに例として使って、構造やコードの正確性についてこの例に従うように指示してください! このプロジェクトは、AIエージェントがセマンティックサーチを用いてメモリを保存、検索、検索できるMCPサーバーの構築方法を示します。これはMem0と実践例を用いて、自分でMCPサーバーを作成するための実用的なテンプレートとして機能します。 この実装はAnthropicが示したMCPサーバー構築のベストプラクティスに従っており、任意のMCP互換クライアントとのシームレスな統合を可能にします。 サーバーは3つの重要なメモリ管理ツールを提供します: 1. : すべての情報を意味的インデックス付きで長期記憶に保存する 2.: 包括的な文脈のためにすべての記憶を取得 3.
概要(AI 翻訳)
MCP-Mem0:AIエージェントのための長期記憶
モデルコンテキストプロトコル(MCP)サーバーのテンプレート実装で、Mem0と統合され、AIエージェントに永続的なメモリ機能を提供します。
これを参考にして自分でMCPサーバーを作るか、AIコーディングアシスタントに例として使って、構造やコードの正確性についてこの例に従うように指示してください!
概要
このプロジェクトは、AIエージェントがセマンティックサーチを用いてメモリを保存、検索、検索できるMCPサーバーの構築方法を示します。これはMem0と実践例を用いて、自分でMCPサーバーを作成するための実用的なテンプレートとして機能します。
この実装はAnthropicが示したMCPサーバー構築のベストプラクティスに従っており、任意のMCP互換クライアントとのシームレスな統合を可能にします。
特徴
サーバーは3つの重要なメモリ管理ツールを提供します:
save_memory:意味的インデックス付けを用いて長期記憶に情報を保存するget_all_memories: 包括的なコンテキストのために保存されているすべての記憶を取得search_memories: 意味検索を用いて関連記憶を探す
前提条件
- Python 3.12+
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
MCP-Mem0: Long-Term Memory for AI Agents
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!
Overview
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.
Features
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 search
Prerequisites
- Python 3.12+
- Supabase or any PostgreSQL database (for vector storage of memories)
- API keys for your chosen LLM provider (OpenAI, OpenRouter, or Ollama)
- Docker if running the MCP server as a container (recommended)
Installation
Using uv
-
Install 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
.envfile based on.env.example:cp .env.example .env -
Configure your environment variables in the
.envfile (see Configuration section)
Using Docker (Recommended)
-
Build the Docker image:
docker build -t mcp/mem0 --build-arg PORT=8050 . -
Create a
.envfile based on.env.exampleand configure your environment variables
Configuration
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 |
インストール
docker 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設定
{
"mcpServers": {
"mem0": {
"transport": "sse",
"url": "http://localhost:8050/sse"
}
}
}