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 會在 work階段開始、送出提示、回覆結束與工作階段結束時自動執行指令,儲存不需確認。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 整合