X

knowledge-graph-memory-server

Information

知识图谱内存服务器 使用本地知识图谱实现的持久化内存的基本实现。这使得Claude可以在聊天中记住关于用户的信息。 核心概念 实体 实体是知识图谱中的主要节点。每个实体包含: 一个唯一的名称(标识符) 一个实体类型(例如,“人”、“组织”、“事件”) 一系列观察结果 示例: \{ "name": "John_Smith", "entityType": "person", "observations": ["Speaks fluent Spanish"] \} 关系 关系定义了实体之间的有向连接。它们总是以主动语态存储,并描述了实体之间如何互动或相互关联。 示例: \{ "from": "John_Smith", "to": "Anthropic", "relationType": "works_at" \} 观察 观察是对实体的具体信息片段。它们: 作为字符串存储 附加到特定的实体上 可以独立地添加或移除 应该是原子性的(每个观察一个事实) 示例: \{ "entityName": "John_Smith", "observations": [ "Speaks fluent Spanish", "Graduated in 2019", "Prefers morning meetings" ] \} 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" ] \} \} \} 带自定义设置的 NPX 服务器可以使用以下环境变量进行配置: \{ "mcpServers": \{ "memory": \{ "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-memory" ], "env": \{ "MEMORY_FILE_PATH": "/path/to/custom/memory.json" \} \} \} \} MEMORY_FILE_PATH: 存储 JSON 文件的路径(默认为服务器目录中的 memory.json) 系统提示 利用记忆的提示取决于用例。更改提示将有助于模型确定创建记忆的频率和类型。 这里是用于聊天个性化的一个示例提示。您可以在Claude.ai 项目的“自定义说明”字段中使用此提示。 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 b) Store facts about them as observations 构建 Docker: docker build -t mcp/memory -f src/memory/Dockerfile . 许可证 此MCP服务器根据MIT许可证进行授权。这意味着您可以自由地使用、修改和分发该软件,但需遵守MIT许可证的条款和条件。有关更多详细信息,请参阅项目仓库中的LICENSE文件。

Prompts

Reviews

Tags

Write Your Review

Detailed Ratings

ALL
Correctness
Helpfulness
Interesting
Upload Pictures and Videos

Name
Size
Type
Download
Last Modified
  • Community

Add Discussion

Upload Pictures and Videos