VOOZH about

URL: https://glama.ai/mcp/servers/modelcontextprotocol/knowledge-graph-memory-server?locale=ja-JP

⇱ ナレッジグラフ・メモリサーバー by modelcontextprotocol | Glama


ナレッジグラフ・メモリサーバー

ローカルのナレッジグラフを使用した永続メモリの基本的な実装です。これにより、Claudeはチャットをまたいでユーザーに関する情報を記憶できるようになります。

基本概念

エンティティ

エンティティは、ナレッジグラフにおける主要なノードです。各エンティティは以下を持ちます:

  • 一意の名前(識別子)

  • エンティティタイプ(例:「人物」、「組織」、「イベント」)

  • 観測結果のリスト

例:

{
 "name": "John_Smith",
 "entityType": "person",
 "observations": ["Speaks fluent Spanish"]
}

関係

関係は、エンティティ間の有向接続を定義します。これらは常に能動態で保存され、エンティティがどのように相互作用または関連しているかを表します。

例:

{
 "from": "John_Smith",
 "to": "Anthropic",
 "relationType": "works_at"
}

観測結果

観測結果は、エンティティに関する個別の情報です。これらは以下の特徴を持ちます:

  • 文字列として保存される

  • 特定のエンティティに紐付けられる

  • 独立して追加または削除が可能

  • アトミックであるべき(1つの観測につき1つの事実)

例:

{
 "entityName": "John_Smith",
 "observations": [
 "Speaks fluent Spanish",
 "Graduated in 2019",
 "Prefers morning meetings"
 ]
}

Related MCP server: Knowledge Graph Memory Server

API

ツール

  • create_entities

    • ナレッジグラフに複数の新しいエンティティを作成する

    • 入力: entities (オブジェクトの配列)

      • 各オブジェクトの内容:

        • name (文字列): エンティティ識別子

        • entityType (文字列): 型の分類

        • observations (文字列[]): 関連する観測結果

    • 既存の名前を持つエンティティは無視される

  • create_relations

    • エンティティ間に複数の新しい関係を作成する

    • 入力: relations (オブジェクトの配列)

      • 各オブジェクトの内容:

        • from (文字列): ソースエンティティ名

        • to (文字列): ターゲットエンティティ名

        • relationType (文字列): 能動態での関係タイプ

    • 重複する関係はスキップされる

  • add_observations

    • 既存のエンティティに新しい観測結果を追加する

    • 入力: observations (オブジェクトの配列)

      • 各オブジェクトの内容:

        • entityName (文字列): ターゲットエンティティ

        • contents (文字列[]): 追加する新しい観測結果

    • エンティティごとの追加された観測結果を返す

    • エンティティが存在しない場合は失敗する

  • delete_entities

    • エンティティとその関係を削除する

    • 入力: entityNames (文字列[])

    • 関連する関係の連鎖削除を行う

    • エンティティが存在しない場合は何も行わない

  • delete_observations

    • エンティティから特定の観測結果を削除する

    • 入力: deletions (オブジェクトの配列)

      • 各オブジェクトの内容:

        • entityName (文字列): ターゲットエンティティ

        • observations (文字列[]): 削除する観測結果

    • 観測結果が存在しない場合は何も行わない

  • delete_relations

    • グラフから特定の関係を削除する

    • 入力: relations (オブジェクトの配列)

      • 各オブジェクトの内容:

        • from (文字列): ソースエンティティ名

        • to (文字列): ターゲットエンティティ名

        • relationType (文字列): 関係タイプ

    • 関係が存在しない場合は何も行わない

  • read_graph

    • ナレッジグラフ全体を読み取る

    • 入力不要

    • すべてのエンティティと関係を含む完全なグラフ構造を返す

  • search_nodes

    • クエリに基づいてノードを検索する

    • 入力: query (文字列)

    • 検索対象:

      • エンティティ名

      • エンティティタイプ

      • 観測結果の内容

    • 一致するエンティティとその関係を返す

  • open_nodes

    • 名前を指定して特定のノードを取得する

    • 入力: names (文字列[])

    • 戻り値:

      • 要求されたエンティティ

      • 要求されたエンティティ間の関係

    • 存在しないノードは静かにスキップされる

Claude Desktopでの使用方法

セットアップ

claude_desktop_config.json に以下を追加します:

Docker

{
 "mcpServers": {
 "memory": {
 "command": "docker",
 "args": ["run", "-i", "-v", "claude-memory:/app/dist", "--rm", "mcp/memory"]
 }
 }
}

