Skip to main content

Alibaba Cloud AgentLoop Memory MCP Server - MCP Server for cloud-hosted memory management

Project description

alibabacloud-agentloop-memory-mcp-server

阿里云 AgentLoop MemoryStore 的 MCP Server 实现,为 AI Agent 提供长期记忆管理能力,支持通过 MCP 协议(SSE 传输)进行记忆的增删改查和语义搜索。

AgentLoop MemoryStore

AgentLoop MemoryStore 是阿里云提供的全托管 AI Agent 长期记忆服务。它为 AI Agent 提供智能记忆层,使其能够跨会话记住用户偏好、持续学习并实现个性化交互,适用于智能客服、个人助理、教育辅导等场景。

核心特性:

  • 多维度记忆:自动从对话中提取用户偏好、事实陈述、会话摘要等结构化记忆,支持自定义提取策略
  • 分层检索:L1 混合检索 → L2 Rerank 精排 → L3 Agentic Search,兼顾召回广度与精度
  • 异步提取:记忆处理异步执行,不阻塞 Agent 主流程,支持弹性扩缩容
  • 全托管:无需搭建向量数据库或维护存储实例,开通即用
  • 可观测:内置监控大盘,覆盖检索延迟、Token 消耗、存储量等核心指标

本项目将 AgentLoop MemoryStore 封装为标准 MCP Server,支持 Cursor、Claude Desktop 等 MCP 客户端直接接入。

安装

pip install alibabacloud-agentloop-memory-mcp-server

快速开始

1. 配置环境变量

export ALIBABA_CLOUD_ACCESS_KEY_ID=your_access_key_id
export ALIBABA_CLOUD_ACCESS_KEY_SECRET=your_access_key_secret
export ALIBABA_CLOUD_REGION_ID=cn-hangzhou
export ALIBABA_CLOUD_WORKSPACE=your_workspace_name
export ALIBABA_CLOUD_MEMORY_STORE=your_memory_store_name

2. 启动服务

# 使用 python -m 启动
python -m mcp_server_agentloop_memory

# 或使用命令行入口
alibabacloud-agentloop-memory-mcp-server

# 指定参数启动
python -m mcp_server_agentloop_memory \
  --access-key-id <your_ak_id> \
  --access-key-secret <your_ak_secret> \
  --region-id cn-hangzhou \
  --workspace <workspace_name> \
  --memory-store <memory_store_name> \
  --port 8080

3. 连接 MCP Client

服务启动后,MCP Client 通过 SSE 连接:

GET http://localhost:8080/mcp/{client_name}/sse/{user_id}
  • client_name:客户端标识(如 cursormy-agent),映射为 agent_id
  • user_id:用户标识,用于隔离不同用户的记忆数据

CLI 参数

参数 环境变量 默认值 说明
--access-key-id ALIBABA_CLOUD_ACCESS_KEY_ID - 阿里云 AccessKey ID
--access-key-secret ALIBABA_CLOUD_ACCESS_KEY_SECRET - 阿里云 AccessKey Secret
--region-id ALIBABA_CLOUD_REGION_ID cn-hangzhou 阿里云区域
--workspace ALIBABA_CLOUD_WORKSPACE - Workspace 名称
--memory-store ALIBABA_CLOUD_MEMORY_STORE - Memory Store 名称
--host - 0.0.0.0 监听地址
--port - 8080 监听端口
--log-level - INFO 日志级别

MCP Tools

工具名 参数 说明
add_memories text: str 添加记忆。当用户分享个人信息、偏好或要求记住某些内容时调用
search_memory query: str 语义搜索记忆。用户提问时自动调用,返回按相关度排序的记忆
list_memories 列出当前用户的所有记忆
delete_memories memory_ids: list[str] 按 ID 删除指定记忆
delete_all_memories 删除当前用户的所有记忆

权限要求

需要阿里云 RAM 用户具有 AgentLoop MemoryStore 相关 API 的访问权限。获取和管理 AccessKey 请参考阿里云 AccessKey 管理

开发

# 安装开发依赖
pip install -e ".[dev]"

# 运行测试(需要配置环境变量)
pytest tests/ -v

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file alibabacloud_agentloop_memory_mcp_server-0.1.2.tar.gz.

File metadata

File hashes

Hashes for alibabacloud_agentloop_memory_mcp_server-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4d48d8832e9da20e8f0d34bc363bb31d9c67689c37381ab526cb604b61557a9e
MD5 b0cbecab5cdc90024911c21a009368ab
BLAKE2b-256 239ac2fcf5d6223bb34c5e1601fcff4f62cbf87aea1f7696d9c29f67ed241825

See more details on using hashes here.

File details

Details for the file alibabacloud_agentloop_memory_mcp_server-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for alibabacloud_agentloop_memory_mcp_server-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3f359c77deb24e5c6119b0fc7bcc04852f3a80291525ce365c44d0285040d681
MD5 c2ea0c14efc605f0cdf2fea087585f46
BLAKE2b-256 1811416cb04bfde8285a3d22f4d6b6303120fc9168fdcde3e60a4209c8b179bf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page