OpenClaw Supermemory集成配置5个真实陷阱与解决方案
Supermemory是一个AI记忆层,可以让我在Telegram、WhatsApp、Discord、Slack等多个平台上保持对话上下文连续性。它通过MCP(Model Context Protocol)协议连接到OpenClaw。官方文档看起来简洁,但配置过程中有5个地方特别容易出错。
本文含联盟链接,购买后我可获得小额佣金(不影响您的价格)。
陷阱1:API Key放在错误的位置
**症状**:运行openclaw supermemory setup后,输入API Key,但连接失败,提示401 Unauthorized或Authentication failed。
排查过程:
我首先在Supermemory控制台(app.supermemory.ai)创建了一个API Key,然后直接把它粘贴到Authorization请求头里。但错误信息让我困惑了几小时:
[error] Failed to connect: 401 Unauthorized
[error] Supermemory: authentication failed
**根因**:Supermemory API v3的认证头格式是Authorization: Bearer YOUR_API_KEY,但很多人会误写成:
- `x-api-key: YOUR_API_KEY`
- `Authorization: API_KEY YOUR_API_KEY`
- 甚至直接放在URL参数里`?api_key=YOUR_API_KEY`
解决方案:确认API Key放置位置正确。根据Supermemory官方文档,正确的请求格式是:
curl https://api.supermemory.ai/v3/search \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"q": "user preferences", "containerTags": ["user_123"]}'
如果是MCP配置文件,格式是:
{
"mcpServers": {
"supermemory": {
"url": "https://mcp.supermemory.ai/mcp",
"headers": {
"Authorization": "Bearer sm_your_api_key_here"
}
}
}
}
**注意**:MCP配置中headers字段是可选的,如果你用OAuth则不需要。
陷阱2:OAuth和API Key二选一,混用会冲突
**症状**:openclaw supermemory setup显示连接成功,但搜索记忆时返回空结果,或者提示权限不足。
排查过程:
我之前用API Key方式配置,后来想换成OAuth(自动续期token),运行了:
openclaw plugins install @supermemory/openclaw-supermemory
openclaw supermemory setup
这次我选择了OAuth授权流程。但配置后出现了奇怪的问题——某些container能读,某些container返回空结果。
根因:Supermemory的API Key和OAuth token对应不同的权限范围。API Key默认是全局权限,而OAuth授权时会限定scope。如果你的OAuth app只授权了部分container,直接用API Key查询未授权的container会返回空而不是报错。
解决方案:
1. 确认你的API Key有权限访问所需的container tag
2. 如果用OAuth,检查授权范围是否包含目标container
3. 用openclaw supermemory profile命令查看当前授权状态
openclaw supermemory profile
# 输出示例:
# User: xxx@email.com
# Scopes: [read:memory, write:memory, read:profile]
# Active containers: ["personal", "work"]
教训:不要在开发环境和生产环境之间混用认证方式。
陷阱3:Container Tags隔离逻辑——personal和work不互通
症状:在Slack上的对话记录不会出现在Telegram上;或者同一个项目,Claude Code的记忆和我的个人记忆混在一起。
排查过程:
我配置了personal container用于Telegram和WhatsApp,work container用于Slack和Gmail。但每次切换平台,AI都说"我不记得之前的事了"。
**根因**:Supermemory的container是逻辑隔离的。如果你没有在openclaw supermemory setup时指定默认container,或者没有在custom instructions里正确配置路由规则,AI会随机选择container存储记忆。
解决方案:在OpenClaw配置custom instructions来明确路由规则。根据Supermemory官方文档:
# 在OpenClaw skill配置或system prompt中添加:
When the active channel is slack or gmail, always use the work container for storing and recalling memories.
When the active channel is telegram or whatsapp, always use the personal container.
# 禁止规则:
# Never save anything to the twitter-bookmarks container — it is read-only
也可以用containerTags在查询时指定:
{
"q": "project timeline",
"containerTags": ["work"] // 只搜索work container
}
命令验证:
openclaw supermemory search "project timeline" --container personal
# 只在personal container中搜索
openclaw supermemory search "project timeline" --container work
# 只在work container中搜索
陷阱4:Project ID配置缺失(x-sm-project header)
**症状**:MCP连接成功,但返回403 Forbidden,提示project ID无效。
排查过程:
我按照官方文档配置好了API Key,但MCP服务器返回了奇怪的403错误:
[error] Supermemory MCP: 403 Forbidden - Invalid project ID
但我没有配置任何project ID啊。
**根因**:Supermemory MCP服务器要求在请求头中包含x-sm-project字段,用于区分不同的项目。当你直接用API Key而非OAuth时,需要显式指定project ID。
**解决方案**:在MCP配置中添加x-sm-project header:
{
"mcpServers": {
"supermemory": {
"url": "https://mcp.supermemory.ai/mcp",
"headers": {
"Authorization": "Bearer sm_your_api_key_here",
"x-sm-project": "your-project-id"
}
}
}
}
Project ID可以在app.supermemory.ai的开发者控制台(console.supermemory.ai)找到。
验证命令:
# 测试API Key是否有project权限
curl https://api.supermemory.ai/v3/profile \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "x-sm-project: your-project-id"
陷阱5:网络/CORS问题——本地开发 vs 云端MCP
**症状**:本地运行openclaw supermemory search超时,但MCP在服务器上正常运行;或者跨域请求被阻止。
排查过程:
我的开发环境在本地机器(macOS),OpenClaw跑在VPS上。本地测试时:
openclaw supermemory search "test query"
# 超时:Request timed out after 30000ms
但同样的命令在服务器上执行成功。
**根因**:Supermemory API endpoint https://mcp.supermemory.ai/mcp 有速率限制和CORS策略。本地开发时如果网络质量差,会频繁超时。
解决方案:
1. 检查本地网络到supermemory.ai的连通性:
curl -v https://mcp.supermemory.ai/mcp --max-time 10
2. 如果需要自托管选项,可以用官方提供的Docker方式:
git clone https://github.com/supermemoryai/memorybench
cd memorybench
bun install
# 配置SUPERMEMORY_API_KEY
bun start
3. 或者使用OpenClaw的离线模式,只在需要时同步记忆。
速率限制说明:根据Supermemory官方定价(app.supermemory.ai/billing),免费tier有请求限制,生产环境建议升级到Scale plan。
完整配置检查清单
如果你的OpenClaw Supermemory插件仍然无法正常工作,按这个顺序排查:
# 1. 确认插件安装成功
openclaw plugins list | grep supermemory
# 2. 确认API Key有效
curl https://api.supermemory.ai/v3/profile \
-H "Authorization: Bearer YOUR_API_KEY"
# 3. 确认MCP配置正确
cat ~/.openclaw/config.json | jq '.mcpServers.supermemory'
# 4. 测试搜索功能
openclaw supermemory search "test" --container personal
# 5. 查看详细日志
openclaw supermemory --debug
一句话总结
OpenClaw + Supermemory集成的5个核心坑:Authorization header格式、OAuth和API Key作用域差异、Container Tags路由规则、x-sm-project header缺失、网络CORS问题。按清单逐项排查,基本都能解决。
如果你也在配置AI助手的多平台记忆系统,建议先从一个小container开始测试,确认路由规则生效后再扩展到多平台。
👉 如果觉得配置太复杂,可以了解MiniMax的Token Plan服务,支持按需调用各大模型,实测比本地部署配置简单得多。
👉 立即参与:https://platform.minimaxi.com/subscribe/token-plan?code=E5yur9NOub&source=link
📌 This article was AI-assisted generated and human-reviewed | TechPassive — An AI-driven content testing site focused on real tool reviews
🔗 Recommended Tools
These are carefully selected tools. Using our affiliate links supports us to keep producing quality content: