exchangeMCP
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
exchangeMCP
A universal memory server for AI assistants. Add it as a custom connector in Claude, ChatGPT, Gemini or any other MCP client, and any of them can save and recall memories. Something you discuss in one app can then be picked up in another.
Runtime: TypeScript on Cloudflare Workers (free tier)
Protocol: MCP Streamable HTTP, stateless, at
POST /mcpStorage: Cloudflare D1 (SQLite) with an FTS5 full-text index, behind a swappable
MemoryStoreinterfaceAuth: a shared secret, sent either as
Authorization: Bearer <token>or in the URL path as/mcp/<token>
Memory format
Each memory is one markdown "file", addressed by a path such as /writing/style.md. The format mirrors Claude's memory files:
---
name: style
description: "How I like my writing"
---
- [stated] Prefers British spelling
- [stated] Short sentences, no em dashesColumns: path (unique), description (one line), body (markdown), tags (JSON array), source (the AI that last wrote it, e.g. claude, chatgpt, gemini), created_at, updated_at.
Paths are normalised to lowercase, get a leading /, and get .md appended if it's missing. Each segment may only contain a-z 0-9 . _ -. If write_memory receives a body without frontmatter, the frontmatter is added automatically.
Related MCP server: my-memory-mcp
Tools
Tool | Purpose |
| Index of paths with their descriptions and |
| Full markdown plus metadata |
| Create or overwrite |
| Append lines to an existing memory (atomic, size-checked) |
| Delete a memory |
| Ranked FTS5 (bm25) results with snippets |
| ChatGPT connector alias. Returns one text item: |
| ChatGPT connector alias. Returns one text item: |
For search and fetch, the id is the memory path. The server also sends MCP instructions telling clients to check memory at the start of a chat, and to store only durable facts the user stated, never secrets or passwords.
HTTP routes
Route | Auth | Description |
| yes | MCP endpoint. |
| yes | Backup. JSON, or a zip of |
| Bearer header only | Raw markdown of one memory. This is the |
| no | Returns |
Limits: each memory body is capped at 64 KB (MAX_BODY_BYTES in wrangler.toml), each request at 512 KB, and every tool input is validated with zod.
Setup
Prerequisites: Node 20+ and a free Cloudflare account. Everything runs through npx wrangler, so you don't need a global install.
npm install
npx wrangler login1. Create the D1 database
npx wrangler d1 create exchangeYou don't need to copy the database_id anywhere. wrangler.toml binds the database by name (database_name = "exchange"), and Wrangler looks up the ID in your account when it deploys or runs remote migrations, so the ID never ends up in the repo. If you use a different name, change database_name to match. If Wrangler offers to write a database_id into wrangler.toml, discard that change.
2. Apply migrations
npm run db:migrate:local # local dev database (.wrangler/)
npm run db:migrate:remote # the real D1 database3. Set the secret
Generate a long random token. Tokens shorter than 16 characters are rejected.
openssl rand -hex 32
npx wrangler secret put EXCHANGE_TOKEN # paste the token when promptedFor local dev:
cp .dev.vars.example .dev.vars # then put a token in .dev.vars4. Local dev
npm run dev # wrangler dev → http://localhost:8787
curl localhost:8787/healthTry it with the MCP Inspector (npx @modelcontextprotocol/inspector): choose transport "Streamable HTTP", use URL http://localhost:8787/mcp, and add the header Authorization: Bearer <token>.
5. Deploy
npm run deploy # wrangler deployYour endpoint is https://exchange-mcp.<your-subdomain>.workers.dev/mcp.
Connecting AI clients
Use one of these two URL forms:
Header auth (preferred):
https://…workers.dev/mcp, withAuthorization: Bearer <token>URL auth (for UIs without a headers field):
https://…workers.dev/mcp/<token>
Treat the
/mcp/<token>URL like a password. Anyone who has it can read and write your memories. To revoke it, rotate the secret withwrangler secret put EXCHANGE_TOKEN.
Menu names change often, and custom connectors may require a paid plan. The steps below describe the general flow.
Claude (claude.ai, Desktop, mobile)
Go to Settings → Connectors → Add custom connector.
Name:
exchange. URL:https://…workers.dev/mcp/<token>.Leave the OAuth fields empty, then save. In a chat, enable the connector from the tools menu.
Claude Code:
claude mcp add --transport http exchange https://…workers.dev/mcp --header "Authorization: Bearer <token>"ChatGPT
Go to Settings → Apps & Connectors → Advanced and enable Developer mode.
Create a connector. MCP server URL:
https://…workers.dev/mcp/<token>. Authentication: No authentication, because the token is in the URL.ChatGPT uses
searchandfetchfor deep research and connector search. In developer mode, every tool is available.
Gemini
Gemini CLI (~/.gemini/settings.json):
{
"mcpServers": {
"exchange": {
"httpUrl": "https://…workers.dev/mcp",
"headers": { "Authorization": "Bearer <token>" }
}
}
}If your Gemini app or Workspace edition lets you add custom MCP connectors, use the same URL. Use /mcp/<token> if it has no headers field.
Any other MCP client
Point a Streamable HTTP client at /mcp with the Bearer header, or at /mcp/<token>.
Custom instruction
To make each assistant use the memory consistently, add this line to its custom instructions (Claude: profile preferences; ChatGPT: Customize ChatGPT; Gemini: saved info):
At the start of a chat, check exchange for relevant memory. Save durable facts there when I ask.
Backup
curl -H "Authorization: Bearer $TOKEN" "https://…workers.dev/export" -o exchange.json
curl -H "Authorization: Bearer $TOKEN" "https://…workers.dev/export?format=zip" -o exchange.zipTests
npm test # Vitest inside workerd (Miniflare) with a real local D1 and migrations applied
npm run typecheckThe tests cover the storage layer (CRUD, prefix listing, atomic append, FTS5 ranking, trigger sync, FTS injection), auth (bearer, path token, constant-time compare, fail-closed), every MCP tool (through an in-memory MCP client), and the HTTP routes (401/404/405/413, stateless initialize, export JSON/zip).
Project layout
migrations/0001_init.sql memories table, FTS5 index, sync triggers
src/index.ts Worker router (/health, /mcp, /export, /memory)
src/auth.ts Bearer / path-token auth, constant-time compare, OAuth TODO
src/mcp.ts MCP server factory and tool definitions
src/schemas.ts zod schemas, path normalisation, size limits
src/export.ts JSON / zip export
src/storage/types.ts MemoryStore interface
src/storage/d1.ts D1 implementation
test/ Vitest suitesSwapping storage
Everything outside src/storage/ depends only on the MemoryStore interface in src/storage/types.ts. To move to Postgres or Azure SQL:
Implement
MemoryStore. Use atsvector/GIN index (Postgres) or a full-text index (Azure SQL) in place of FTS5.Construct it in
src/index.tsinstead ofD1MemoryStore. From a Worker, Postgres can be reached through Hyperdrive.
Security notes
Tokens are compared in constant time: both values are SHA-256 hashed, then XOR-compared.
The server never logs tokens, request bodies or memory content. Unhandled errors log only the error class.
A URL-path token can still show up in platform request logs. That includes
wrangler devoutput and Cloudflare's request logs, if you enable them. Prefer the Bearer header wherever the client supports it.Memories are meant for durable facts, not secrets. The tool descriptions tell every AI client this.
TODO (OAuth): add OAuth 2.1 per the MCP authorization spec, probably with
@cloudflare/workers-oauth-provider. That would let Claude and ChatGPT run their native connector sign-in and give each client its own revocable token. See the TODO insrc/auth.ts.
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Persistent personal memory for AI assistants — save, search, and recall across every MCP client.
Persistent, verbatim, searchable memory for AI assistants — one memory across every MCP client.
An MCP memory server. One memory your agents share — across models, devices and apps.
MCP server that gives every AI tool the same memory. Save once in Claude, use it in ChatGPT, Cursor or any MCP client: your knowledge, preferences and decisions go with you, and it learns how you work.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceAn MCP server enabling AI assistants to store, retrieve, and manage contextual information across conversations with features like persistent memory, advanced search, tagging, and privacy controls.MIT
- FlicenseNot gradedqualityDmaintenanceA MCP server that provides persistent memory for AI assistants, storing personal information, relationships, and observations to enable personalized and contextual conversations.4-
- AlicenseNot gradedqualityDmaintenanceA personal memory MCP server that stores and retrieves conversation memories, enabling AI agents to recall past discussions, promises, and preferences using natural language.MIT
- FlicenseNot gradedqualityCmaintenanceA remote MCP server that gives AI assistants a shared memory, enabling structured handoffs, journaling, and notes for seamless continuation across sessions.-