Cloudflare Memory MCP
Cloudflare Memory MCP
opencode 向けのプロジェクト単位メモリMCPサーバーで、Cloudflare の無料枠だけで完結します:
メモ — タグと型を持つシンプルなキー付きメモ
ベクター — Vectorize による意味検索(埋め込みは Workers AI の
@cf/baai/bge-m3、1024次元、多言語)グラフ — D1 (SQLite) 内のエンティティ + リレーション、再帰的な辿りに対応
Webダッシュボード — ブラウザで
/を開くと、メモを持つすべてのプロジェクトを確認できます。各プロジェクトカードは、エンティティとリレーションのインタラクティブな力指向グラフ(ホイール = ズーム、ドラッグ = パン、ダブルクリックまたはボタン = リセット、ホバー = 近傍のハイライト)を持つ詳細ビューを開き、プロジェクト、そのメモ、グラフ、FTS 行、キャッシュ、ベクター埋め込みを削除する Delete project ボタンを備えています
opencode ── MCP (streamable HTTP + Bearer auth) ──> Worker
├─ Vectorize memory-vectors (namespace per project)
├─ D1 projects / notes / nodes / edges / FTS5
├─ Workers AI bge-m3 embeddings
└─ KV recent-memories cacheスクリーンショット
プロジェクト一覧
ダッシュボードには、アカウントが知っているすべてのプロジェクトが、メモ数、エンティティ数、リレーション数、最終アクティブ数のカウント付きで一覧表示されます。
ナレッジグラフ
プロジェクトを開くと、そのメモとグラフを確認できます。グラフは、曲線の方向性を持つエッジ、ホバーハイライト、ホイールズーム、ドラッグパン、リセット操作に対応しています。
Related MCP server: MCP Memory
フォルダ分離の仕組み
サーバーは MCP セッションをDurable Object(無料枠、SQLite バックエンド)内で実行し、セッションのすべてのメッセージを1つの isolate に固定します。プロジェクトの識別は次の順序で解決されます:
project_rootツール引数(推奨) — 作業フォルダを任意のツールに渡します(例:remember({ project_root: "D:/Projects/foo", content: ... }))。サーバーは正規化したパスのハッシュから安定したプロジェクト ID を生成し、セッションの残り全体でそれを記憶するため、以降の呼び出しでは省略できます。明示的に固定したい場合はidentify_projectツールがあります。project_idツール引数 — 明示的な ID(これもセッション中キャッシュされます)。x-project-root/x-project-idヘッダー — これらを設定するクライアント向け。MCP roots — クライアントが対応している場合の自動フォルダ検出。
識別情報は単なる正規化パスのハッシュなので、別の絶対パスから開いた同じフォルダでも同じプロジェクトに解決されます。読み書きはすべてその ID でスコープされ、Vectorize のクエリはプロジェクトごとの名前空間を使い、D1 のクエリはすべて project_id でフィルタされるため、2つのフォルダが互いのメモを参照することはありません。
opencode から使う
opencode は自分の作業ディレクトリ(bash の cwd)を知っています。エージェントはセッションごとに一度それを渡す必要があります。このリポジトリにはコピーしてすぐ使える AGENTS.md テンプレートが同梱されています — メモを入れたいプロジェクトにコピーし、PROJECT_ROOT をそのプロジェクトのディレクトリに設定すれば、エージェントはプロジェクトを自動的に認識します:
When using the memory MCP tools, pass project_root (your bash cwd) on the first
memory call of the session.セットアップ
前提条件: Node 18+、Cloudflare account、そして npx wrangler login を一度済ませておくこと。
npm install
npm run setup # creates D1 db, KV namespace, Vectorize index; patches wrangler.toml
npm run db:migrate:remote
npx wrangler secret put MEMORY_AUTH_TOKEN # optional but strongly recommended
npm run deployエンドポイント:
MCP:
https://cloudflare-memory-mcp.<your-subdomain>.workers.dev/mcpダッシュボード:
https://cloudflare-memory-mcp.<your-subdomain>.workers.dev/
ローカル開発:
npm run dev # wrangler dev --local (AI + Vectorize are remote-only)
npm run db:migrate:localopencode への接続
エントリは1つだけ — 同じ設定がすべてのプロジェクトで機能します。プロジェクトごとの値は不要です:
// ~/.config/opencode/opencode.jsonc
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"memory": {
"type": "remote",
"url": "https://cloudflare-memory-mcp.<your-subdomain>.workers.dev/mcp",
"oauth": false,
"headers": {
"Authorization": "Bearer {env:MEMORY_AUTH_TOKEN}"
}
}
}
}プロジェクトの識別はその後エージェント自身が行います。各セッションの最初のメモリ呼び出しで作業フォルダを project_root として渡し(上記の AGENTS.md のヒントを参照)、以降はサーバーがすべてをそのフォルダにスコープします。
ダッシュボード(/)は同じ MEMORY_AUTH_TOKEN を一度だけ要求し、それを localStorage に保存します。MEMORY_AUTH_TOKEN を設定しないままにすると、すべてが公開されます — それは個人用や使い捨ての実験だけで行ってください。
MCP ツール
ツール | 説明 |
|
|
| メモを保存します(意味検索用に埋め込みます)。オプションで |
| セマンティック / ベクター検索 — 意味で思い出します。注: Vectorize への変更は非同期のため、 |
| 完全一致キーワード検索(D1 FTS5) |
| プロジェクトの最新メモ |
| 統計 + 最近のメモ + 上位エンティティ + 最近のリレーションをまとめて返します(明示的に呼び出してください) |
| 意図的にナレッジグラフを構築する |
| エンティティの近傍(深さ1〜3)または最も接続されたエンティティ |
| メモとその埋め込みを削除する |
すべてのツールはオプションの project_root(フォルダパスまたは file:// URI)と
project_id を受け入れます。セッション中にどちらかを一度渡すと記憶されます。
無料枠の上限
リソース | 無料枠の割り当て | メモ |
Durable Object | 10万リクエスト/日、約28時間/日の実行可能 | MCP セッションを実行します。MCP メッセージごとに約1リクエスト |
Vectorize | 保存された次元がアカウント全体で5M | 約4,800メモを埋め込み(1024次元)。 |
Workers AI | 1 万ニューロン/日 | 1k トークンのメモの bge-m3 埋め込み ≈ 1 ニューロン → 1日あたり数千件 |
D1 | DB ごとに 5 GB / 500 MB | メモ + グラフ + FTS は個人利用では実質無制限 |
KV / Worker | 1 GB / 10万リクエスト/日 | キャッシュ + 配信。opencode セッションごとに数リクエスト |
ベクターの上限に近づいた場合の設計レバー: remember の type: "decision" | "fact" で永続的なメモだけを埋め込んで、search_memory(FTS5、上限なし)がロングテールを担うようにする。あるいはインデックスを bge-small(384次元・英語限定)で再作成すれば、約 3 ± い幅にできます。
プロジェクト構成
src/index.ts fetch router: dashboard, /api/*, /mcp -> Durable Object
src/session-do.ts MCP session host (Durable Object): sessions, SSE, roots, identity
src/tools.ts the 10 tool definitions (zod schemas + implementations)
src/store.ts D1 / Vectorize / KV data layer
src/identity.ts project-id derivation from folder roots
src/embed.ts Workers AI bge-m3 embeddings
src/api.ts dashboard API (projects, detail, graph, delete)
src/web.ts dashboard page (token-gated)
migrations/ D1 schema
scripts/setup.mjs creates Cloudflare resources and patches wrangler.toml
AGENTS.md template to copy into projects that use this memory serverThis server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to remember user information and preferences across conversations using vector search technology. Built on Cloudflare infrastructure with isolated user namespaces for secure, persistent memory storage.16MIT
- FlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to remember and retrieve user information across conversations using vector search technology. Built on Cloudflare infrastructure with isolated user namespaces for secure, persistent memory storage.16
- FlicenseNot gradedqualityDmaintenanceProvides cross-device access to a persistent knowledge graph via Cloudflare Workers, enabling memory storage and retrieval through both MCP protocol and REST API with full-text search capabilities.
- AlicenseNot gradedqualityAmaintenanceSelf-hosted semantic memory layer for Claude and MCP-compatible AI clients. Store notes, search by meaning not keywords, and recall relevant context automatically across sessions. Runs free on Cloudflare Workers, D1, Vectorize, and Workers AI4737MIT
Related MCP Connectors
Universal memory for AI agents and tools. Save, organize and search context anywhere.
Cross-session, cross-device memory for your agent: remember and recall notes. No key to start.
Persistent memory and knowledge management for AI agents with semantic search and 50+ tools.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ady133t/Cloudflare-Memory-Mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server