从 direct-token client 迁移到 OAuth
当 client 支持 OAuth 时,切换会从本地 configuration 中移除已存储的 bearer token。Memory、scope 和 attribution 不会因切换改变,只有 credential path 会移动。
- 移除 XMEMO_KEY 前,确认 client 显示为 OAuth-capable。
- 重新连接并批准 memory:read 和 memory:write。
- 先执行一次无害的 recall,再写入任何内容。
- 从旧 configuration 文件和环境中移除 token。
之前:direct token 配置
{
"mcpServers": {
"XMemo": {
"type": "http",
"url": "https://xmemo.dev/mcp",
"headers": { "Authorization": "Bearer ${env:XMEMO_KEY}" }
}
}
}之后:OAuth 配置
只保留 hosted server URL;grant 会提供 scopes。
{
"servers": {
"XMemo": {
"type": "http",
"url": "https://xmemo.dev/mcp"
}
}
}验证迁移
先读后写,这样 broken credential 会在不改变已存储 memory 的情况下暴露。
await client.recallContext('current task and recent decisions', {
preferWorking: true,
});