Skip to main content

对话记忆搜索 MCP Server — 自动导入 Claude Code / WorkBuddy / Pi 对话,FTS5 全文搜索 + BGE-M3 语义搜索,开箱即用

Project description

Rolling Memory

对话记忆搜索 MCP Server。自动导入你的 Claude Code、WorkBuddy 和 Pi 对话历史,FTS5 全文搜索,零配置。

背后的算法思想 → Rolling RAG:从两张截图到一套完整的对话记忆系统

功能

10 个 MCP 工具,开箱即用:

工具 功能
memory_search 搜当前项目对话(关键词 / 语义)
memory_search_global 全局搜索所有项目对话
memory_projects 列出所有项目及对话数量
memory_recent 最近对话活动
memory_segments 对话段列表
memory_relations 段间关系链
memory_detail 段详情 + 关系
memory_stats 数据统计概览
memory_timeline 屏幕时间线
memory_query 自由 SQL 查询(只读)

三阶段能力:

阶段 能力 条件
P1 FTS5 关键词搜索 + 时间过滤 + 最近活动 默认,开箱即用
P2 BGE-M3 语义搜索 需要 GPU + pip install mcp-rolling-memory[semantic](正在整理中)
P3 段落级搜索 + 摘要 + 关系链 需要感知引擎跑完索引(正在整理中)

安装

方式一:Claude Code + uvx(最简单,推荐)

一行搞定,无需 pip install:

claude mcp add rolling-memory -- uvx mcp-rolling-memory

uvx mcp-rolling-memory 会自动拉取 PyPI 包并运行。如果报找不到命令,改用方式二。

方式二:Claude Code + pip install

pip install mcp-rolling-memory
claude mcp add rolling-memory -- python -m rolling_memory.server

方式三:其他 MCP 客户端(Cursor / Windsurf 等)

在客户端的 MCP 配置中添加:

{
  "mcpServers": {
    "rolling-memory": {
      "command": "uvx",
      "args": ["mcp-rolling-memory"]
    }
  }
}

方式四:从源码

git clone https://github.com/1144g7/rolling-memory.git
cd rolling-memory
pip install -e .
claude mcp add rolling-memory -- python -m rolling_memory.server

注意事项

  • claude mcp add 会把配置写入 ~/.claude.json不要手动创建 .mcp.json 文件,Claude Code 无法识别
  • 添加后需要完全退出 Claude Code 再重新打开(不是新开对话,是退出应用本身)
  • 重新打开后运行 /mcp 检查是否显示 rolling-memory

首次启动

MCP Server 启动后立即就绪(秒级),后台线程自动完成:

  1. 创建 SQLite 数据库(~/.rolling-memory/memory.db
  2. 扫描 ~/.claude/projects/ 下的 Claude Code 对话
  3. 扫描 ~/.workbuddy/projects/ 下的 WorkBuddy 对话
  4. 建立 FTS5 全文索引
  5. 每 30 秒检查新对话并增量导入

首次全量扫描通常几秒钟完成。之后增量扫描只导入新对话,无新数据时几乎零开销。

使用示例

在 Claude Code 中直接提问:

  • "我之前聊过什么关于 Python 装饰器的内容?"
  • "最近一周讨论了哪些话题?"
  • "帮我找一下之前讨论的那个数据库设计方案"

数据存储

  • 数据库位置:~/.rolling-memory/memory.db(可通过 ROLLING_MEMORY_DB 环境变量修改)
  • 只读取本地数据,不上传任何内容
  • 纯 SQLite,无外部依赖

支持的数据源

数据源 路径 状态
Claude Code ~/.claude/projects/ 自动扫描
WorkBuddy ~/.workbuddy/projects/ 自动扫描
Pi ~/.pi/agent/sessions/ 自动扫描

依赖

  • Python >= 3.10
  • mcp (MCP Python SDK)

可选:

  • numpy + FlagEmbedding(语义搜索,P2)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_rolling_memory-0.2.0.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_rolling_memory-0.2.0-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file mcp_rolling_memory-0.2.0.tar.gz.

File metadata

  • Download URL: mcp_rolling_memory-0.2.0.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for mcp_rolling_memory-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0c48a64b94f174d37b474ad1f8ce8d83bb97109c36eac8598352a3bac6928366
MD5 1d506652449e2750d65153c2176b4c8f
BLAKE2b-256 0fdd4432a2417b0c7cc2edc9704da7629942c99605a36cf0f1c113526ee86423

See more details on using hashes here.

File details

Details for the file mcp_rolling_memory-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_rolling_memory-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 561a616d1658732c2befadf27b94e22fb6fee2ab4299f12ea86e0d27c69b2205
MD5 23a78f3a800f2e4016b6ae0786089494
BLAKE2b-256 12ce5631e098cc5961c39d00e738e0915e63d98a5a457c39fd5d72a83b56bba9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page