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 分