MemoryBuddy

MemoryBuddy

A shared memory MCP server for AI agents that provides persistent, semantic memory across sessions and tools, enabling long-term recall and context sharing.

Category
Visit Server

README

MemoryBuddy 🧠

äø­ę–‡ē‰ˆ

Give your AI agents a shared memory that lasts. Deploy once, connect any MCP-compatible AI tool — Hermes, Trae, Cursor, Claude Desktop — they all share the same memory.

License: MIT Cloudflare Workers TypeScript MCP Free Tier

🌟 What is this?

Most AI tools suffer from "goldfish memory" — refresh the page, start a new session, switch to another app, and everything's gone. You keep reintroducing yourself, re-explaining your preferences, re-stating context.

MemoryBuddy fixes this with a shared memory layer that any AI tool can read from and write to:

  • 🧠 Long-term memory — facts, preferences, decisions persist across sessions
  • šŸ” Semantic search — find relevant memories by meaning, not just keywords
  • šŸ¤– Auto fact extraction — LLM automatically distills what's worth remembering
  • šŸ“ Smart summarization — long conversations get compressed, key points retained
  • šŸ—‘ļø One-click forget — DELETE wipes everything, GDPR compliant
  • šŸ”Œ MCP protocol — any MCP-compatible client can connect, zero integration code
  • šŸ’ø $0/month — runs entirely on Cloudflare's free tier

šŸ’” What problem does it solve?

😣 Without MemoryBuddy āœ… With MemoryBuddy
Every AI tool starts fresh — you re-explain yourself constantly All your AI tools share one memory — tell one, they all know
Switching from Hermes to Trae means losing all context Switch freely — memory lives in the cloud, not in the tool
AI forgets your preferences between sessions Preferences persist forever, across all sessions and all tools
Long conversations hit context limits Auto-summarization keeps things compact
Privacy concerns — can't delete what it remembers One API call wipes everything, fully GDPR compliant

šŸ—ļø Architecture

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”   ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”   ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”   ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│ Hermes  │   │  Trae   │   │ Cursor  │   │ Claude  │
ā””ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”˜   ā””ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”˜   ā””ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”˜   ā””ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”˜
     │ MCP         │ MCP         │ MCP         │ MCP
     ā–¼             ā–¼             ā–¼             ā–¼
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│           MemoryBuddy Worker (Cloudflare)         │
│                                                  │
│   /mcp  → MCP Server (5 tools, Streamable HTTP)  │
│   /chat → HTTP API (SSE streaming + auto-extract)│
│   /memory/:userId → REST API                     │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
           │                  │
     ā”Œā”€ā”€ā”€ā”€ā”€ā–¼ā”€ā”€ā”€ā”€ā”€ā”    ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā–¼ā”€ā”€ā”€ā”€ā”€ā”€ā”
     │ D1 (facts)│    │ Vectorize   │
     │ SQLite DB │    │ (embeddings)│
     ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜    ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Three-tier memory:

  1. Short-term (Durable Object) — current conversation context
  2. Long-term (D1 database) — structured facts: name, preferences, key entities
  3. Semantic (Vectorize) — vector embeddings for meaning-based recall

šŸš€ Quick Start (3 steps, ~5 minutes)

Prerequisites

1. Clone & Install

git clone https://github.com/Trainspotting31/memory-buddy.git
cd memory-buddy
npm install

2. Create Cloudflare Resources

npx wrangler login

# Create D1 database
npx wrangler d1 create memory-buddy-db

# Create Vectorize index
npx wrangler vectorize create memory-buddy-index --dimensions 768 --metric cosine

# Initialize database schema
npx wrangler d1 execute memory-buddy-db --remote --file=schema.sql

Copy the generated database_id into wrangler.toml (rename from wrangler.toml.example).

3. Deploy

npx wrangler deploy

Done! Your memory server is live at https://memory-buddy.<your-subdomain>.workers.dev šŸŽ‰

šŸ”Œ Connect Your AI Tools

MemoryBuddy speaks MCP (Model Context Protocol). Any MCP-compatible tool can connect — they all share the same memory.

Hermes Agent

hermes mcp add memory-buddy --url https://memory-buddy.<your-subdomain>.workers.dev/mcp

Trae IDE

  1. Settings → MCP → Add Manually
  2. Type: Streamable HTTP
  3. URL: https://memory-buddy.<your-subdomain>.workers.dev/mcp

Or create .trae/mcp.json in your project:

{
  "mcpServers": {
    "memory-buddy": {
      "type": "streamable-http",
      "url": "https://memory-buddy.<your-subdomain>.workers.dev/mcp"
    }
  }
}

Cursor

Add to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "memory-buddy": {
      "url": "https://memory-buddy.<your-subdomain>.workers.dev/mcp"
    }
  }
}

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "memory-buddy": {
      "type": "streamable-http",
      "url": "https://memory-buddy.<your-subdomain>.workers.dev/mcp"
    }
  }
}

Any MCP Client (raw config)

Endpoint: https://memory-buddy.<your-subdomain>.workers.dev/mcp
Transport: Streamable HTTP
Auth: None (or add your own)

šŸ› ļø MCP Tools

Once connected, the AI gets 5 tools:

Tool What it does When AI calls it
recall_memory Load all memory for a user Start of conversation
search_memory Semantic search by meaning "What did I say about X?"
store_memory Save a new fact User shares preferences, decisions
forget_memory Delete all memory User says "forget everything"
list_memory_users List all memory spaces Checking what exists

Shared memory: All tools default to userId: "hermes-shared". Use different userIds to isolate memory per project/persona.

šŸ“” HTTP API (no MCP needed)

POST /chat — Chat with memory

curl -N -X POST https://your-worker.workers.dev/chat \
  -H "Content-Type: application/json" \
  -d '{"userId":"user123","message":"Hi! I'm John and I love espresso."}'

GET /memory/:userId — Get all memory

curl https://your-worker.workers.dev/memory/user123

DELETE /memory/:userId — Wipe memory

curl -X DELETE https://your-worker.workers.dev/memory/user123

GET /health — Health check

curl https://your-worker.workers.dev/health

āš™ļø Configuration

Edit wrangler.toml:

[vars]
LLM_MODEL = "@cf/meta/llama-3.2-3b-instruct"  # Default: Workers AI (free)

# Optional: use external LLM instead of Workers AI
LLM_API_KEY = "sk-your-key"
LLM_API_BASE = "https://api.openai.com/v1"
LLM_MODEL = "gpt-4o-mini"

šŸ’ø Why Cloudflare Free Tier?

Component Free Tier Self-Hosted Equivalent
Compute (Workers) 100K req/day $5–$50/mo (VPS)
Database (D1) 1GB storage $10–$100/mo (Postgres)
Vector DB (Vectorize) 256K vectors $70+/mo (Pinecone)
LLM (Workers AI) 10K neurons/day $10+/mo (API)
Total $0 ~$100+/mo

šŸ“ Project Structure

memory-buddy/
ā”œā”€ā”€ src/
│   ā”œā”€ā”€ index.ts          # Hono router: /mcp + /chat + /memory + /health
│   ā”œā”€ā”€ mcp.ts            # MCP Server factory (5 tools, stateless)
│   ā”œā”€ā”€ agent-do.ts       # Durable Object: chat session + memory orchestration
│   ā”œā”€ā”€ llm.ts            # LLM abstraction (Workers AI / OpenAI-compatible)
│   └── memory/
│       ā”œā”€ā”€ extract.ts    # LLM-powered fact extraction
│       ā”œā”€ā”€ retrieve.ts   # Hybrid retrieval (D1 + Vectorize)
│       └── summarize.ts  # Conversation summarization
ā”œā”€ā”€ public/index.html     # Built-in demo chat UI
ā”œā”€ā”€ schema.sql            # D1 database schema
ā”œā”€ā”€ wrangler.toml.example # Cloudflare config template
└── package.json

šŸŽ® Try the Demo

Open your Worker URL in a browser — you'll see a built-in chat interface.

  1. Tell the agent your name and a preference ("I'm Sarah, I'm allergic to peanuts")
  2. Refresh the page
  3. Ask: "What do you know about me?"

It remembers everything. That's MemoryBuddy.

šŸ—ŗļø Roadmap

  • [x] MCP Server (Streamable HTTP)
  • [x] Multi-agent shared memory
  • [x] Semantic search
  • [x] Auto fact extraction
  • [ ] Memory categories & filtering
  • [ ] User authentication
  • [ ] Batch memory import/export
  • [ ] Multi-language support
  • [ ] Hermes plugin (auto-inject memory at conversation start)

šŸ¤ Contributing

  1. Fork → 2. Branch → 3. Commit → 4. Push → 5. PR

šŸ“„ License

MIT — see LICENSE

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured