Claude Memory
A lightweight MCP server that gives Claude Code Channels on Telegram persistent memory by storing facts, conversation logs, and session summaries in Supabase.
README
Claude Memory
Persistent memory for Claude Code Channels via Telegram, powered by Supabase and MCP.
Claude Memory is a lightweight MCP server built to give Claude Code Channels on Telegram a practical long-term memory layer. It stores facts, conversation logs, and session summaries in Supabase so Claude can recall useful context across sessions instead of starting from scratch every time.
It was created for the real-world workflow of staying connected to Claude through Telegram, where convenience is high but continuity can easily get lost.
Why this exists
Claude Code Channels on Telegram make it incredibly convenient to stay connected to Claude from anywhere, but useful context can disappear between sessions unless you provide a memory layer.
This project solves that problem by adding persistent memory through Supabase. It allows Claude to remember important facts, recall previous conversations, and carry forward relevant context over time.
The goal is not to build a giant, overengineered framework. The goal is to create a simple, practical memory system that is easy to run, easy to understand, and genuinely useful in everyday Claude Code workflows via Telegram.
While it was built specifically for Claude Code Channels on Telegram, the same overall pattern may also be useful for other trusted MCP-based Claude workflows.
What it stores
- Facts for long-lived memory
- Messages for conversation history
- Summaries for session-level context compression
Core tools
remember— save an important factrecall— search previous facts, messages, and summariesforget— deactivate a factstart_session— begin a new conversation sessionend_session— close a sessionload_context— load useful recent contextlog_message— store conversation messages
Quick example
- “Remember that I prefer TypeScript” → saves a fact
- “What did we discuss yesterday?” → recalls prior context
- “Forget that TypeScript preference” → deactivates the saved fact
- Start a new session → Claude can load relevant context automatically
Prerequisites
- Bun runtime (install:
curl -fsSL https://bun.sh/install | bash) - A free Supabase account
- Claude Code (CLI) or Claude Desktop
Setup (5 minutes)
Step 1: Create a Supabase Project
- Go to supabase.com and create a free account
- Click New Project, give it a name (e.g.
claude-memory), set a password, and pick a region - Wait for the project to finish provisioning (~30 seconds)
Step 2: Create the Database Tables
- In your Supabase dashboard, go to SQL Editor (left sidebar)
- Click New Query
- Paste the entire contents of
schema.sqlinto the editor - Click Run — you should see "Success. No rows returned" for each statement
This creates three tables: messages, summaries, and facts.
Step 3: Get Your Credentials
- In Supabase, go to Settings > API (left sidebar)
- Copy these two values:
- Project URL (looks like
https://abc123.supabase.co) - service_role key (under "Project API keys" — use the
service_rolekey, NOT theanonkey)
- Project URL (looks like
Step 4: Clone and Configure
git clone https://github.com/jordanl61/claude-memory.git
cd claude-memory
# Create your .env file
cp .env.example .env
Edit .env and paste in your credentials:
SUPABASE_URL=https://your-project-id.supabase.co
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key-here
Step 5: Install and Build
bun install
bun run build
Step 6: Register the MCP Server
For Claude Code (CLI)
Add this to your .claude.json file (in your home directory or project root):
{
"mcpServers": {
"memory": {
"command": "bun",
"args": ["run", "/full/path/to/claude-memory/dist/server.js"],
"env": {
"SUPABASE_URL": "https://your-project-id.supabase.co",
"SUPABASE_SERVICE_ROLE_KEY": "your-service-role-key-here"
}
}
}
}
Important: Replace
/full/path/to/claude-memory/with the actual absolute path where you cloned the repo.
For Claude Desktop
Add the same config to your claude_desktop_config.json:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"memory": {
"command": "bun",
"args": ["run", "/full/path/to/claude-memory/dist/server.js"],
"env": {
"SUPABASE_URL": "https://your-project-id.supabase.co",
"SUPABASE_SERVICE_ROLE_KEY": "your-service-role-key-here"
}
}
}
}
Step 7: Restart Claude
Restart Claude Code or Claude Desktop. The memory tools should now be available.
To verify: Ask Claude "Do you have memory tools available?" — it should list the remember, recall, forget tools.
Usage
Once installed, just talk to Claude naturally:
- "Remember that I prefer dark mode" — Claude calls
remember - "What did we talk about yesterday?" — Claude calls
recall - "Forget that thing about dark mode" — Claude calls
forget
Claude will also automatically load context from past sessions when starting a new conversation (if you or Claude calls start_session).
Optional: Auto-Sync Hooks (Claude Code Only)
The scripts/ directory contains hook scripts that automatically log every message and generate session summaries without you having to do anything. These only work with Claude Code (not Desktop), since they rely on Claude Code's hook system.
See the scripts in scripts/ if you want to set these up — they require additional configuration in your Claude Code settings.json.
Architecture
You <-> Claude <-> MCP Server <-> Supabase
|
memory tools
(remember, recall, etc.)
- MCP Server (
server.ts) — Exposes memory tools via the Model Context Protocol - Database (
db.ts) — Handles all Supabase queries - Schema (
schema.sql) — Three tables:messages,summaries,facts
Files
| File | Purpose |
|---|---|
server.ts |
MCP server entry point — defines all tools |
db.ts |
Supabase database helpers |
schema.sql |
Database table definitions |
package.json |
Dependencies and build scripts |
scripts/sync-to-supabase.ts |
Auto-sync hook (logs messages after each turn) |
scripts/session-summary.ts |
Session end summary hook |
scripts/save-fact.ts |
Utility to save facts directly |
scripts/memory-health-check.sh |
Health check script |
Security Notes
This project is intended to run in a trusted local or server-side MCP environment for Claude Code Channels via Telegram.
- Use the
service_rolekey only in environments you control - Never expose the
service_rolekey in browser-based apps or client-side code - Never commit your
.envfile or API keys to GitHub - Rotate your key immediately if you believe it has been exposed
- Consider creating a dedicated Supabase project just for this memory server
Row Level Security (RLS) is enabled in the Supabase setup, but the service_role key still has elevated privileges and should always be treated as highly sensitive.
Trust Model
Claude Memory is designed for a trusted MCP runtime using Supabase server credentials.
This project uses Supabase as the persistent memory layer and is intended to run locally or in a server environment you control. Row Level Security (RLS) is enabled, but the MCP server uses the Supabase service_role key for trusted server-side access.
That means:
- database access happens through the MCP server, not directly from a client app
- the
service_rolekey must remain private - this project is optimized for trusted Claude workflows rather than public-facing client deployments
If you want to adapt this project for a broader multi-user or less-trusted environment, you may want to extend it further with:
- per-user ownership and tenancy design
- stricter authenticated access patterns
- tighter secret handling and deployment controls
- additional audit and usage safeguards
Disclaimer
This project is provided in good faith as a practical tool for trusted Claude Code Channels via Telegram workflows.
It is provided as is, without warranty of any kind. You are responsible for reviewing the code, securing your environment, protecting your secrets, and deciding whether it is appropriate for your use case.
Please do not expose privileged Supabase credentials in untrusted or client-side environments. See the LICENSE file for the full license terms.
Roadmap
- [x] Persistent fact storage
- [x] Conversation logging
- [x] Session summaries
- [x] Claude Code Channels via Telegram workflow
- [x] Supabase-backed persistent storage
- [x] RLS-enabled database setup
- [ ] Better search and recall quality
- [ ] Optional semantic search / embeddings
- [ ] Multi-user namespacing
- [ ] Hardened deployment guidance for broader use cases
- [ ] Backup / export utilities
- [ ] Additional examples, screenshots, and setup docs
Troubleshooting
"Missing SUPABASE_URL or SUPABASE_SERVICE_ROLE_KEY"
Your .env file is missing or the env vars aren't being passed. Make sure the env block in your MCP config has the correct values.
Memory tools don't show up
Restart Claude Code/Desktop after adding the MCP config. Check that the path to dist/server.js is correct and absolute.
"logMessage error" / database errors
Make sure you ran schema.sql in the Supabase SQL Editor. Check that you're using the service_role key (not the anon key).
Created by Lawrence Jordan
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。