a

agent-memory-mcp

bfgmzxs/agent-memory-mcp
Hosted
1 Stars 127 次浏览 更新于 2026-08-23

MCP 服务配置

复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用

{
  "mcpServers": {
    "agent-memory": {
      "args": [
        "-y",
        "agent-memory-mcp"
      ],
      "command": "npx"
    }
  }
}

可用工具 (5 个)

该服务在 MCP 协议中暴露的工具,AI 可按需调用

memory_store 3 个参数 需填 1 项

Store a new memory entry with content, optional tags, and metadata

必填参数:content

memory_query 3 个参数 需填 1 项

Query memories based on search string with optional limit and tag filters

必填参数:query

memory_list 2 个参数

List all stored memories with optional pagination

该工具无需必填参数,直接调用即可

memory_delete 1 个参数 需填 1 项

Delete a specific memory by its ID

必填参数:id

memory_clear 1 个参数

Clear all memories from the store

该工具无需必填参数,直接调用即可

服务介绍

Agent Memory MCP 服务器

一个基于 Model Context Protocol (MCP) 的 AI 智能体记忆服务器。支持跨会话的记忆存储、查询和管理,具备标签分类、元数据附加和关键词语义搜索功能。

功能特性

  • 持久化存储: 记忆保存到磁盘,服务器重启后数据不丢失
  • 关键词搜索: 基于关键词的语义匹配,快速找到相关记忆
  • 标签支持: 使用标签组织记忆,便于分类过滤
  • 元数据: 为记忆附加自定义元数据
  • MCP 兼容: 支持 Claude Desktop、Cursor、Windsurf、Kiro 等 MCP 客户端

安装

通过 npm 安装(推荐)

npm install -g agent-memory-mcp

从源码安装

git clone <repository-url>
cd agent-memory-mcp
npm install
npm run build

MCP 客户端配置

Claude Desktop

编辑 Claude Desktop 配置文件:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "agent-memory": {
      "command": "npx",
      "args": ["-y", "agent-memory-mcp"]
    }
  }
}

全局安装后也可以这样配置:

{
  "mcpServers": {
    "agent-memory": {
      "command": "agent-memory-mcp"
    }
  }
}

Cursor

编辑 Cursor MCP 配置(项目目录下的 .cursor/mcp.json 或全局设置):

{
  "mcpServers": {
    "agent-memory": {
      "command": "npx",
      "args": ["-y", "agent-memory-mcp"]
    }
  }
}

Windsurf

编辑 Windsurf 配置:

{
  "mcpServers": {
    "agent-memory": {
      "command": "npx",
      "args": ["-y", "agent-memory-mcp"]
    }
  }
}

Kiro

编辑 .kiro/settings/mcp.json

{
  "mcpServers": {
    "agent-memory": {
      "command": "npx",
      "args": ["-y", "agent-memory-mcp"]
    }
  }
}

可用工具

memory_store

存储新的记忆条目。

参数:

  • content (string, 必填): 记忆内容
  • tags (string[], 可选): 分类标签
  • metadata (object, 可选): 自定义元数据

示例:

{
  "content": "用户偏好深色模式,使用 TypeScript 开发",
  "tags": ["偏好", "编程"],
  "metadata": { "priority": "high" }
}

memory_query

使用关键词语义匹配搜索记忆。

参数:

  • query (string, 必填): 搜索查询
  • k (number, 可选): 返回结果数量上限(默认: 10)
  • tags (string[], 可选): 按标签过滤

示例:

{
  "query": "用户偏好",
  "k": 5,
  "tags": ["偏好"]
}

memory_list

列出所有存储的记忆,支持分页。

参数:

  • limit (number, 可选): 返回条目数量上限
  • offset (number, 可选): 跳过的条目数量

示例:

{
  "limit": 20,
  "offset": 0
}

memory_delete

按 ID 删除指定记忆。

参数:

  • id (string, 必填): 要删除的记忆 ID

示例:

{
  "id": "550e8400-e29b-41d4-a716-446655440000"
}

memory_clear

清空所有记忆。

参数:

  • confirm (boolean, 可选): 必须设为 true 以确认删除

示例:

{
  "confirm": true
}

数据存储位置

记忆以 JSON 格式存储在:

  • macOS/Linux: ~/.agent-memory/memories.json
  • Windows: %USERPROFILE%\.agent-memory\memories.json

开发

# 安装依赖
npm install

# 构建
npm run build

# 运行测试
npm test

# 开发模式(监听文件变化)
npm run dev

许可证

MIT

相关 MCP 服务