Memory Mcp

io.github.chenxiaofie由 GitHub 账号 chenxiaofie 发布v0.2.1更新于 Oct 24, 2026

情景+实体记忆 MCP 服务,为 Claude Code 提供持久化记忆能力

发布方自己的服务:Memory.fit

已验证STDIO仅桌面知识与记忆开发者工具

概览

AI 生成的概览

为 Claude Code 提供持久化记忆:保存对话情景与实体,并在后续会话中召回相关历史。

可以做什么
这是一个面向 Claude Code 的本地 MCP 服务,把每次会话保存为一个情景并自动生成摘要,同时抽取决策、架构、偏好、习惯等实体。工具包括 memory_start_episode、memory_close_episode、memory_add_entity、用于语义检索的 memory_recall、memory_search_by_type、memory_list_episodes 和 memory_stats。存储分为两层:用户级(跨项目共享)与项目级(按项目隔离)。配置可选的 Claude Code hooks 后,保存与召回可全自动完成。
适用场景
适合希望 Claude Code 跨会话记住决策、偏好和以往讨论、不必反复补充背景的场景,尤其是需要长期连续性的项目。若不配置 hooks,则需要手动调用记忆工具。
运行要求
需要本地 Python 运行时,版本 3.10 至 3.13(chromadb 不兼容 3.14 及以上),通过 uv/uvx 运行。首次初始化会下载约 400MB 的向量模型。环境变量 CLAUDE_PROJECT_ROOT 用于指定项目根目录路径。仅支持桌面端,未声明身份验证。
安装前请注意
对话内容(包括决策与偏好)会保存到本地存储:~/.claude-memory/ 以及项目的 .claude/memory/ 目录。hooks 会在会话开始、提交提示、回复结束和会话结束时自动执行命令,保存无需确认。memory_clear_cache、memory_cleanup_messages 等工具会删除已存数据。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Memory Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Memory MCP Service

[PyPI version] [Python] [License: MIT]

English | 中文

A persistent memory MCP service for Claude Code. Automatically saves conversations and retrieves relevant history across sessions.

What it does: Every time you chat with Claude Code, your conversation context (decisions, preferences, key discussions) is saved and automatically recalled in future sessions — so Claude always has the background it needs. [Memory recall demo - retrieving past session history]

Quick Start

Prerequisites

Install uv (Python package runner):

bash
# Windowspowershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# Mac/Linuxcurl -LsSf https://astral.sh/uv/install.sh | sh

Requires Python 3.10 - 3.13 (chromadb is not compatible with Python 3.14+).

1. Initialize (First Time Only)

Download the vector model (~400MB, one-time):

bash
uvx --from chenxiaofie-memory-mcp memory-mcp-init

2. Add MCP Server to Claude Code

bash
claude mcp add memory-mcp -s user -- uvx --from chenxiaofie-memory-mcp memory-mcp

3. Configure Hooks (Recommended)

Hooks enable fully automatic message saving. Without hooks, you need to manually call memory tools.

Add the following to ~/.claude/settings.json:

json
{  "hooks": {    "SessionStart": [{      "matcher": ".*",      "hooks": [{ "type": "command", "command": "uvx --from chenxiaofie-memory-mcp memory-mcp-session-start" }]    }],    "UserPromptSubmit": [{      "matcher": ".*",      "hooks": [{ "type": "command", "command": "uvx --from chenxiaofie-memory-mcp memory-mcp-auto-save" }]    }],    "Stop": [{      "matcher": ".*",      "hooks": [{ "type": "command", "command": "uvx --from chenxiaofie-memory-mcp memory-mcp-save-response" }]    }],    "SessionEnd": [{      "matcher": ".*",      "hooks": [{ "type": "command", "command": "uvx --from chenxiaofie-memory-mcp memory-mcp-session-end" }]    }]  }}

4. Verify

bash
claude mcp list

You should see memory-mcp: ... - ✓ Connected.

That's it! Start a new Claude Code session and your conversations will be automatically saved and recalled.

How It Works

Session Start ──► Create Episode ──► Monitor Process (background)                                          │User Message  ──► Save Message ──► Recall Related Memories ──► Inject Context                                          │Claude Reply  ──► Save Response           │                                          │Session End   ──► Close Signal ──► Archive Episode + Generate Summary
  • Episodes: Each conversation session is an "episode" with auto-generated summaries
  • Entities: Key knowledge extracted from conversations (decisions, preferences, concepts)
  • Dual-layer storage: User-level (shared across projects) + Project-level (isolated per project)
  • Semantic search: Vector-based retrieval finds relevant past context

Usage

Automatic Mode (With Hooks)

Once hooks are configured, everything is automatic. Claude will see relevant history from past sessions as context.

Manual Mode

You can also call memory tools directly in Claude Code:

# Start a new episodememory_start_episode("Login Feature Development", ["auth"])
# Record a decisionmemory_add_entity("Decision", "Use JWT + Redis", "For distributed deployment")
# Search historymemory_recall("login implementation")
# Close episodememory_close_episode("Completed JWT login feature")

Hooks Reference

HookWhat it doesTiming
SessionStartCreates a new episode~50ms
UserPromptSubmitSaves user message + retrieves related memories~1-2s
StopSaves assistant response~1s
SessionEndSignals episode closure~50ms

Tools Reference

ToolDescription
memory_start_episodeStart a new episode
memory_close_episodeClose and archive current episode
memory_get_current_episodeGet current active episode
memory_add_entityAdd a knowledge entity
memory_confirm_entityConfirm a detected entity candidate
memory_reject_candidateReject a false detection
memory_deprecate_entityMark an entity as outdated
memory_get_pendingList pending entity candidates
memory_recallSemantic search across episodes and entities
memory_search_by_typeSearch entities by type
memory_get_episode_detailGet full episode details
memory_list_episodesList all episodes chronologically
memory_statsGet system statistics
memory_encoder_statusCheck vector encoder status
memory_cache_messageManually cache a message
memory_clear_cacheClear message cache
memory_cleanup_messagesClean up old cached messages

Entity Types

TypeLevelDescription
DecisionProjectTechnical decisions for this project
ArchitectureProjectArchitecture designs
FileProjectImportant file descriptions
PreferenceUserPersonal preferences (shared across projects)
ConceptUserGeneral concepts
HabitUserWork habits

Storage Locations

  • User-level: ~/.claude-memory/
  • Project-level: {project-root}/.claude/memory/
Alternative: Install from source

If you need to run from source (e.g., for development):

bash
git clone https://github.com/chenxiaofie/memory-mcp.gitcd memory-mcp# Windows:install.bat# Mac/Linux:chmod +x install.sh && ./install.sh

Then configure MCP server with the venv Python:

bash
# Windows:claude mcp add memory-mcp -s user -- "C:\path\to\memory-mcp\venv310\Scripts\python.exe" -m memory_mcp.server
# Mac/Linux:claude mcp add memory-mcp -s user -- /path/to/memory-mcp/venv310/bin/python -m memory_mcp.server

Author

陈佳俊 (Jiajun Chen) — front-end engineer based in Hangzhou, China. GitHub @chenxiaofie · [email protected]

本项目由陈佳俊(GitHub: chenxiaofie)开发并维护。

License

MIT License - see LICENSE file for details.

来源:README.md,提交 40e5525

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.2.1最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

其他 Memory 集成