Skip to main content
Glama
ady133t

Cloudflare Memory MCP

by ady133t

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 に固定します。プロジェクトの識別は次の順序で解決されます:

  1. project_root ツール引数(推奨) — 作業フォルダを任意のツールに渡します(例: remember({ project_root: "D:/Projects/foo", content: ... }))。サーバーは正規化したパスのハッシュから安定したプロジェクト ID を生成し、セッションの残り全体でそれを記憶するため、以降の呼び出しでは省略できます。明示的に固定したい場合は identify_project ツールがあります。

  2. project_id ツール引数 — 明示的な ID(これもセッション中キャッシュされます)。

  3. x-project-root / x-project-id ヘッダー — これらを設定するクライアント向け。

  4. MCP roots — クライアントが対応している場合の自動フォルダ検出。

識別情報は単なる正規化パスのハッシュなので、別の絶対パスから開いた同じフォルダでも同じプロジェクトに解決されます。読み書きはすべてその ID でスコープされ、Vectorize のクエリはプロジェクトごとの名前空間を使い、D1 のクエリはすべて project_id でフィルタされるため、2つのフォルダが互いのメモを参照することはありません。

opencode から使う

opencode は自分の作業ディレクトリ(bashcwd)を知っています。エージェントはセッションごとに一度それを渡す必要があります。このリポジトリにはコピーしてすぐ使える 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:local

opencode への接続

エントリは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 ツール

ツール

説明

identify_project

project_root / project_id からセッションのプロジェクト識別子をロックします(解決済み ID を返します)

remember

メモを保存します(意味検索用に埋め込みます)。オプションで entities + relations をグラフに upsert します

query_memory

セマンティック / ベクター検索 — 意味で思い出します。注: Vectorize への変更は非同期のため、remember の数秒後にならないとメモは意味的に検索できません。即時に思い出すには search_memory を使います

search_memory

完全一致キーワード検索(D1 FTS5)

get_recent_memories

プロジェクトの最新メモ

get_project_context

統計 + 最近のメモ + 上位エンティティ + 最近のリレーションをまとめて返します(明示的に呼び出してください)

add_entity / add_relation

意図的にナレッジグラフを構築する

query_graph

エンティティの近傍(深さ1〜3)または最も接続されたエンティティ

forget

メモとその埋め込みを削除する

すべてのツールはオプションの project_root(フォルダパスまたは file:// URI)と project_id を受け入れます。セッション中にどちらかを一度渡すと記憶されます。

無料枠の上限

リソース

無料枠の割り当て

メモ

Durable Object

10万リクエスト/日、約28時間/日の実行可能

MCP セッションを実行します。MCP メッセージごとに約1リクエスト

Vectorize

保存された次元がアカウント全体で5M

約4,800メモを埋め込み(1024次元)。forget で調整できます。クエリは約29k/月

Workers AI

1 万ニューロン/日

1k トークンのメモの bge-m3 埋め込み ≈ 1 ニューロン → 1日あたり数千件

D1

DB ごとに 5 GB / 500 MB

メモ + グラフ + FTS は個人利用では実質無制限

KV / Worker

1 GB / 10万リクエスト/日

キャッシュ + 配信。opencode セッションごとに数リクエスト

ベクターの上限に近づいた場合の設計レバー: remembertype: "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 server
F
license - not found
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables 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.
    16
    MIT
  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    Enables 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
  • A
    license
    Not graded
    quality
    A
    maintenance
    Self-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 AI
    4
    737
    MIT

View all related MCP servers

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.

View all MCP Connectors

Latest Blog Posts

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