使用说明
项目简介
Memory Box MCP Server 是一个基于 Model Context Protocol (MCP) 构建的服务器,旨在为 Cline 等 MCP 客户端提供语义记忆的存储和检索能力。它作为 Memory Box (一个语义记忆存储和检索系统) 的 MCP 接口,允许用户通过 Cline 客户端方便地保存、搜索和管理个人记忆。
主要功能点
- 保存记忆: 将文本信息以结构化的格式保存到 Memory Box 中,支持指定记忆类型和 bucket。
- 语义搜索: 根据文本查询在 Memory Box 中进行语义搜索���找到相关的记忆条目。
- 检索记忆: 获取所有记忆或特定 bucket 中的记忆列表。
- 格式化记忆: 根据预定义的系统提示,对文本进行格式化处理,使其更适合作为记忆存储。
- 使用统计: 查看 Memory Box 账户的使用情况,包括当前计划、用量指标和资源限制等。
安装步骤
- 确保 Memory Box 服务已运行: 你需要一个正在运行的 Memory Box 实例。你可以选择自托管 Memory Box 或使用官方提供的托管版本 (memorybox.amotivv.ai)。
- 克隆仓库: 将 Memory Box MCP Server 仓库克隆到本地。
- 安装依赖: 虽然文档未明确指出,但通常需要进入仓库目录并运行 'npm install' 安装项目依赖(如果 'package.json' 文件存在)。
- 构建项目: 运行 'npm run build' 命令编译 TypeScript 代码到 JavaScript。
- 配置 Cline MCP 设置: 打开 Cline 客户端的 MCP 设置文件 ('~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json'),添加 Memory Box MCP Server 的配置。
服务器配置
在 Cline 的 MCP 设置文件中,你需要添加如下 JSON 配置来注册和启用 Memory Box MCP Server。请根据你的实际情况修改 '<path-to-repository>' 为你克隆仓库的本地路径,并将 'your-token-here' 替换为你的 Memory Box API 令牌。
{ "server name": "memory-box-mcp", "command": "node", "args": [ "<path-to-repository>/build/index.js" ], "env": { "MEMORY_BOX_API_URL": "https://memorybox.amotivv.ai", "MEMORY_BOX_TOKEN": "your-token-here", "DEFAULT_BUCKET": "General" } }
配置参数说明:
- 'server name': 服务器名称,用于在 Cline 中标识该 MCP 服务器,可以自定义,例如 "memory-box-mcp"。
- 'command': 启动命令,指定运行服务器的可执行文件,这里使用 'node' 来运行 JavaScript 代码。
- 'args': 命令参数,一个字符串数组,包含传递给启动命令的参数。
- '"<path-to-repository>/build/index.js"': 指向编译后的服务器入口文件 'index.js' 的路径。请务必将 '<path-to-repository>' 替换为你的实际仓库路径。
- 'env': 环境变量,一个键值对对象,用于配置服务器运行时的环境变量。
- 'MEMORY_BOX_API_URL': Memory Box API URL,指定 Memory Box 后端 API 的地址。默认为官方托管版本的地址 'https://memorybox.amotivv.ai'。如果你使用自托管的 Memory Box,请修改为你的服务地址。
- 'MEMORY_BOX_TOKEN': Memory Box API 令牌,用于身份验证。请务必将 '"your-token-here"' 替换为你自己的 Memory Box API 令牌。
- 'DEFAULT_BUCKET': 默认 Bucket 名称,指定保存记忆时默认使用的 Bucket。默认为 "General"。你可以根据需要修改。
基本使用方法
配置完成后,在 Cline 客户端中,你可以使用以下工具与 Memory Box MCP Server 交互:
- 'save_memory': 保存记忆。例如:'Use the save_memory tool to save this information: "..."'
- 'search_memories': 搜索记忆。例如:'Use the search_memories tool to find information about "..."'
- 'get_all_memories': 获取所有记忆。例如:'Use the get_all_memories tool to show me all my saved memories'
- 'get_bucket_memories': 获取特定 Bucket 的记忆。例如:'Use the get_bucket_memories tool to show me memories in the "Learning" bucket'
- 'format_memory': 格式化文本。例如:'Use the format_memory tool to format this text: "..."'
- 'get_usage_stats': 获取使用统计信息。例如:'Use the get_usage_stats tool to show me my current plan and usage metrics'
每个工具的具体参数和使用方法请参考仓库 README.md 文档的 "Usage" 章节。
注意: 使用前请确保你已正确配置 'MEMORY_BOX_TOKEN' 环境变量,并且 Memory Box 服务可访问。
信息
分类
AI与计算