mcp-memory

mcp-memory

Provides AI agents with persistent, long-term memory via OKF-formatted markdown and SQLite indexing, enabling stateful storage, retrieval, and search across sessions.

Category
访问服务器

README

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

  • Persistent State Across Sessions: Enables AI agents to read, store, search, and delete stateful memory snippets that persist across chat turns and sessions.
  • OKF Standard Compliance: Stores every memory item formatted as an OKF v0.2 Markdown document with YAML frontmatter (type, key, namespace, tags, generated, sources, verified, status, stale_after), adhering strictly to SPEC.md and OKF_RULES.md.
  • Dual-Layer Architecture:
    • Human-Browseable OKF Directory: Automatically dumps and syncs every memory to disk as a raw .md file inside the memory/ bundle directory with hierarchical index.md progressive disclosure files (root index.md versioned with okf_version: "0.2") and log.md update history tracking.
    • High-Performance SQLite Indexing: SQLite FTS5 (Full-Text Search) and automatic triggers for sub-20ms key lookups and instant keyword searches.
  • Namespace Isolation: Supports contextual separation (e.g. user/preferences, project/architecture, default).
  • Zero Boilerplate Setup: Quick setup wizard (python3 setup.py) auto-configures installed MCP tools (Antigravity, Claude, Cursor, Windsurf, Codex).

MCP Tools

The server exposes four primary MCP tools to interacting agents:

1. memory_store

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

  • Parameters:
    • key (string, required): Unique identifier or path for the memory (e.g. user/preferences/coding_style or project/architecture).
    • content (string or object, required): Core information to store.
    • project_root (string, required): Absolute path to the active project root directory (e.g. /Users/user/Projects/my-app).
    • tags (array of strings, optional): Classification tags for filtering.
    • namespace (string, optional, default: "default"): Scope/namespace.
    • concept_type (string, optional, default: "Agent Memory"): OKF concept type (e.g. Metric, Playbook, Attested Computation).
    • title (string, optional): Display name.
    • description (string, optional): One-line summary.
    • resource (string, optional): Canonical URI of underlying asset.
    • status (string, optional, default: "stable"): Lifecycle state (draft | stable | deprecated).
    • stale_after (string, optional): ISO date (YYYY-MM-DD).
    • sources (array of objects, optional): Provenance sources [{resource, id, title, author, usage_count, last_modified}].
    • verified (array of objects or object, optional): Verification events [{by, at}].
    • generated_by (string, optional): Actor identifier following actor convention (<producer>/<version>, human:<id>, process:<id>).

2. memory_retrieve

Retrieves a specific memory by its key and namespace.

  • Parameters:
    • key (string, required): The memory key to look up.
    • project_root (string, required): Absolute path to the active project root directory.
    • namespace (string, optional, default: "default"): Scope/namespace.

3. memory_search

Finds memories matching keywords, tags, or namespace filters.

  • Parameters:
    • project_root (string, required): Absolute path to the active project root directory.
    • query (string, optional): Keyword search query across keys, frontmatter, and content.
    • tags (array of strings, optional): Filter by specific tags.
    • namespace (string, optional): Scope search to a namespace.
    • limit (integer, optional, default: 10): Maximum number of results.

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.

  • Parameters:
    • project_root (string, required): Absolute path to active project root directory.
    • namespace (string, optional, default: "default"): Scope/namespace.

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.

  • Parameters:
    • content (string or object, required): Brief note or structured dictionary summarizing progress and referencing key memory files.
    • project_root (string, required): Absolute path to active project root directory.
    • namespace (string, optional, default: "default"): Scope/namespace.
    • summary (string, optional): One-sentence description of the milestone achieved.

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

  • Claude Code CLI:
    claude mcp add --scope user memory -- /ABSOLUTE/PATH/TO/run.sh
    
  • Codex CLI:
    codex mcp add memory -- /ABSOLUTE/PATH/TO/run.sh
    

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:

  • OKF Markdown Files (Human-readable): memory/ folder in project root.
  • SQLite Database (Hidden index): .mcp_memory/memories.db in project root.

You can customize this behavior using environment variables:

  • MCP_MEMORY_PROJECT_ROOT: Project root directory (default: process current working directory cwd).
  • MCP_MEMORY_DB_PATH: SQLite database file path (default: .mcp_memory/memories.db relative to project root).
  • MCP_MEMORY_DIR: Directory for Open Knowledge Format (OKF) .md files (default: memory relative to project root).

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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选
mcp-server-qdrant

mcp-server-qdrant

这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。

官方
精选
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选