NPX

{
 "mcpServers": {
 "memory": {
 "command": "npx",
 "args": [
 "-y",
 "@modelcontextprotocol/server-memory"
 ]
 }
 }
}

Windowsでは、npx を起動するために cmd /c を使用します:

{
 "mcpServers": {
 "memory": {
 "command": "cmd",
 "args": [
 "/c",
 "npx",
 "-y",
 "@modelcontextprotocol/server-memory"
 ]
 }
 }
}

カスタム設定付きNPX

サーバーは以下の環境変数を使用して設定できます:

{
 "mcpServers": {
 "memory": {
 "command": "npx",
 "args": [
 "-y",
 "@modelcontextprotocol/server-memory"
 ],
 "env": {
 "MEMORY_FILE_PATH": "/path/to/custom/memory.jsonl"
 }
 }
 }
}

Windowsでは以下を使用します:

{
 "mcpServers": {
 "memory": {
 "command": "cmd",
 "args": [
 "/c",
 "npx",
 "-y",
 "@modelcontextprotocol/server-memory"
 ],
 "env": {
 "MEMORY_FILE_PATH": "/path/to/custom/memory.jsonl"
 }
 }
 }
}
  • MEMORY_FILE_PATH: メモリ保存用JSONLファイルのパス(デフォルト: サーバーディレクトリ内の memory.jsonl

VS Codeインストール手順

クイックインストールには、以下のワンクリックインストールボタンのいずれかを使用してください:

👁 Install with NPX in VS Code
👁 Install with NPX in VS Code Insiders

👁 Install with Docker in VS Code
👁 Install with Docker in VS Code Insiders

手動インストールの場合、以下のいずれかの方法でMCPサーバーを設定できます:

方法1: ユーザー設定(推奨) ユーザーレベルのMCP設定ファイルに設定を追加します。コマンドパレット(Ctrl + Shift + P)を開き、MCP: Open User Configuration を実行します。これによりユーザーの mcp.json ファイルが開かれ、サーバー設定を追加できます。

方法2: ワークスペース設定 あるいは、ワークスペース内の .vscode/mcp.json というファイルに設定を追加することもできます。これにより、設定を他のユーザーと共有できます。

VS CodeでのMCP設定の詳細については、公式のVS Code MCPドキュメントを参照してください。

NPX

{
 "servers": {
 "memory": {
 "command": "npx",
 "args": [
 "-y",
 "@modelcontextprotocol/server-memory"
 ]
 }
 }
}

Windowsでは以下を使用します:

{
 "servers": {
 "memory": {
 "command": "cmd",
 "args": [
 "/c",
 "npx",
 "-y",
 "@modelcontextprotocol/server-memory"
 ]
 }
 }
}

Docker

{
 "servers": {
 "memory": {
 "command": "docker",
 "args": [
 "run",
 "-i",
 "-v",
 "claude-memory:/app/dist",
 "--rm",
 "mcp/memory"
 ]
 }
 }
}

システムプロンプト

メモリを利用するためのプロンプトはユースケースによって異なります。プロンプトを変更することで、モデルが作成するメモリの頻度や種類を決定するのに役立ちます。

以下はチャットのパーソナライズのためのプロンプト例です。このプロンプトは Claude.ai Project の「カスタム指示」フィールドで使用できます。

Follow these steps for each interaction:

1. User Identification:
 - You should assume that you are interacting with default_user
 - If you have not identified default_user, proactively try to do so.

2. 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"

3. 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)

4. 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
 b) Connect them to the current entities using relations
 c) Store facts about them as observations

ビルド

Docker:

docker build -t mcp/memory -f src/memory/Dockerfile . 

注意: 以前の mcp/memory ボリュームには、新しいコンテナによって上書きされる可能性のある index.js ファイルが含まれている場合があります。ストレージにDockerボリュームを使用している場合は、新しいコンテナを起動する前に、古いDockerボリュームの index.js ファイルを削除してください。

ライセンス

このMCPサーバーはMITライセンスの下でライセンスされています。これは、MITライセンスの条件に従う限り、ソフトウェアを自由に使用、変更、配布できることを意味します。詳細については、プロジェクトリポジトリ内のLICENSEファイルを参照してください。

A
license - permissive license
B
quality
B
maintenance

Maintenance

Maintainers
18dResponse time
5wRelease cycle
7Releases (12mo)
Commit activity
Issues opened vs closed

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/modelcontextprotocol/knowledge-graph-memory-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server