mcp-memory README

The project's README from github.com/fellowgeek/mcp-memory. As one markdown file: README.md.

MCP-Memory: OKF-Backed Agent Memory Server

MCP-Memory is a Model Context Protocol (MCP) server that equips AI agents (such as Claude Desktop, Cursor, Antigravity, Windsurf, or Codex) with persistent, long-term memory capabilities.

Memory records are formatted using the Open Knowledge Format (OKF v0.2) standard and indexed with a local SQLite instance (supporting FTS5 full-text search) for fast key-value lookups, tag filtering, and content search.

Fast Track: Jump directly to Quick Start


Key Features


MCP Tools

The server exposes six MCP tools to interacting agents:

1. memory_store

Stores or updates a memory record in OKF v0.2 format.

2. memory_retrieve

Retrieves a specific memory by its key and namespace.

3. memory_search

Finds memories matching keywords, tags, or namespace filters.

4. memory_delete

Removes a specific memory record by its key and namespace, from both the SQLite index and the memory/ bundle on disk.

5. memory_get_last

AGENT DIRECTIVE (Session Start): Retrieves the last recorded session checkpoint (system/last_memory) so the AI agent immediately knows where work was left off when opening a project or starting a session.

6. memory_update_last

AGENT DIRECTIVE (Milestones & Progress): Updates the canonical session checkpoint (system/last_memory) whenever completing a milestone, making key changes, or pausing work.


OKF (Open Knowledge Format) Structure

Every stored memory strictly adheres to the OKF v0.2 specification (SPEC.md & OKF_RULES.md):

---
type: Agent Memory
title: Coding Style
key: user/preferences/coding_style
namespace: default
tags:
- preferences
- style
status: stable
generated:
  by: mcp-memory/0.2.0
  at: '2026-08-12T19:23:35Z'
created_at: '2026-08-12T19:23:35Z'
updated_at: '2026-08-12T19:23:35Z'
---

User prefers functional programming style with explicit type annotations.

Quick Start

1. Clone the Repository

git clone https://github.com/fellowgeek/mcp-memory
cd mcp-memory

2. Interactive Setup Wizard

Run setup.py to auto-detect and register mcp-memory with your AI tools:

python3 setup.py

Note: Once setup.py finishes configuring your tools, your AI client will launch mcp-memory automatically in the background whenever needed. You do not need to manually start or keep a server process running in your terminal.

3. Run Manually via CLI (Optional / Debugging)

If you want to manually verify startup, inspect stdio output, or pre-initialize the virtual environment (.venv), you can run run.sh directly:

./run.sh

Manual Client Configuration

If you prefer to configure your MCP client manually, add the "memory" server entry pointing to run.sh:

JSON Configuration (Antigravity, Claude Desktop, Cursor, Windsurf)

Add to your client's mcp_config.json or claude_desktop_config.json:

{
  "mcpServers": {
    "memory": {
      "command": "/ABSOLUTE/PATH/TO/run.sh"
    }
  }
}

TOML Configuration (Codex Desktop)

Add to ~/.codex/config.toml:

[mcp_servers.memory]
command = "/ABSOLUTE/PATH/TO/run.sh"

CLI Configuration


Testing

Run the automated test suite to verify OKF serialization, SQLite database operations, and FastMCP tool execution:

python3 test_memory.py

Storage & Environment Variables

By default, mcp-memory creates project-isolated memory stores inside each project's root directory:

You can customize this behavior using environment variables:

Tip: If you prefer a single global memory store shared across all projects, set MCP_MEMORY_DB_PATH=~/.mcp_memory/memories.db and MCP_MEMORY_DIR=~/.mcp_memory/memory in your client's MCP configuration.

mcp-memory (fellowgeek/mcp-memory)

Searching Database…

这是什么?一个 MCP 服务器,为 AI 代理提供持久的长期记忆——跨会话依然保留的有状态笔记,以 Open Knowledge Format 格式存储,并建立在本地 SQLite 数据库中,方便快速检索。
这是一个需要单独运行的应用,还是能接入我已在用的工具?它接入支持 MCP 的客户端:只需注册一次,AI 客户端就会在需要时自动在后台启动它——你自己完全不用启动或维护任何服务器进程。
怎么安装设置?克隆仓库后运行安装向导:python3 setup.py。它会自动检测你已安装的 MCP 工具并注册该服务器;文档里也提供了手动配置 JSON、TOML 和命令行的方式。
它支持哪些 AI 客户端?Claude Desktop、Cursor、Antigravity、Windsurf 和 Codex(桌面版和命令行版),另外还有 Claude Code CLI。这是一个 Python 项目,所以你的电脑上需要装有 Python 3。
记忆能在不同项目之间共用吗,还是每个项目各存各的?默认情况下每个项目都有自己独立的存储:项目根目录下有一个 Markdown 文件组成的 memory/ 文件夹,外加一个隐藏的 .mcpmemory/memories.db 索引。也可以通过环境变量把两者指向同一个全局共享存储。
这些记忆数据会离开我的电脑吗?不会——记忆以纯 .md 文件和本地 SQLite 数据库的形式保存在你自己的磁盘上。README 中没有提到任何云服务、账号或数据收集。
我的 AI 代理实际能用这些记忆做什么?提供六个 MCP 工具:存储或更新记录、按键读取、按关键词、标签或命名空间搜索(可限制结果数量)以及删除——还有一对检查点工具(memorygetlast / memoryupdatelast),用来记录和回顾上一次会话进行到哪里。
Open Knowledge Format(OKF)是什么?每条记录都要遵循的规范:一份带 YAML frontmatter 的 Markdown 文档,frontmatter 里存放 type、key、namespace、tags、status、staleafter、sources 和验证事件等元数据,遵循 OKF v0.2 版本(见 SPEC.md 和 OKFRULES.md)。
数据都在 SQLite 里了,为什么还要保留 Markdown 文件?这是一种刻意设计的双层结构:memory/ 文件夹保存便于人工浏览的 .md 副本,配有 index.md 索引文件和 log.md 历史记录;同时 SQLite FTS5 触发器让按键查找在 20 毫秒以内完成,关键词搜索也能即时出结果。
Creator
fellowgeek
Size
0.1 MB
Stars
218
Age
2mo
Commits · 90 Days