该 MCP 服务器提供了与 Memory Box 实例交互的工具,允许您直接从 Cline 和 Claude Desktop 使用语义搜索保存和搜索记忆。
相关项目
该 MCP 服务器设计用于与Memory Box 配合使用,Memory Box是一个由矢量嵌入驱动的语义记忆存储和检索系统。
Memory Box 提供了与该 MCP 服务器通信的后端 API,允许您:
- 使用向量嵌入存储记忆以进行语义搜索
- 将记忆整理到可自定义的存储桶中
- 根据含义而非关键词来搜索记忆
- 检索具有详细背景的记忆
- 寻找语义相关的记忆
- 跟踪内存处理状态
有关 Memory Box 的更多信息,包括如何设置您自己的实例,请访问Memory Box 网站。
特征
- 保存记忆:将格式化的记忆连同源信息和元数据一起保存到您的记忆盒中
- 搜索记忆:使用语义搜索来搜索你的记忆
- 检索记忆:获取所有记忆或特定存储桶中的记忆
- 查找相关记忆:发现语义相似的记忆
- 检查记忆状态:监控记忆的处理状态
- 格式化记忆:根据结构化系统提示格式化记忆
- 使用情况统计:查看当前计划、使用情况指标和资源限制
安装
该服务器已安装并配置完毕,可供 Cline 使用。请注意,您需要一个正在运行的 Memory Box 实例(自托管或使用位于 memorybox.amotivv.ai 的托管版本)才能使用此 MCP 服务器。
通过 Smithery 安装
要通过Smithery自动为 Claude Desktop 安装 Memory Box MCP Server:
npx -y @smithery/cli install @amotivv/memory-box-mcp --client claude
要完成设置:
- 编辑 Cline MCP 设置文件:
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
- 将您的 Memory Box 令牌添加到
MEMORY_BOX_TOKEN
环境变量中:"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"
},
"disabled": false,
"autoApprove": []
}
- 或者,您可以通过更改
DEFAULT_BUCKET
值来自定义默认存储桶。
用法
配置完成后,您可以在 Cline 中使用以下工具:
节省内存
使用适当的格式将记忆保存到记忆盒:
Use the save_memory tool to save this information about vector databases: "Vector databases like pgvector store and query high-dimensional vectors for semantic search applications."
参数:
text
(必需):要保存的内存内容bucket_id
(可选):保存内存的存储桶(默认值:“General”)format
(可选):是否根据系统提示格式化内存(默认值:true)type
(可选):用于格式化的内存类型(TECHNICAL、DECISION、SOLUTION、CONCEPT、REFERENCE、APPLICATION、FACT)(默认值:“TECHNICAL”)source_type
(可选):内存源的类型(默认值:“llm_plugin”)reference_data
(可选):关于记忆源和上下文的附加元数据
搜索记忆
使用语义搜索来搜索记忆:
Use the search_memories tool to find information about "vector databases"
参数:
query
(必需):搜索查询debug
(可选):在结果中包含调试信息(默认值:false)
获取所有记忆
找回所有记忆:
Use the get_all_memories tool to show me all my saved memories
获取桶中回忆
从特定存储桶中获取记忆:
Use the get_bucket_memories tool to show me memories in the "Learning" bucket
参数:
bucket_id
(必需):从中检索记忆的存储桶
格式化内存
根据内存系统提示格式化文本而不保存:
Use the format_memory tool to format this text: "Vector databases like pgvector store and query high-dimensional vectors for semantic search applications."
参数:
text
(必需):要格式化的文本type
(可选):记忆的类型(技术、决策、解决方案、概念、参考、应用、事实)(默认值:“技术”)
获取相关记忆
查找与特定记忆在语义上相似的记忆:
Use the get_related_memories tool with memory ID 123
参数:
memory_id
(必需):用于查找相关记忆的记忆的 IDmin_similarity
(可选):相关记忆的最小相似度阈值(0.0-1.0)(默认值:0.7)
检查内存状态
检查内存的处理状态:
Use the check_memory_status tool with memory ID 123
参数:
memory_id
(必需):要检查状态的内存的 ID
获取使用情况统计
检索用户使用情况统计信息和计划信息:
Use the get_usage_stats tool to show me my current plan and usage metrics
此工具返回:
- 当前计划信息(例如免费、基本、专业、旧版)
- 用户状态和限制执行信息
- 本月使用情况指标(商店操作、搜索操作、API 调用)
- 具有人类可读格式的数据处理量
- 根据您的计划的资源限制(如果适用)
- 按类型划分的运营情况
此操作不需要任何参数。
定制
系统提示自定义
Memory Box MCP 服务器使用系统提示符根据特定准则格式化内存。您可以自定义此提示符来更改内存的格式化方式。
默认系统提示符
默认系统提示包括不同类型记忆的格式指南:
You are a helpful AI assistant. When storing memories with memory_plugin, follow these enhanced formatting guidelines:
1. STRUCTURE: Format memories based on the type of information:
- TECHNICAL: "YYYY-MM-DD: TECHNICAL - [Brief topic]: [Concise explanation with specific details]"
- DECISION: "YYYY-MM-DD: DECISION - [Brief topic]: [Decision made] because [rationale]. Alternatives considered: [options]."
- SOLUTION: "YYYY-MM-DD: SOLUTION - [Problem summary]: [Implementation details that solved the issue]"
- CONCEPT: "YYYY-MM-DD: CONCEPT - [Topic]: [Clear explanation of the concept with examples]"
- REFERENCE: "YYYY-MM-DD: REFERENCE - [Topic]: [URL, tool name, or resource] for [specific purpose]"
- APPLICATION: "YYYY-MM-DD: APPLICATION - [App name]: [User-friendly description] followed by [technical implementation details]"
2. FORMATTING GUIDELINES:
- CREATE FOCUSED MEMORIES: Each memory should contain a single clear concept or topic
- USE DIVERSE TERMINOLOGY: Include both technical terms AND user-friendly alternatives
- INCLUDE SEARCHABLE KEYWORDS: Begin with common terms a user might search for
- BALANCE DETAIL LEVELS: Include both high-level descriptions and key technical details
- LENGTH: Keep memories between 50-150 words
- ALWAYS include the current date in YYYY-MM-DD format
3. MEMORY STORAGE PARAMETERS:
- Use the "text" parameter for your formatted memory content
- Set "source_type" to "llm_plugin"
- Include appropriate "reference_data" with source information and context
4. REFERENCE DATA STRUCTURE:
- source.platform: Identify your platform (e.g., "claude_desktop", "cline")
- source.type: Always set to "llm_plugin"
- source.version: Optional version information
- context.conversation_id: Include when available to link related conversation memories
- context.message_id: Optional identifier for the specific message
5. SPECIAL FORMATS:
- For user facts, preferences, or personal details: "YYYY-MM-DD: FACT: [User] [specific preference/attribute/information]"
- For reference materials: Include specific details about where to find the information
6. RELATED MEMORIES: After finding memories with search, check if there are related memories using the get_related_memories tool with the memory_id from search results. Present these additional memories to provide the user with more context.
7. RETRIEVAL CONSIDERATION: Before storing an important memory, consider: "What search terms might someone use to find this information later?" and ensure those terms are included.
如何自定义系统提示
自定义系统提示:
- 编辑 Cline MCP 设置文件:
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
- 将您的自定义系统提示添加到
SYSTEM_PROMPT
环境变量:"memory-box-mcp": {
"command": "node",
"args": [
"<path-to-repository>/build/index.js"
],
"env": {
"MEMORY_BOX_API_URL": "https://your-memory-box-instance",
"MEMORY_BOX_TOKEN": "your-token-here",
"DEFAULT_BUCKET": "General",
"SYSTEM_PROMPT": "Your custom system prompt here..."
},
"disabled": false,
"autoApprove": []
}
<path-to-repository>/system-prompt-template.txt
中提供了一个模板文件,您可以复制和修改它。 - 重新启动 Cline 以应用更改
系统提示助手
Memory Box MCP 服务器包含一个用于管理系统提示的辅助脚本:
# View the current system prompt
cd <path-to-repository>
npm run prompt-helper -- view
# Reset to the default system prompt
cd <path-to-repository>
npm run prompt-helper -- reset
# Validate a custom system prompt
cd <path-to-repository>
npm run prompt-helper -- validate
其他配置选项
您还可以自定义这些环境变量:
MEMORY_BOX_API_URL
:您的 Memory Box 实例的 URLMEMORY_BOX_TOKEN
:您的 Memory Box 身份验证令牌DEFAULT_BUCKET
:保存记忆时使用的默认存储桶
故障排除
如果您遇到问题:
- 检查您的记忆盒令牌是否配置正确
- 验证您的 Memory Box 实例是否正在运行且可访问
- 检查 Cline 日志中是否有任何错误消息
发展
要对服务器进行更改:
- 编辑
<path-to-repository>/src/
中的源代码 - 重建服务器:
cd <path-to-repository>
npm run build
- 重新启动 Cline 以应用更改