Skip to main content
Glama

MCP 内存服务器

通过 Markdown 文件 + SQLite FTS5 全文搜索,为 Blockbrain(或任何 MCP 客户端)提供持久的代理内存。

为什么?

Blockbrain 代理不会在会话之间保留内存。每次对话都从零开始。这个 MCP 服务器解决了这个问题——代理可以保存学到的内容,并在下次回忆起来。

工作原理:

  • 代理解决问题 → 使用解决方案调用 memory_save

  • 代理开始新任务 → 调用 memory_recall 检查过去是否遇到过类似问题

  • 所有记忆都存储为可读的 Markdown 文件,并索引到 SQLite 中以实现快速搜索

Related MCP server: universal-memory-mcp

工具

工具

描述

memory_save

存储记忆条目(主题、标题、内容)

memory_recall

按关键字/主题搜索记忆 (FTS5)

memory_list_topics

列出所有已存储的主题及其条目数

memory_delete

按 ID 删除记忆条目

快速开始 (Docker)

# 1. Clone
git clone https://github.com/lanlibbi/mcp-memory-server.git
cd mcp-memory-server

# 2. Configure
cp .env.example .env
# Edit .env — set MEMORY_API_KEY!
# Generate a key: openssl rand -hex 32

# 3. Run
docker compose up -d

# 4. Verify
curl http://localhost:8080/health

Blockbrain 集成

  1. 公开暴露服务器 — Blockbrain 需要一个 HTTPS URL:

    • 选项 A:Cloudflare Tunnel(cloudflared tunnel --url http://localhost:8080

    • 选项 B:任何支持 TLS 的反向代理(nginx、Caddy、Traefik)

    • 选项 C:用于测试的 ngrok(ngrok http 8080

  2. 在 Blockbrain 中注册:

    • 转到 管理 → 代理 → MCP 服务器

    • 点击 "+ 添加 MCP 服务器"

    • 填写:

      • 名称: Memory Server

      • 服务器 URL: https://<your-public-url>/sse

      • 传输协议: SSE

      • 身份验证: API 密钥

      • API 密钥: (来自 .env 的值)

    • 保存并激活

  3. 分配给代理,并在代理的系统提示词中添加说明:

    Before starting a new task, call memory_recall with keywords related to the task.
    After completing a task or learning something new, call memory_save with:
    - topic: a category for the task (e.g. "contract-review", "supplier-issue")
    - title: a short descriptive title
    - content: what was the problem, what was the solution, what was learned

配置

所有配置均通过环境变量进行:

变量

默认值

描述

MEMORY_API_KEY

(空 = 无身份验证)

用于 X-API-Key 头的 API 密钥

MEMORY_DATA_DIR

/data/memories

Markdown 文件的存储位置

MEMORY_PORT

8080

HTTP 端口

MEMORY_MAX_RESULTS

10

每次查询的最大搜索结果数

LOG_LEVEL

info

debug、info、warning、error

存储

记忆以带有 YAML frontmatter 的 Markdown 文件形式存储:

/data/memories/
├── contract-review/
│   ├── nda-standard-clauses.md
│   └── liability-clause-fix.md
├── supplier-issue/
│   └── delayed-delivery-workaround.md
└── memory.db          ← SQLite FTS5 index

每个文件如下所示:

---
id: a1b2c3d4e5f67890
topic: contract-review
title: NDA Standard Clauses
created_at: 2026-08-20T15:00:00Z
updated_at: 2026-08-20T15:00:00Z
---

# NDA Standard Clauses

The standard NDA should always include...

您可以直接浏览、编辑或删除记忆——它们只是 Markdown 文件。SQLite 索引会自动保持同步。

本地开发(不使用 Docker)

python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
export MEMORY_API_KEY=test-key
export MEMORY_DATA_DIR=./data/memories
python -m uvicorn src.server:app --host 0.0.0.0 --port 8080

API 端点

端点

方法

描述

/health

GET

健康检查(无需身份验证)

/sse

GET

用于 MCP 客户端连接的 SSE 端点

/messages/

POST

MCP 消息端点(由 SSE 传输使用)

技术栈

  • Python 3.12 + MCP SDK

  • Starlette + Uvicorn 用于 HTTP/SSE

  • SQLite FTS5 用于全文搜索(零外部依赖)

  • Markdown 用于人类可读的存储

许可证

MIT

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    MCP server providing persistent memory management for AI agents using SQLite and FTS5, enabling storage, full-text search, and recall of memories with namespace isolation.
    1
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Persistent memory MCP server that stores and retrieves memories in Markdown files, enabling shared context across multiple AI agents with hybrid search and deduplication.
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    MCP server for persistent, cross-session, local-first memory for AI agents, storing memories as Markdown files with SQLite indexing for hybrid search.
    24
    Apache 2.0

View all related MCP servers

Related MCP Connectors

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lanlibbi/mcp-memory-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server