Memory Custom について
Memory Customは、MCPチームのMemoryサーバーを拡張し、プロジェクト別のメモリファイルとインタラクションのタイムスタンプに対応します。インタラクションをナレッジグラフとして保存、検索するMCPクライアント向けです。
主な機能
- 01メモリファイルのパス指定
- 02プロジェクトごとのメモリファイル
- 03インタラクションへのタイムスタンプ付与
- 04エンティティとリレーションの作成
- 05観察情報の追加と削除
- 06グラフノードの読み取り、検索、表示
活用シーン
- 01プロジェクトごとにメモリデータを分離
- 02グラフ情報の作成・変更時刻を追跡
- 03インタラクション中に保存済みのエンティティや関係を検索
MCP 対応
MCPクライアントに、パス指定、グラフの作成、取得、検索、削除などのメモリグラフ操作ツールを提供します。
設定
ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。
ツール
ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。
詳細
Memory Custom
このプロジェクトは、MCP チームが提供する Memory サーバーに新機能を追加します。LLM を通じたやり取りを記録するナレッジグラフを作成・管理できます。
新機能
1. カスタムメモリパス
- プロジェクトごとに異なるメモリファイルのパスを指定できるようになりました。
- 理由:この機能によりメモリデータの整理と管理が向上し、プロジェクトごとにメモリを保存できます。
2. タイムスタンプ
- サーバーがやり取りのタイムスタンプを生成するようになりました。
- 理由:タイムスタンプを使うと、各メモリがいつ作成または変更されたかを追跡でき、保存されたデータの背景情報や履歴をより適切に把握できます。
はじめに
前提条件
- Node.js(バージョン 16 以降)
Smithery 経由でのインストール
Smithery 経由で Claude Desktop 用 Knowledge Graph Memory Server を自動的にインストールするには:
npx -y @smithery/cli install @BRO3886/mcp-memory-custom --client claude
インストール
-
リポジトリをクローンします:
git clone [email protected]:BRO3886/mcp-memory-custom.git cd mcp-memory-custom -
依存関係をインストールします:
npm install
設定
サーバーを実行する前に、MEMORY_FILE_PATH 環境変数を設定してメモリファイルのパスを指定できます。設定しない場合、サーバーはスクリプトと同じディレクトリにある memory.json をデフォルトで使用します。
サーバーの実行
mcp server json ファイルの更新
claude_desktop_config.json / .cursor/mcp.json ファイルに以下を追加します:
{
"mcpServers": {
"memory": {
"command": "node",
"args": ["/path/to/mcp-memory-custom/dist/index.js"]
}
}
}
システムプロンプトの変更:
Follow these steps for each interaction:
1. The memoryFilePath for this project is /path/to/memory/project_name.json - always pass this path to the memory file operations (when creating entities, relations, or retrieving memory etc.)
2. User Identification:
- You should assume that you are interacting with default_user
- If you have not identified default_user, proactively try to do so.
3. Memory Retrieval:
- Always begin your chat by saying only "Remembering..." and retrieve all relevant information from your knowledge graph
- Always refer to your knowledge graph as your "memory"
4. Memory
- While conversing with the user, be attentive to any new information that falls into these categories:
a) Basic Identity (age, gender, location, job title, education level, etc.)
b) Behaviors (interests, habits, etc.)
c) Preferences (communication style, preferred language, etc.)
d) Goals (goals, targets, aspirations, etc.)
e) Relationships (personal and professional relationships up to 3 degrees of separation)
5. Memory Update:
- If any new information was gathered during the interaction, update your memory as follows:
a) Create entities for recurring organizations, people, and significant events, add timestamps to wherever required. You can get current timestamp via get_current_time
b) Connect them to the current entities using relations
c) Store facts about them as observations, add timestamps to observations via get_current_time
IMPORTANT: Provide a helpful and engaging response, asking relevant questions to encourage user engagement. Update the memory during the interaction, if required, based on the new information gathered (point 4).
サーバーをローカルで実行する
Knowledge Graph Memory Server を起動するには、以下を実行します:
npm run build
node dist/index.js
サーバーは標準入出力を介したリクエストを受け付けます。
API エンドポイント
サーバーは、特定のパラメーターを指定して呼び出せる複数のツールを公開しています:
- 現在の時刻を取得
- メモリファイルのパスを設定
- エンティティを作成
- 関係を作成
- 観察事項を追加
- エンティティを削除
- 観察事項を削除
- 関係を削除
- グラフを読み込む
- ノードを検索
- ノードを開く
謝辞
- Anthropic の Memory サーバーに着想を得ています。
コメント
AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。