SQLite内存插件

一个基于Python和SQLite的持久化内存存储插件,用于跨会话存储和管理数据。

  • by mekanixms
  • Python
  • 本地部署
  • 6 星标
  • 更新于
在 GitHub 查看 mekanixms/mcp_memory_plugin

使用说明

内存插件

一个基于Python的内存插件,使用SQLite进行持久存储。

概述

此插件使用SQLite作为后端数据库提供内存存储功能。它旨在跨会话持久地存储和管理数据。

设置

  1. 环境配置

    创建一个 .env 根目录中的文件,配置如下:

    MEMORY_DB_PATH=/path/to/your/memory.sqlite
    
    

    您可以使用提供的 .env.example 作为模板:

    cp .env.example .env
    
  2. 依赖项

    该项目需要Python,并使用SQLite进行数据存储。确保你的系统上安装了Python。

配置

  1. 将.env.example.重命名为.env,并根据需要编辑值:

  2. 找到claude_desktop_config.json,并使用下面的模板将“MQTT Bridge”添加到mcpServers部分。 MacOs:~/库/应用支持/Claude/Claude_desktop_config json Windows:C:\用户<用户名>\AppData\Roaming\Claude\Claude_desktop_config json

{
  "mcpServers": {
    "memory_recall": {
      "command": "/path/to/python3",
      "args": [
        "/path/2/your/cloned/repository/memory_plugin.py"
      ]
    }
  }
}

SQLite数据库路径是通过以下方式配置的 MEMORY_DB_PATH 环境变量。这应该指向您希望存储SQLite数据库文件的位置。

当前配置:

MEMORY_DB_PATH=/path/to/your/dabatase.sqlite

用法

基本用法

请参阅memory_plugin.py文件中的@mcp.resource和@mcp.tool修饰函数

在聊天中键入的示例:

  • memory://load 在新的聊天开始时加载保存的记忆
  • Save into the memory, under aNewName category, the following: a new message with important info to remember
  • Save the relevant points of the conversation into the memory under aNewName category

发展

在为该项目做出贡献时:

  1. 确保不要提交敏感信息
  2. 保持你的 .env 文件私有
  3. 使用 .env.example 用于共享模板配置

许可证

该项目根据MIT许可证获得许可。