Memory-MCP

Memory-MCP

Shared, live team memory for Claude — a remote MCP server on Cloudflare Workers + D1.

Category
访问服务器

README

Memory-MCP

Shared, live team memory for Claude — a remote MCP server on Cloudflare Workers + D1.

Everyone's Claude Code writes what it learns; everyone reads it. One live source, global at the edge. When one teammate figures something out, the whole team's Claude knows it.


Why

A distributed team using Claude Code (or any MCP client) keeps re-learning the same things. Each person's assistant has its own local memory — decisions, gotchas, conventions — and none of it is shared. Memory-MCP is a tiny, self-hostable server that gives the whole team one shared memory their AI assistants can read and write through the Model Context Protocol.

  • Index-first / lazy-body — a session starts with lightweight titles only; full bodies are fetched on demand. Token-efficient.
  • Verified authorship — the author of every note comes from the token, not the client. It can't be forged.
  • Accent/case-insensitive search — full-text search folds diacritics and case (built with Turkish in mind, works for any Latin script).
  • History + soft-delete — every change is archived; deletes are reversible.
  • Secret guard — key/token/password-shaped content is rejected, so secrets never land in shared memory.

Architecture

Each teammate's Claude Code ──(.mcp.json, personal Bearer token)──▶ Worker /mcp   ──▶ D1 (memories + FTS5 + history)
SessionStart hook (optional) ─(curl)──────────────────────────────▶ Worker /index ──▶ budgeted title list
  • Worker — a single Cloudflare Worker. /mcp speaks MCP (streamable HTTP, via a Durable Object); /index is a plain REST endpoint for a lightweight title list.
  • D1 — SQLite at the edge. One memories table + an FTS5 search index + a memory_history audit table.

Setup

Prerequisites: a Cloudflare account, Node.js 18+, and Wrangler (npx wrangler login).

# 1. Install
git clone https://github.com/CedraInteractive/Memory-MCP.git
cd Memory-MCP
npm install

# 2. Create the D1 database, then paste the printed database_id into wrangler.jsonc
npx wrangler d1 create memory-mcp

# 3. Apply the schema (remote)
npm run db:init

# 4. Set the team token(s) — see "Identity" below
npx wrangler secret put AUTH_TOKENS       # {"tok_alice_...":"alice","tok_bob_...":"bob"}

# 5. Deploy
npm run deploy

Wrangler prints your worker URL, e.g. https://memory-mcp.<your-subdomain>.workers.dev.

Identity

Give each teammate their own token. AUTH_TOKENS is a JSON map of token → author:

{ "tok_alice_a1b2c3...": "alice", "tok_bob_d4e5f6...": "bob" }

Because the author is resolved server-side from the token, notes are attributed reliably and you can revoke one person by removing their entry and redeploying. (A single shared AUTH_TOKEN is also supported — author becomes shared.)

Generate a token however you like, e.g.:

node -e "console.log('tok_alice_'+require('crypto').randomBytes(16).toString('hex'))"

Connect Claude Code

Copy .mcp.example.json to your project's .mcp.json (or your global config), fill in your subdomain, and set the MEMORY_MCP_TOKEN environment variable to your personal token:

{
  "mcpServers": {
    "memory": {
      "type": "http",
      "url": "https://memory-mcp.<your-subdomain>.workers.dev/mcp",
      "headers": { "Authorization": "Bearer ${MEMORY_MCP_TOKEN}" }
    }
  }
}

Restart Claude Code — the memory_* tools are available. Just talk to it: "search the team memory for the deploy steps", "save this to team memory: …".

Optional: auto-load on session start

To surface memory titles at the start of every session, add a SessionStart hook that curls the index:

curl -s -H "Authorization: Bearer $MEMORY_MCP_TOKEN" \
  https://memory-mcp.<your-subdomain>.workers.dev/index

This returns a lightweight, character-budgeted title list (no bodies) — cheap on tokens.

MCP tools

Tool What it does
memory_search(query, limit?) Full-text search (accent/case-insensitive); lightweight rows
memory_get(name) Full body of one note (lazy)
memory_upsert(name, description, body, type?, status?, project?) Write/update; author is automatic; secrets rejected; prior version archived
memory_delete(name) Soft-delete (reversible; archived to history)
memory_restore(name) Restore a soft-deleted note
memory_history(name, limit?) Version history — who changed what, when
memory_recent(since?, limit?) What changed mid-session
GET /index REST title list (for the SessionStart hook)

Fields. status: preferred (confirmed) · tentative (needs review) · contested (conflicting). type: feedback · reference · project · shared.

Development

npm test          # pure-logic tests (fold, secret guard, index budget) — Node's built-in runner
npm run typecheck # tsc --noEmit
npm run dev       # wrangler dev (local)

The pure logic (src/lib.ts) is worker-independent and unit-tested; the worker/MCP wiring lives in src/index.ts.

Security notes

  • All requests require a Bearer token. For a stricter setup (e.g. a team on a private network), put the worker behind Cloudflare Access so there is no public endpoint.
  • The secret guard is defense-in-depth, not a vault — never rely on it to scrub real secrets. Keep credentials out of memory entirely.
  • Deletes are soft (recoverable) and every change is auditable via memory_history.

License

MIT — see LICENSE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选