Skip to main content
Glama

CF Memory Plugin

面向 AI 代理的持久化内存,由 Cloudflare Agent Memory 提供支持。

此插件是一个轻量客户端。Cloudflare 负责存储、分类和回忆记忆。您无需运行向量数据库、嵌入管道或 Worker。

私有测试版。 需要付费 Workers。仅付费 Workers 还不够——您还需要 Agent Memory 权限。

需求

链接

加入测试版

候补表单

产品文档

developers.cloudflare.com/agent-memory

HTTP API

HTTP API

定价

Agent Memory 定价

限制

平台限制

创建令牌

API 令牌

创建令牌(文档)

创建 API 令牌

Workers 付费版

Workers 定价

设计说明

Agent Memory 介绍

60 秒设置

pip install git+https://github.com/hansakoch/cf-memory-plugin.git

export MCP_CLOUDFLARE_API_KEY="cf-api-token-with-agent-memory"
export CF_ACCOUNT_ID="your-32-char-account-id"

cf-memory test

CF_ACCOUNT_ID 是必需的。没有默认账户。您可以在 Cloudflare 仪表板 侧边栏中找到它。

在 dash.cloudflare.com/profile/api-tokens 创建令牌,仅授予 Agent Memory 权限。不要重复使用全局 API 密钥。

Related MCP server: agentram-mcp

这是什么

您调用

Cloudflare 执行

remember

存储一个事实 / 指令 / 事件

recall

搜索并综合答案(约 5 秒)

ingest

从对话中提取记忆(写入在 3–8 秒后生效)

summary

所存储内容的 Markdown 概要

list / get / delete

检查或删除条目

成本

项目

当前

来源

Agent Memory

私有测试版期间 $0。 计费前 30 天通知。

定价

Workers 付费版(申请必需)

每月 $5 最低

Workers 定价

此插件

免费(MIT)。仅您自己的 HTTP 调用。

—

建议:在将保存记忆的账户上使用 Workers 付费版。不要将生产记忆放在免费账户上。不要假设每个付费 Workers 账户都有 Agent Memory——我们已验证付费 ≠ 权限。

测试版结束后,请将 Agent Memory 视为单独账单。Cloudflare 尚未公布正式版(GA)费率。

依赖项

运行时:

包

用途

httpx

用于 api.cloudflare.com 的 HTTPS 客户端

mcp

MCP 服务器(cf-memory serve)

可选:

附加

包

用途

pip install 'cf-memory-plugin[a2a]'

starlette, uvicorn

A2A 对等服务器

pip install 'cf-memory-plugin[dev]'

pytest, pytest-asyncio, respx

测试

此插件不需要 Cloudflare Worker、Wrangler、D1、Vectorize 或 Workers AI 绑定。这些是此客户端不使用的 Cloudflare 产品。

安全

遵循 Cloudflare 的令牌规则:API 令牌最佳实践。

  • 将 MCP_CLOUDFLARE_API_KEY 存储在环境变量或密钥存储中。切勿提交它。

  • 将令牌范围限定为单个账户上的 Agent Memory。

  • 自行设置 CF_ACCOUNT_ID。此插件不会回退到其他账户。

  • cf-memory a2a 默认绑定到 127.0.0.1。未经认证,请勿将其暴露到公共互联网。

  • ingest 和 sync_turn 会将对话文本发送到 Cloudflare。请勿摄取您无权存储的机密、密码或客户 PII。

  • 每个应用使用一个命名空间,每个用户/租户使用一个配置文件。

  • 如果令牌泄露,请从 API 令牌 页面轮换它。

参见 SECURITY.md。

在代理中使用

所有地方使用相同的 MCP 块。只有配置文件路径不同。

{
  "mcpServers": {
    "cf-memory": {
      "command": "cf-memory",
      "args": ["serve"],
      "env": {
        "MCP_CLOUDFLARE_API_KEY": "your-token",
        "CF_ACCOUNT_ID": "your-account-id"
      }
    }
  }
}

代理

放置位置

文档

Claude Code

.claude/mcp.json 或 claude mcp add cf-memory -- cf-memory serve

MCP

Codex

~/.codex/config.toml → [mcp_servers.cf-memory]

OpenAI Codex

Cursor

.cursor/mcp.json

Cursor MCP

Hermes

hermes config set memory.provider cloudflare-memory

内存提供程序

OpenClaw

主机 MCP 配置

OpenClaw

TRAE

.trae/mcp.json

TRAE

OpenCode

~/.opencode/config.json

OpenCode

pi

主机 MCP 配置

pi

任何 MCP 客户端

stdio cf-memory serve

MCP 规范

LangChain / LangGraph

Python CloudflareMemoryClient

LangChain

A2A 对等方

cf-memory a2a --port 9120

位于 /.well-known/agent.json 的代理卡片

Hermes 是唯一的原生提供程序。它在后台预取,因此回忆不会为每次对话增加约 5 秒的延迟。

hermes config set memory.provider cloudflare-memory
hermes cloudflare-memory test

Python:

import asyncio
from cloudflare_memory import CloudflareMemoryClient

async def main():
    async with CloudflareMemoryClient(
        account_id="your-account-id",
        api_token="your-token",
        namespace="my-app",
        profile="default",
    ) as client:
        await client.remember("User prefers concise answers.")
        result = await client.recall("How should I answer?")
        print(result.answer)

asyncio.run(main())

CLI

cf-memory test                          # connectivity
cf-memory serve                         # MCP (stdio)
cf-memory a2a --port 9120               # A2A on localhost
cf-memory card                          # print agent card

hermes cloudflare-memory status
hermes cloudflare-memory namespaces

部署落地页(可选)

插件本身不是 Worker。位于 cloudflare-memory.pages.dev 的公共页面是一个静态 Cloudflare Pages 站点。

# token needs Pages:Edit on the same account
export CLOUDFLARE_API_TOKEN=...
export CLOUDFLARE_ACCOUNT_ID=...
npx wrangler pages deploy ./public --project-name cf-memory-plugin

Pages 文档 · Wrangler

致谢

此仓库与 Cloudflare 或 Nous Research 无关。

许可证

MIT

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers