MCP内存知识图谱管理器
一种定制的MCP内存服务器,它能够通过语言模型捕获交互来创建和管理知识图谱,具有自定义内存路径和时间戳等功能。
可用工具 (11 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
get_current_time
Get the current time
该工具无需必填参数,直接调用即可
set_memory_file_path 1 个参数 需填 1 项
Set the memory file path
必填参数:memoryFilePath
create_entities 1 个参数 需填 1 项
Create multiple new entities in the knowledge graph
必填参数:entities
create_relations 1 个参数 需填 1 项
Create multiple new relations between entities in the knowledge graph. Relations should be in active voice
必填参数:relations
add_observations 1 个参数 需填 1 项
Add new observations to existing entities in the knowledge graph
必填参数:observations
delete_entities 1 个参数 需填 1 项
Delete multiple entities and their associated relations from the knowledge graph
必填参数:entityNames
delete_observations 1 个参数 需填 1 项
Delete specific observations from entities in the knowledge graph
必填参数:deletions
delete_relations 1 个参数 需填 1 项
Delete multiple relations from the knowledge graph
必填参数:relations
read_graph
Read the entire knowledge graph
该工具无需必填参数,直接调用即可
search_nodes 1 个参数 需填 1 项
Search for nodes in the knowledge graph based on a query
必填参数:query
open_nodes 1 个参数 需填 1 项
Open specific nodes in the knowledge graph by their names
必填参数:names
服务介绍
Memory Custom
该项目为MCP团队提供的Memory服务器增加了新功能。它允许通过语言模型(LLM)创建和管理知识图谱,以捕捉交互。
新功能
1. 自定义记忆路径
- 用户现在可以为不同的项目指定不同的记忆文件路径。
- 为什么?:此功能增强了对记忆数据的组织和管理,允许针对特定项目的记忆存储。
2. 时间戳
- 服务器现在为交互生成时间戳。
- 为什么?:时间戳能够追踪每条记忆创建或修改的时间,为存储的数据提供更好的上下文和历史记录。
开始使用
前提条件
- Node.js(版本16或更高)
通过Smithery安装
要通过Smithery自动安装适用于Claude Desktop的知识图谱记忆服务器:
npx -y @smithery/cli install @BRO3886/mcp-memory-custom --client claude
安装
-
克隆仓库:
git clone git@github.com:BRO3886/mcp-memory-custom.git cd mcp-memory-custom -
安装依赖项:
npm install
配置
在运行服务器之前,您可以设置MEMORY_FILE_PATH环境变量来指定记忆文件的路径。如果不设置,默认情况下服务器将使用脚本所在目录下的memory.json。
运行服务器
更新mcp服务器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).
本地运行服务器
要启动知识图谱记忆服务器,请运行:
npm run build
node dist/index.js
服务器将通过标准输入/输出监听请求。
API端点
服务器提供了几个可以通过特定参数调用的工具:
- 获取当前时间
- 设置记忆文件路径
- 创建实体
- 创建关系
- 添加观察
- 删除实体
- 删除观察
- 删除关系
- 读取图谱
- 搜索节点
- 打开节点
致谢
- 受Anthropic的记忆服务器启发。