archive/ConversationsMemory
0 forks
deprecatedreplaced
Persistent memory across multiple systems for agentic workflows.

While I was happy with the result(s), i've decided to replace this with @genAi/Tapedeck, so that the project will become more stable and focus on large ecosystems rather than teams of >3 <10.
id: 18
85,358 Lines
  • CSS 52.1%
  • JavaScript 44.8%
  • CSharp 2.3%
  • Markdown 0.6%
  • Yaml 0.1%
  • JSON 0.1%
README.md

Memory MCP

A Persistent Memory Tool with semantic embeddings, designed for LLM/AI agent situations using the Model Context Protocol (MCP). It enables AI agents to store, search, and retrieve contextual information across sessions, providing long-term memory capabilities.

Features

  • Store context - Save text with tags, project names, and session IDs
  • Search memory - Find relevant past context using text search or vector embeddings
  • Session summaries - Retrieve all context stored for a specific session
  • Multiple backends - Switch between ChromaDB and MongoDB
  • Semantic embeddings - Powered by all-MiniLM-L6-v2 (384 dimensions, ONNX) for meaningful vector similarity
  • HTTP API - Test and interact with memory endpoints via REST
  • MCP stdio transport - Native integration with MCP clients (Claude Desktop, Cursor, etc.)

Architecture

┌─────────────────┐     ┌──────────────────┐     ┌─────────────────┐
│   MCP Client    │────▶│  Memory MCP      │────▶│  ChromaDB /     │
│ (Claude, etc.)  │     │  Server          │     │  MongoDB        │
└─────────────────┘     └──────────────────┘     └─────────────────┘
                               │
                               ▼
                         ┌──────────────────┐
                         │  HTTP Endpoints  │
                         │  (for testing)   │
                         └──────────────────┘

Embeddings

Text embeddings are generated locally using the all-MiniLM-L6-v2 ONNX model via Microsoft.ML.OnnxRuntime. The model and vocabulary are automatically downloaded on first use to .models/all-MiniLM-L6-v2/ in the application directory (~80MB).

  • Dimensions: 384
  • Pooling: Mean pooling with attention mask
  • Normalization: L2-normalized (cosine similarity via dot product)

Memory Backends

BackendSearch TypeEmbeddings
ChromaDBVector similarityONNX semantic embeddings (all-MiniLM-L6-v2)
MongoDBText index + vectorONNX semantic embeddings (all-MiniLM-L6-v2)

MCP Tools

ToolRequired paramsOptional paramsDescription
store_contexttext, project, sessionIdtagsPersist a memory entry (tape) to long-term storage. Use for decisions, file changes, or conventions worth recalling later. Text is embedded with all-MiniLM-L6-v2. Returns { id, stored }.
search_contextsearchQuery, projecttagsSearch stored tapes for context relevant to the current task. Returns up to 10 results sorted by most recently updated.
get_session_summarysessionIdLightweight overview of one session: tape count plus messages, tags, and timestamps. Use to decide whether to call continue_session.
continue_sessionsessionIdLoad the full body of every tape in a session, ordered by creation time. Use to resume a previous conversation with complete context.
delete_tapetapeIdPermanently delete a single tape by its id. Use to remove incorrect, stale, or sensitive entries. Returns { id, deleted }.
unwindcount, projectRetrieve the latest N tapes (default 10) sorted by creation date, newest first. Use to export recent memory entries to disk as markdown files for a specific project. Returns { tapes, count }.

HTTP Endpoints

EndpointMethodDescription
/memory/storePOSTStore a new memory entry
/memory/searchPOSTSearch stored memories
/memory/session-summaryPOSTGet session summary
/memory/deletePOSTDelete a single tape by id
/memory/unwindPOSTGet latest N tapes (default 10) for export

Example Requests

# Store a memory
curl -X POST http://localhost:5000/memory/store \
  -H "Content-Type: application/json" \
  -d '{
    "text": "The user is building a React application with TypeScript",
    "tags": ["react", "typescript", "frontend"],
    "project": "my-app",
    "sessionId": "session-001"
  }'

# Search memories
curl -X POST http://localhost:5000/memory/search \
  -H "Content-Type: application/json" \
  -d '{
    "searchQuery": "React application",
    "tags": ["react"],
    "project": "my-app"
  }'

# Get session summary
curl -X POST http://localhost:5000/memory/session-summary \
  -H "Content-Type: application/json" \
  -d '{
    "sessionId": "session-001"
  }'

# Delete a tape
curl -X POST http://localhost:5000/memory/delete \
  -H "Content-Type: application/json" \
  -d '{
    "tapeId": "65f3a2b9c8d4e1f0a1234567"
  }'

# Get latest tapes for export
curl -X POST http://localhost:5000/memory/unwind \
  -H "Content-Type: application/json" \
  -d '{
    "count": 10,
    "project": "my-app"
  }'

Running Locally

Prerequisites

  • .NET 10 SDK
  • A database backend:
    • MongoDB (default): docker run -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME=mcpuser -e MONGO_INITDB_ROOT_PASSWORD=mcppassword mongo:8
    • ChromaDB: docker run -p 8000:8000 ghcr.io/chroma-core/chroma:latest

Build and Run

# Build the project
dotnet build

# Run with MongoDB (default)
dotnet run --project memory-mcp

# Run with ChromaDB
export MEMORY_BACKEND=chromadb
dotnet run --project memory-mcp

# Run with custom MongoDB settings
export MEMORY_BACKEND=mongo
export MONGO_CONNECTION_STRING="mongodb://mcpuser:mcppassword@localhost:27017"
export MONGO_DATABASE=mcp
export MONGO_COLLECTION=tapes
dotnet run --project memory-mcp

The HTTP API will be available at http://localhost:5000.

Testing with HTTP Client

Open memory-mcp/test/memory.http in JetBrains Rider to interactively test all endpoints.

Running with Docker Compose

# Build and start all services
docker compose up -d

# View logs
docker compose logs -f memory-mcp

This starts:

  • MongoDB on port 27017 with authentication
  • Memory MCP on port 5000, configured to use MongoDB

Building the Docker Image

The project is configured to build as dnnsdev/tapedeck:latest using .NET SDK container support.

# Build and publish the container image
dotnet publish /t:PublishContainer -c Release

# Or specify a custom tag
dotnet publish /t:PublishContainer -c Release -p:ContainerImageTags=latest

Using Dockerfile

# Build from the repository root
docker build -t dnnsdev/tapedeck:latest -f memory-mcp/Dockerfile .

Environment Variables

VariableDescriptionDefault
MEMORY_BACKENDDatabase backend (chromadb or mongo)mongo
MONGO_CONNECTION_STRINGMongoDB connection stringmongodb://mcpuser:mcppassword@localhost:27017
MONGO_DATABASEMongoDB database namemcp
MONGO_COLLECTIONMongoDB collection nametapes

MCP Client Configuration

Add to your MCP client configuration (e.g., Claude Desktop claude_desktop_config.json):

{
  "mcpServers": {
    "memory": {
      "command": "dotnet",
      "args": ["run", "--project", "/path/to/memory-mcp/memory-mcp"],
      "env": {
        "MEMORY_BACKEND": "mongo",
        "MONGO_CONNECTION_STRING": "mongodb://mcpuser:mcppassword@localhost:27017"
      }
    }
  }
}
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover