A Mem Mcp

io.github.DiaaAj由 GitHub 帳號 DiaaAj 發布v0.2.1更新於 Oct 24, 2026

Self-evolving memory system for AI agents

已驗證STDIO僅桌面知識與記憶開發者工具

概覽

AI 產生的概覽

一個本機 MCP 伺服器,為編碼代理提供可自我演化、圖結構的專案知識記憶庫。

可以做什麼
A-MEM 會保存助理新增的筆記,透過 LLM 擷取關鍵字、上下文與標籤,再把新筆記與語意相近的既有記憶連結起來,並隨時間演化這些關聯。它提供八個工具:add_memory_note、search_memories、search_memories_agentic、search_memories_by_time、read_memory_note、update_memory_note、delete_memory_note 與 check_task_status。檢索結合向量相似度與圖形走訪,並採用先瀏覽中繼資料、再視需要讀取完整內容的方式以節省 token。記憶會保存在 ChromaDB 中。
適用情境
適合讓編碼代理跨工作階段記住決策、慣例與上下文,不必每次重新推導。最適合使用 Claude Code、希望擁有依專案隔離且會持續成長與連結的記憶(而非單純向量資料庫)的使用者。
執行需求
以 Python 套件形式在本機透過 stdio 執行(pip install a-mem),僅支援桌面端。需要設定 LLM 後端:LLM_BACKEND(openai、ollama、sglang 或 openrouter)與 LLM_MODEL。當 LLM_BACKEND=openai 時必須提供 OPENAI_API_KEY;使用 OpenRouter 需要其對應金鑰。選用設定包括 EMBEDDING_MODEL、CHROMA_DB_PATH 與 EVO_THRESHOLD。在 Claude Code 中會自動安裝工作階段啟動掛鉤。
安裝前請注意
OPENAI_API_KEY(或 OpenRouter 金鑰)以明文寫在 MCP 伺服器設定中,請妥善保護該設定檔。筆記內容會傳送到所設定的 LLM 後端以擷取關鍵字、標籤與上下文,嵌入向量可能在本機或遠端計算,取決於所選的嵌入模型。此伺服器可以更新與刪除已儲存的記憶;除非修改 CHROMA_DB_PATH,記憶預設依專案存放在 ./chroma_db。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 A Mem Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

A-MEM: Self-evolving memory for coding agents

[PyPI version] [PyPI downloads] [MCP Registry]

mcp-name: io.github.DiaaAj/a-mem-mcp

A-MEM is a self-evolving memory system for coding agents. Unlike simple vector stores, A-MEM automatically organizes knowledge into a Zettelkasten-style graph with dynamic relationships. Memories don't just get stored—they evolve and connect over time.

Currently tested with Claude Code. Support for other MCP-compatible agents is planned.

[圖片]

Quick Start

Install

bash
pip install a-mem

Add to Claude Code

bash
claude mcp add a-mem -s user -- a-mem-mcp \  -e LLM_BACKEND=openai \  -e LLM_MODEL=gpt-4o-mini \  -e OPENAI_API_KEY=sk-...

That's it! A session-start hook installs automatically to remind Claude to use memory.

Note: Memory is stored per-project in ./chroma_db. For global memory across all projects, see Memory Scope.

Uninstall

bash
a-mem-uninstall-hook   # Remove hooks firstpip uninstall a-mem

How It Works

t=0              t=1                t=2
                 ◉───◉             ◉───◉ ◉               │                 ╱ │ ╲                 ◉                ◉──┼──◉                                     │                                     ◉
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━▶            self-evolving memory
  1. Add a memory → A-MEM extracts keywords, context, and tags via LLM
  2. Find neighbors → Searches for semantically similar existing memories
  3. Evolve → Decides whether to link, strengthen connections, or update related memories
  4. Store → Persists to ChromaDB with full metadata and relationships

The result: a knowledge graph that grows smarter over time, not just bigger.

Features

Self-Evolving Memory Memories aren't static. When you add new knowledge, A-MEM automatically finds related memories and strengthens connections, updates context, and evolves tags.

Semantic + Structural Search Combines vector similarity with graph traversal. Find memories by meaning, then explore their connections.

Peek and Drill Start with breadth-first search to capture relevant memories via lightweight metadata (id, context, keywords, tags). Then drill depth-first into specific memories with read_memory_note for full content. This minimizes token usage while maximizing recall.

MCP Tools

A-MEM exposes 8 tools to your coding agent:

ToolDescription
add_memory_noteStore new knowledge (async, returns immediately)
search_memoriesSemantic search across all memories
search_memories_agenticSearch + follow graph connections
search_memories_by_timeSearch within a time range
read_memory_noteGet full details (supports bulk reads)
update_memory_noteModify existing memory
delete_memory_noteRemove a memory
check_task_statusCheck async task completion

Example Usage

python
# The agent calls these automatically, but here's what happens:
# Store a memory (returns task_id immediately)add_memory_note(content="Auth uses JWT in httpOnly cookies, validated by AuthMiddleware")
# Search latersearch_memories(query="authentication flow", k=5)
# Deep search with connectionssearch_memories_agentic(query="security", k=5)

Advanced Configuration

JSON Config

For more control, edit ~/.claude/settings.json (global) or .claude/settings.local.json (project):

json
{  "mcpServers": {    "a-mem": {      "command": "a-mem-mcp",      "env": {        "LLM_BACKEND": "openai",        "LLM_MODEL": "gpt-4o-mini",        "OPENAI_API_KEY": "sk-..."      }    }  }}

Environment Variables

VariableDescriptionDefault
LLM_BACKENDopenai, ollama, sglang, openrouteropenai
LLM_MODELModel namegpt-4o-mini
OPENAI_API_KEYOpenAI API key—
EMBEDDING_MODELSentence transformer modelall-MiniLM-L6-v2
CHROMA_DB_PATHStorage directory./chroma_db
EVO_THRESHOLDEvolution trigger threshold100

Memory Scope

  • Project-specific (default): Each project gets isolated memory in ./chroma_db
  • Global: Share across projects by setting CHROMA_DB_PATH=~/.local/share/a-mem/chroma_db

Alternative Backends

Ollama (local, free)

bash
claude mcp add a-mem -s user -- a-mem-mcp \  -e LLM_BACKEND=ollama \  -e LLM_MODEL=llama2

OpenRouter (100+ models)

bash
claude mcp add a-mem -s user -- a-mem-mcp \  -e LLM_BACKEND=openrouter \  -e LLM_MODEL=anthropic/claude-3.5-sonnet \  -e OPENROUTER_API_KEY=sk-or-...

Hook Management (Claude Code)

The session-start hook reminds Claude to use memory tools. It installs automatically with Claude Code, but you can manage it manually:

bash
a-mem-install-hook     # Install/reinstall hooka-mem-uninstall-hook   # Remove hook completely

Python API

Use A-MEM directly in Python (works with any agent or application):

python
from agentic_memory.memory_system import AgenticMemorySystem
memory = AgenticMemorySystem(    llm_backend="openai",    llm_model="gpt-4o-mini")
# Add (auto-generates keywords, tags, context)memory_id = memory.add_note("FastAPI app uses dependency injection for DB sessions")
# Searchresults = memory.search("database patterns", k=5)
# Read full detailsnote = memory.read(memory_id)print(note.keywords, note.tags, note.links)

Research

A-MEM implements concepts from the paper:

A-MEM: Agentic Memory for LLM Agents Xu et al., 2025 arXiv:2502.12110

來源:README.md,提交 dce0ac6

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

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

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分