cf-memory
Provides MCP tools for persistent, cross-session memory via Cloudflare Agent Memory, enabling agents to store, recall, ingest, summarize, and manage memory namespaces.
README
CF Memory Plugin
Persistent memory for AI agents, backed by Cloudflare Agent Memory.
This plugin is a thin client. Cloudflare stores, classifies, and recalls memories. You do not run a vector DB, embeddings pipeline, or Worker.
Private beta. Paid Workers is required. Paid Workers alone is not enough — you still need Agent Memory entitlement.
| Need | Link |
|---|---|
| Join the beta | Waitlist form |
| Product docs | developers.cloudflare.com/agent-memory |
| HTTP API | HTTP API |
| Pricing | Agent Memory pricing |
| Limits | Platform limits |
| Create a token | API Tokens |
| Create a token (docs) | Create API token |
| Workers Paid | Workers pricing |
| Design notes | Introducing Agent Memory |
60-second setup
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 is required. There is no default account. Find it in the
Cloudflare dashboard sidebar.
Create the token at dash.cloudflare.com/profile/api-tokens with Agent Memory permission only. Do not reuse a Global API Key.
What this is
| You call | Cloudflare does |
|---|---|
remember |
Store one fact / instruction / event |
recall |
Search + synthesize an answer (~5s) |
ingest |
Extract memories from a conversation (writes land 3–8s later) |
summary |
Markdown profile of what is stored |
list / get / delete |
Inspect or remove entries |
Cost
| Item | Today | Source |
|---|---|---|
| Agent Memory | $0 during private beta. 30-day notice before billing. | Pricing |
| Workers Paid (required to apply) | $5/month minimum | Workers pricing |
| This plugin | Free (MIT). Your own HTTP calls only. | — |
Recommended: Workers Paid on the account that will hold memory. Do not put production memory on a free account. Do not assume every paid Workers account has Agent Memory — we verified paid ≠ entitlement.
After beta, treat Agent Memory as a separate bill. Cloudflare has not published GA rates yet.
Dependencies
Runtime:
| Package | Why |
|---|---|
| httpx | HTTPS client to api.cloudflare.com |
| mcp | MCP server (cf-memory serve) |
Optional:
| Extra | Packages | When |
|---|---|---|
pip install 'cf-memory-plugin[a2a]' |
starlette, uvicorn | A2A peer server |
pip install 'cf-memory-plugin[dev]' |
pytest, pytest-asyncio, respx | Tests |
No Cloudflare Worker, Wrangler, D1, Vectorize, or Workers AI binding is required for this plugin. Those are Cloudflare products this client does not use.
Security
Follow Cloudflare's token rules: API token best practices.
- Store
MCP_CLOUDFLARE_API_KEYin the environment or a secret store. Never commit it. - Scope the token to Agent Memory on one account.
- Set
CF_ACCOUNT_IDyourself. This plugin will not fall back to another account. cf-memory a2abinds to127.0.0.1by default. Do not expose it to the public internet without auth.ingestandsync_turnsend conversation text to Cloudflare. Do not ingest secrets, passwords, or customer PII you are not allowed to store.- Use one namespace per app and one profile per user/tenant.
- Rotate the token from the API Tokens page if it leaks.
See SECURITY.md.
Use it from an agent
Same MCP block everywhere. Only the config file path changes.
{
"mcpServers": {
"cf-memory": {
"command": "cf-memory",
"args": ["serve"],
"env": {
"MCP_CLOUDFLARE_API_KEY": "your-token",
"CF_ACCOUNT_ID": "your-account-id"
}
}
}
}
| Agent | Where to put it | Docs |
|---|---|---|
| Claude Code | .claude/mcp.json or 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 |
Memory providers |
| OpenClaw | host MCP config | OpenClaw |
| TRAE | .trae/mcp.json |
TRAE |
| OpenCode | ~/.opencode/config.json |
OpenCode |
| pi | host MCP config | pi |
| Any MCP client | stdio cf-memory serve |
MCP spec |
| LangChain / LangGraph | Python CloudflareMemoryClient |
LangChain |
| A2A peers | cf-memory a2a --port 9120 |
Agent card at /.well-known/agent.json |
Hermes is the only native provider. It prefetches in the background so recall does not add ~5s to every turn.
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
Deploy the landing page (optional)
The plugin itself is not a Worker. The public page at cloudflare-memory.pages.dev is a static Cloudflare Pages site.
# 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
Credits
- Memory backend: Cloudflare Agent Memory (blog, Discord, Community)
- Protocol: Model Context Protocol
- Hermes provider contract: Nous Research Hermes Agent
- HTTP client: httpx
This repo is not affiliated with Cloudflare or Nous Research.
License
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.