Token导航 LogoToken导航TokenDH.com
Optimized Memory MCP Server logo
数据服务stdio官方级别未说明来源级核验

Optimized Memory MCP Server

MCP Server

一个基于本地知识图谱的持久化记忆服务器,允许Claude AI在多个聊天会话中记住用户信息。

工具数

0

提示词数

0

GitHub Stars

6

资源数

0
知识图谱PythonClaudeAI记忆Claude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

AgentWong

提供方

AgentWong

最后核验

2026/5/17 20:22

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install -r requirements.txt\"

详细介绍

优化内存mcp服务器

这是为了测试和演示Claude AI的编码能力,以及良好的AI工作流程和快速设计。 这是Python内存MCP服务器的一个分支(我相信官方的是Java),它使用SQLite作为后端。

知识图谱存储服务器

使用局部知识图的持久内存的基本实现。这让克劳德在聊天中记住用户的信息。

核心概念

实体

实体是知识图中的主要节点。每个实体都有:

  • 唯一名称(标识符)
  • 实体类型(例如,“人”、“组织”、“事件”)
  • 观察结果列表

例子:

{
  "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 (string):实体标识符 - entityType (string):类型分类 - observations (string\[\]):相关观测值 - 忽略具有现有名称的实体

  • 创建关系

- 在实体之间创建多个新关系 - 输入: relations (对象数组) - 每个对象包含: - from (string):源实体名称 - to (string):目标实体名称 - relationType (string):主动语态中的关系类型 - 跳过重复关系

  • 添加观察结果

- 向现有实体添加新的观察结果 - 输入: observations (对象数组) - 每个对象包含: - entityName (string):目标实体 - contents (string\[\]):要添加的新观测值 - 返回每个实体添加的观测值 - 如果实体不存在,则失败

  • 删除内容

- 删除实体及其关系 - 输入: entityNames (字符串\[\]) - 级联删除关联关系 - 如果实体不存在,则进行静默操作

  • 删除观察

- 从实体中删除特定观察结果 - 输入: deletions (对象数组) - 每个对象包含: - entityName (string):目标实体 - observations (string\[\]):要删除的观察值 - 如果不存在观察,则静音操作

  • 删除关系

- 从图中删除特定关系 - 输入: relations (对象数组) - 每个对象包含: - from (string):源实体名称 - to (string):目标实体名称 - relationType (string):关系类型 - 如果关系不存在,则进行静默操作

  • read_graph

- 阅读整个知识图谱 - 无需输入 - 返回包含所有实体和关系的完整图结构

  • 搜索节点

- 基于查询搜索节点 - 输入: query (字符串) - 搜索范围: - 实体名称 - 实体类型 - 观察内容 - 返回匹配的实体及其关系

  • open_nodes

- 按名称检索特定节点 - 输入: names (字符串\[\]) - 退货: - 被请求的实体 - 被请求实体之间的关系 - 静默跳过不存在的节点

使用Claude Desktop

设置

将此添加到您的claude_desktop_config.json中:

码头工人

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

NPX

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

系统提示

使用内存的提示取决于用例。更改提示将有助于模型确定创建记忆的频率和类型。

这是一个聊天个性化提示示例。您可以在“自定义说明”字段中使用此提示 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文件。

目录标签

目录标签

知识图谱PythonClaudeAI记忆本地部署持久化存储实体关系数据管理

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP