Back to MCP directory
publicPublicdnsLocal runtime

Knowledge Graph

知识图谱记忆服务器是一个基于本地知识图谱的持久化记忆系统,支持跨聊天会话记忆用户信息。

article

README

🚀 知识图谱内存服务器

知识图谱内存服务器是一款用于管理和存储知识图谱数据的工具。它能助力模型(如Claude)更好地理解和记忆与用户相关的交互信息。本文档将详细介绍该服务器的功能、使用方法及相关配置。

🚀 快速开始

若想使用知识图谱内存服务器,您需要进行配置文件设置和Smithery安装,具体步骤如下:

配置文件设置

mcp.jsonclaude_desktop_config.json中添加以下配置:

{
  "mcpServers": {
    "memory": {
      "command": "npx",
      "args": [
        "-y",
        "@itseasy21/mcp-knowledge-graph"
      ],
      "env": {
        "MEMORY_FILE_PATH": "/path/to/your/projects.jsonl"
      }
    }
  }
}

Smithery安装

通过Smithery平台自动安装:

npx -y @smithery/cli install @itseasy21/mcp-knowledge-graph --client claude

✨ 主要特性

核心概念

实体(Entities)

实体是知识图谱中的基本单元,代表具有独立存在意义的人、事物或概念。每个实体包含以下属性:

  • 标识符:唯一标识该实体的字符串。
  • 类型:描述实体所属类别的标签(如“人”、“组织”、“地点”等)。
  • 属性:描述实体特征的信息(如年龄、性别、职业等)。

关系(Relations)

关系表示两个或多个实体之间的关联。例如:

{
  "subject": "张三",
  "predicate": "工作于",
  "object": "谷歌公司"
}

观察结果(Observations)

观察结果是对实体特征的记录,通常以时间戳为索引存储。例如:

{
  "entity_id": "12345",
  "timestamp": "2023-10-01T12:00:00Z",
  "facts": [
    {
      "key": "年龄",
      "value": "30"
    },
    {
      "key": "职业",
      "value": "软件工程师"
    }
  ]
}

📦 安装指南

配置文件设置

mcp.jsonclaude_desktop_config.json中添加以下配置:

{
  "mcpServers": {
    "memory": {
      "command": "npx",
      "args": [
        "-y",
        "@itseasy21/mcp-knowledge-graph"
      ],
      "env": {
        "MEMORY_FILE_PATH": "/path/to/your/projects.jsonl"
      }
    }
  }
}

Smithery安装

通过Smithery平台自动安装:

npx -y @smithery/cli install @itseasy21/mcp-knowledge-graph --client claude

💻 使用示例

基础用法

创建实体(Create Entities)

POST /entities
{
  "entities": [
    {
      "id": "12345",
      "type": "人",
      "attributes": {
        "name": "张三",
        "age": "30"
      }
    },
    {
      "id": "67890",
      "type": "公司",
      "attributes": {
        "name": "谷歌公司",
        "location": "美国"
      }
    }
  ]
}

创建关系(Create Relations)

POST /relations
{
  "relation": {
    "subject": "张三",
    "predicate": "工作于",
    "object": "谷歌公司"
  }
}

📚 详细文档

自定义记忆路径

您可以通过以下两种方式指定自定义记忆文件路径:

  1. 命令行参数:
    {
      "mcpServers": {
        "memory": {
          "command": "npx",
          "args": ["-y", "@itseasy21/mcp-knowledge-graph", "--memory-path", "/path/to/your/memory.jsonl"]
        }
      }
    }
    
  2. 环境变量:
    {
      "mcpServers": {
        "memory": {
          "command": "npx",
          "args": ["-y", "@itseasy21/mcp-knowledge-graph"],
          "env": {
            "MEMORY_FILE_PATH": "/path/to/your/memory.jsonl"
          }
        }
      }
    }
    

如果未指定路径,默认使用memory.jsonl文件。

系统提示

根据具体应用场景,您可以调整以下系统提示以指导模型如何管理记忆:

作为记忆顾问,请协助我更好地管理和存储与用户相关的交互信息。

通过以上配置和接口,知识图谱内存服务器能够帮助模型更高效地理解和记忆用户信息,提升人机交互体验。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client